summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeffrey Altman <jaltman@secure-endpoints.com>2007-08-08 17:45:37 +0000
committerJeffrey Altman <jaltman@secure-endpoints.com>2007-08-08 17:45:37 +0000
commit632737ed6605e6e977b7e4a28fb40ad9a4f567bd (patch)
tree2dc8f1c9f63ae214b392eeed9073d54385bdf90b /src
parentc40973ff856c64d04f89f58666f5c7eb8b5048b9 (diff)
downloadkrb5-632737ed6605e6e977b7e4a28fb40ad9a4f567bd.tar.gz
krb5-632737ed6605e6e977b7e4a28fb40ad9a4f567bd.tar.xz
krb5-632737ed6605e6e977b7e4a28fb40ad9a4f567bd.zip
Patch developed by kpkoch with style changes from jaltman
The size/position of the main application window is internally updated in response to WM_MOVE messages but is only written to the registry after a timeout period. This is done due to the large number of WM_MOVE messages that can be delivered during a windows drag / resize operation involving the user or explorer shell's tile and cascade operations. (or those involving third party desktop managers.) In NIM 1.8 two different application view modes (standard and advanced) replaced the single view mode in previous releases. The size/position update logic was not modified to take into consideration the possibility that a user might move/resize the window and then quickly toggle modes before the new location or size were recorded to the registry. This change ensures that when a mode change occurs, via a call to khm_set_main_window_mode(), that the current location/size will be written to the registry and any outstanding timer, MW_RESIZE_TIMER, will be cleared. The logic to save the location/size has been extracted into the new static function main_wnd_save_sizepos(). main_wnd_save_sizepos() is only called after the application window has been created. ticket: 5613 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19760 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/windows/identity/ui/mainwnd.c94
1 files changed, 54 insertions, 40 deletions
diff --git a/src/windows/identity/ui/mainwnd.c b/src/windows/identity/ui/mainwnd.c
index d177b114c7..f96bee9187 100644
--- a/src/windows/identity/ui/mainwnd.c
+++ b/src/windows/identity/ui/mainwnd.c
@@ -205,6 +205,50 @@ khm_ui_cb(LPARAM lParam) {
}
}
+
+static void
+main_wnd_save_sizepos() {
+ RECT r;
+ khm_handle csp_cw;
+ khm_handle csp_mw;
+ const wchar_t * wconfig;
+
+ KillTimer(khm_hwnd_main, MW_RESIZE_TIMER);
+
+ if (khm_main_wnd_mode == KHM_MAIN_WND_MINI)
+ wconfig = L"Windows\\MainMini";
+ else
+ wconfig = L"Windows\\Main";
+
+ GetWindowRect(khm_hwnd_main, &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,
@@ -567,46 +611,7 @@ khm_main_wnd_proc(HWND hwnd,
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();
return 0;
@@ -1114,6 +1119,15 @@ khm_set_main_window_mode(int mode) {
khui_refresh_actions();
+ /*
+ * set the window position before the global khm_main_wnd_mode
+ * is updated. otherwise, the windows position for the wrong
+ * mode will be set. Do not set the window position if the
+ * main application window has not yet been created.
+ */
+ if (khm_hwnd_main)
+ main_wnd_save_sizepos();
+
khm_main_wnd_mode = mode;
if (khm_hwnd_main) {
khm_get_main_window_rect(&r);