Commit 58e55497 authored by Jason Rumney's avatar Jason Rumney

* w32fns.c (menubar_in_use): New flag.

(w32_wnd_proc) [WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND]:
Use it.
parent 72a3a66a
2007-02-22 Jason Rumney <jasonr@gnu.org> 2007-02-22 Jason Rumney <jasonr@gnu.org>
* w32fns.c (menu_bar_in_use): New flag. * w32fns.c (menubar_in_use): New flag.
(w32_wnd_proc) [WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND]: (w32_wnd_proc) [WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND]:
Use it. Use it.
......
...@@ -299,6 +299,7 @@ static HWND w32_visible_system_caret_hwnd; ...@@ -299,6 +299,7 @@ static HWND w32_visible_system_caret_hwnd;
/* From w32menu.c */ /* From w32menu.c */
extern HMENU current_popup_menu; extern HMENU current_popup_menu;
static int menubar_in_use = 0;
/* Error if we are not connected to MS-Windows. */ /* Error if we are not connected to MS-Windows. */
...@@ -3415,12 +3416,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3415,12 +3416,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
menu_free_timer = 0; menu_free_timer = 0;
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
/* If a popup menu is active, don't wipe its strings. */ /* If a popup menu is active, don't wipe its strings. */
if (f->output_data.w32->menubar_active if (menubar_in_use
&& current_popup_menu == NULL) && current_popup_menu == NULL)
{ {
/* Free memory used by owner-drawn and help-echo strings. */ /* Free memory used by owner-drawn and help-echo strings. */
w32_free_menu_strings (hwnd); w32_free_menu_strings (hwnd);
f->output_data.w32->menubar_active = 0; f->output_data.w32->menubar_active = 0;
menubar_in_use = 0;
} }
} }
return 0; return 0;
...@@ -3472,8 +3474,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3472,8 +3474,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
if (find_deferred_msg (hwnd, msg) != NULL) if (find_deferred_msg (hwnd, msg) != NULL)
abort (); abort ();
if (f) menubar_in_use = 1;
f->output_data.w32->menubar_active = 1;
return send_deferred_msg (&msg_buf, hwnd, msg, wParam, lParam); return send_deferred_msg (&msg_buf, hwnd, msg, wParam, lParam);
} }
...@@ -3487,7 +3488,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3487,7 +3488,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
Don't do this if a popup menu is active, since it is only Don't do this if a popup menu is active, since it is only
menubar menus that require cleaning up in this way. menubar menus that require cleaning up in this way.
*/ */
if (f && f->output_data.w32->menubar_active && current_popup_menu == NULL) if (f && menubar_in_use && current_popup_menu == NULL)
menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL); menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL);
goto dflt; goto dflt;
...@@ -3642,6 +3643,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3642,6 +3643,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
} }
goto command; goto command;
case WM_COMMAND: case WM_COMMAND:
menubar_in_use = 0;
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
if (f && HIWORD (wParam) == 0) if (f && HIWORD (wParam) == 0)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment