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

Kevin Koch via RT rt at krbdev.mit.edu
Tue Aug 7 22:19:06 EDT 2007


Patch:

Index: mainwnd.c
===================================================================
--- mainwnd.c	(revision 19745)
+++ mainwnd.c	(working copy)
@@ -205,6 +205,44 @@
     }
 }
 
+void main_wnd_save_sizepos(HWND hwnd) {
+    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";
+
+    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,
@@ -383,6 +424,8 @@
 
             /* layout control */
         case KHUI_ACTION_LAYOUT_MINI:
+            KillTimer(hwnd, MW_RESIZE_TIMER);
+            main_wnd_save_sizepos(hwnd);
             if (khm_main_wnd_mode == KHM_MAIN_WND_MINI) {
                 khm_set_main_window_mode(KHM_MAIN_WND_NORMAL);
             } else {
@@ -567,54 +610,11 @@
 
     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);
-            }
-
+            main_wnd_save_sizepos(hwnd);
             return 0;
-
         } else if (wParam == MW_REFRESH_TIMER) {
             kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 0);
-
             return 0;
-
         }
         break;
 



More information about the krb5-bugs mailing list