Commit 5d22ded9 authored by Jason Rumney's avatar Jason Rumney
Browse files

(current_popup_menu): Use from w32menu.c.

(w32_wnd_proc): Use menubar_active and current_popup_menu to
determine whether a menubar menu has been cancelled.
parent b2a916a0
...@@ -297,6 +297,9 @@ extern int w32_use_visible_system_caret; ...@@ -297,6 +297,9 @@ extern int w32_use_visible_system_caret;
static HWND w32_visible_system_caret_hwnd; static HWND w32_visible_system_caret_hwnd;
/* From w32menu.c */
extern HMENU current_popup_menu;
/* Error if we are not connected to MS-Windows. */ /* Error if we are not connected to MS-Windows. */
void void
...@@ -3411,7 +3414,9 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3411,7 +3414,9 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
KillTimer (hwnd, menu_free_timer); KillTimer (hwnd, menu_free_timer);
menu_free_timer = 0; menu_free_timer = 0;
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
if (!f->output_data.w32->menu_command_in_progress) /* If a popup menu is active, don't wipe its strings. */
if (f->output_data.w32->menubar_active
&& 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);
...@@ -3473,10 +3478,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3473,10 +3478,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
case WM_EXITMENULOOP: case WM_EXITMENULOOP:
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
/* If a menu command is not already in progress, check again /* If a menu is still active, check again after a short delay,
after a short delay, since Windows often (always?) sends the since Windows often (always?) sends the WM_EXITMENULOOP
WM_EXITMENULOOP before the corresponding WM_COMMAND message. */ before the corresponding WM_COMMAND message.
if (f && !f->output_data.w32->menu_command_in_progress) Don't do this if a popup menu is active, since it is only
menubar menus that require cleaning up in this way.
*/
if (f && f->output_data.w32->menubar_active && 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;
...@@ -3634,7 +3642,6 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) ...@@ -3634,7 +3642,6 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
if (f && HIWORD (wParam) == 0) if (f && HIWORD (wParam) == 0)
{ {
f->output_data.w32->menu_command_in_progress = 1;
if (menu_free_timer) if (menu_free_timer)
{ {
KillTimer (hwnd, menu_free_timer); KillTimer (hwnd, menu_free_timer);
......
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