[krbdev.mit.edu #5613] NIM GUI: views jump around on the screen

Kevin Koch via RT rt at krbdev.mit.edu
Tue Aug 7 13:53:04 EDT 2007


> The bug is that toggling View->Advanced does not save the current
> location.  Fix that.  Push-pins have nothing to do with the location
> of the Application Window regardless of View.

Actually, the bug was that the size & position were being remembered 
at the wrong time.

The good news is that the patch below fixes the problem.  The bad news 
is that it doesn't offer any insight into the display inconsistency 
bugs.

Patch:

Index: mainwnd.c
===================================================================
--- mainwnd.c	(revision 19745)
+++ mainwnd.c	(working copy)
@@ -205,6 +205,45 @@
     }
 }
 
+void main_wnd_save_sizepos(HWND hwnd) {
+    RECT r;
+    khm_handle csp_cw;
+    khm_handle csp_mw;
+    const wchar_t * wconfig;
+
+_report_cs0(KHERR_DEBUG_1, L"KPK mainwnd.c main_wnd_save_sizepos");
+    if (khm_main_wnd_mode == KHM_MAIN_WND_MINI)
+        wconfig = L"Windows\\MainMini";
+    else
+        wconfig = L"Windows\\Main";
+
+    GetWindowRect(hwnd, &r);
+
+    if (KHM_SUCCEEDED(khc_open_space(NULL,
+                                     L"CredWindow",
+                                     KHM_PERM_WRITE,
+                                     &csp_cw))) {
+        if (KHM_SUCCEEDED(khc_open_space(csp_cw,
+                                        wconfig,
+                                        KHM_PERM_WRITE,
+                                        &csp_mw))) {
+            khm_int32 t;
+
+            khc_write_int32(csp_mw, L"XPos", r.left);
+            khc_write_int32(csp_mw, L"YPos", r.top);
+            khc_write_int32(csp_mw, L"Width", r.right - r.left);
+            khc_write_int32(csp_mw, L"Height", r.bottom - r.top);
+
+            if (KHM_SUCCEEDED(khc_read_int32(csp_mw, L"Dock", &t)) && 
t != KHM_DOCK_NONE) {
+                khc_write_int32(csp_mw, L"Dock", KHM_DOCK_AUTO);
+            }
+
+            khc_close_space(csp_mw);
+        }
+        khc_close_space(csp_cw);
+    }
+}
+
 LRESULT CALLBACK 
 khm_main_wnd_proc(HWND hwnd,
                   UINT uMsg,
@@ -544,17 +601,6 @@
         }
         break;
 
-    case WM_MOVE:
-        {
-            SetTimer(hwnd,
-                     MW_RESIZE_TIMER,
-                     MW_RESIZE_TIMEOUT,
-                     NULL);
-
-            return 0;
-        }
-        break;
-
     case WM_MOVING:
         {
             RECT * r;
@@ -565,60 +611,17 @@
         }
         return TRUE;
 
+    case WM_EXITSIZEMOVE:
+            main_wnd_save_sizepos(hwnd);
+            break;
+
     case WM_TIMER:
-        if (wParam == MW_RESIZE_TIMER) {
-            RECT r;
-            khm_handle csp_cw;
-            khm_handle csp_mw;
-            const wchar_t * wconfig;
-
-            if (khm_main_wnd_mode == KHM_MAIN_WND_MINI)
-                wconfig = L"Windows\\MainMini";
-            else
-                wconfig = L"Windows\\Main";
-
-            KillTimer(hwnd, wParam);
-
-            GetWindowRect(hwnd, &r);
-
-            if (KHM_SUCCEEDED(khc_open_space(NULL,
-                                             L"CredWindow",
-                                             KHM_PERM_WRITE,
-                                             &csp_cw))) {
-                if (KHM_SUCCEEDED(khc_open_space(csp_cw,
-                                                 wconfig,
-                                                 KHM_PERM_WRITE,
-                                                 &csp_mw))) {
-                    khm_int32 t;
-
-                    khc_write_int32(csp_mw, L"XPos", r.left);
-                    khc_write_int32(csp_mw, L"YPos", r.top);
-                    khc_write_int32(csp_mw, L"Width",
-                                    r.right - r.left);
-                    khc_write_int32(csp_mw, L"Height",
-                                    r.bottom - r.top);
-
-                    if (KHM_SUCCEEDED(khc_read_int32(csp_mw, L"Dock", 
&t)) &&
-                        t != KHM_DOCK_NONE) {
-                        khc_write_int32(csp_mw, L"Dock", 
KHM_DOCK_AUTO);
-                    }
-
-                    khc_close_space(csp_mw);
-                }
-                khc_close_space(csp_cw);
-            }
-
-            return 0;
-
-        } else if (wParam == MW_REFRESH_TIMER) {
-            kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 0);
-
-            return 0;
-
+        if (wParam == MW_REFRESH_TIMER) {
+            return kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 
0);
         }
-        break;
 
     case WM_MENUSELECT:
         return khm_menu_handle_select(wParam, lParam);
 
     case KMQ_WM_DISPATCH:



More information about the krb5-bugs mailing list