Mercurial > emacs
comparison src/w32fns.c @ 43472:7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
(menu_free_timer): New variable.
(MENU_FREE_ID, MENU_FREE_DELAY): New constants.
(w32_wnd_proc) <WM_TIMER>: Handle menu_free_timer.
<WM_EXITMENULOOP>: Delay before freeing menu. Do nothing if a
menu command is in progress.
<WM_COMMAND>: Set the menu_command_in_progress flag. Kill
any menu_free_timer that is running.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sat, 23 Feb 2002 00:04:02 +0000 |
parents | 8782b8cfed62 |
children | a3cecd273126 |
comparison
equal
deleted
inserted
replaced
43471:20574c51c791 | 43472:7faac536665f |
---|---|
284 #define MMOUSE 2 | 284 #define MMOUSE 2 |
285 #define RMOUSE 4 | 285 #define RMOUSE 4 |
286 | 286 |
287 static int button_state = 0; | 287 static int button_state = 0; |
288 static W32Msg saved_mouse_button_msg; | 288 static W32Msg saved_mouse_button_msg; |
289 static unsigned mouse_button_timer; /* non-zero when timer is active */ | 289 static unsigned mouse_button_timer = 0; /* non-zero when timer is active */ |
290 static W32Msg saved_mouse_move_msg; | 290 static W32Msg saved_mouse_move_msg; |
291 static unsigned mouse_move_timer; | 291 static unsigned mouse_move_timer = 0; |
292 | 292 |
293 /* Window that is tracking the mouse. */ | 293 /* Window that is tracking the mouse. */ |
294 static HWND track_mouse_window; | 294 static HWND track_mouse_window; |
295 FARPROC track_mouse_event_fn; | 295 FARPROC track_mouse_event_fn; |
296 | 296 |
297 /* W95 mousewheel handler */ | 297 /* W95 mousewheel handler */ |
298 unsigned int msh_mousewheel = 0; | 298 unsigned int msh_mousewheel = 0; |
299 | 299 |
300 /* Timers */ | |
300 #define MOUSE_BUTTON_ID 1 | 301 #define MOUSE_BUTTON_ID 1 |
301 #define MOUSE_MOVE_ID 2 | 302 #define MOUSE_MOVE_ID 2 |
303 #define MENU_FREE_ID 3 | |
304 /* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP | |
305 is received. */ | |
306 #define MENU_FREE_DELAY 1000 | |
307 static unsigned menu_free_timer = 0; | |
302 | 308 |
303 /* The below are defined in frame.c. */ | 309 /* The below are defined in frame.c. */ |
304 | 310 |
305 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | 311 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; |
306 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; | 312 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
4767 saved_mouse_move_msg.msg.hwnd = 0; | 4773 saved_mouse_move_msg.msg.hwnd = 0; |
4768 } | 4774 } |
4769 KillTimer (hwnd, mouse_move_timer); | 4775 KillTimer (hwnd, mouse_move_timer); |
4770 mouse_move_timer = 0; | 4776 mouse_move_timer = 0; |
4771 } | 4777 } |
4778 else if (wParam == menu_free_timer) | |
4779 { | |
4780 KillTimer (hwnd, menu_free_timer); | |
4781 menu_free_timer = 0; | |
4782 if (!f->output_data.w32->menu_command_in_progress) | |
4783 { | |
4784 /* Free memory used by owner-drawn and help-echo strings. */ | |
4785 w32_free_menu_strings (hwnd); | |
4786 f->output_data.w32->menubar_active = 0; | |
4787 } | |
4788 } | |
4772 return 0; | 4789 return 0; |
4773 | 4790 |
4774 case WM_NCACTIVATE: | 4791 case WM_NCACTIVATE: |
4775 /* Windows doesn't send us focus messages when putting up and | 4792 /* Windows doesn't send us focus messages when putting up and |
4776 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. | 4793 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. |
4822 } | 4839 } |
4823 | 4840 |
4824 case WM_EXITMENULOOP: | 4841 case WM_EXITMENULOOP: |
4825 f = x_window_to_frame (dpyinfo, hwnd); | 4842 f = x_window_to_frame (dpyinfo, hwnd); |
4826 | 4843 |
4827 /* Free memory used by owner-drawn and help-echo strings. */ | 4844 /* If a menu command is not already in progress, check again |
4828 w32_free_menu_strings (hwnd); | 4845 after a short delay, since Windows often (always?) sends the |
4829 | 4846 WM_EXITMENULOOP before the corresponding WM_COMMAND message. */ |
4830 /* Indicate that menubar can be modified again. */ | 4847 if (f && !f->output_data.w32->menu_command_in_progress) |
4831 if (f) | 4848 menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL); |
4832 f->output_data.w32->menubar_active = 0; | |
4833 goto dflt; | 4849 goto dflt; |
4834 | 4850 |
4835 case WM_MENUSELECT: | 4851 case WM_MENUSELECT: |
4836 /* Direct handling of help_echo in menus. Should be safe now | 4852 /* Direct handling of help_echo in menus. Should be safe now |
4837 that we generate the help_echo by placing a help event in the | 4853 that we generate the help_echo by placing a help event in the |
4964 { | 4980 { |
4965 w32_visible_system_caret_hwnd = NULL; | 4981 w32_visible_system_caret_hwnd = NULL; |
4966 w32_system_caret_hwnd = NULL; | 4982 w32_system_caret_hwnd = NULL; |
4967 DestroyCaret (); | 4983 DestroyCaret (); |
4968 } | 4984 } |
4985 goto command; | |
4986 case WM_COMMAND: | |
4987 f = x_window_to_frame (dpyinfo, hwnd); | |
4988 if (f && HIWORD (wParam) == 0) | |
4989 { | |
4990 f->output_data.w32->menu_command_in_progress = 1; | |
4991 if (menu_free_timer) | |
4992 { | |
4993 KillTimer (hwnd, menu_free_timer); | |
4994 menu_free_timer = 0; | |
4995 } | |
4996 } | |
4969 case WM_MOVE: | 4997 case WM_MOVE: |
4970 case WM_SIZE: | 4998 case WM_SIZE: |
4971 case WM_COMMAND: | |
4972 command: | 4999 command: |
4973 wmsg.dwModifiers = w32_get_modifiers (); | 5000 wmsg.dwModifiers = w32_get_modifiers (); |
4974 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 5001 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4975 goto dflt; | 5002 goto dflt; |
4976 | 5003 |