emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32fns.c


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32fns.c
Date: Fri, 22 Feb 2002 19:04:02 -0500

Index: emacs/src/w32fns.c
diff -c emacs/src/w32fns.c:1.155 emacs/src/w32fns.c:1.156
*** emacs/src/w32fns.c:1.155    Sun Feb 17 18:44:09 2002
--- emacs/src/w32fns.c  Fri Feb 22 19:04:02 2002
***************
*** 286,294 ****
  
  static int button_state = 0;
  static W32Msg saved_mouse_button_msg;
! static unsigned mouse_button_timer;   /* non-zero when timer is active */
  static W32Msg saved_mouse_move_msg;
! static unsigned mouse_move_timer;
  
  /* Window that is tracking the mouse.  */
  static HWND track_mouse_window;
--- 286,294 ----
  
  static int button_state = 0;
  static W32Msg saved_mouse_button_msg;
! static unsigned mouse_button_timer = 0;       /* non-zero when timer is 
active */
  static W32Msg saved_mouse_move_msg;
! static unsigned mouse_move_timer = 0;
  
  /* Window that is tracking the mouse.  */
  static HWND track_mouse_window;
***************
*** 297,304 ****
--- 297,310 ----
  /* W95 mousewheel handler */
  unsigned int msh_mousewheel = 0;      
  
+ /* Timers */
  #define MOUSE_BUTTON_ID       1
  #define MOUSE_MOVE_ID 2
+ #define MENU_FREE_ID 3
+ /* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP
+    is received.  */
+ #define MENU_FREE_DELAY 1000
+ static unsigned menu_free_timer = 0;
  
  /* The below are defined in frame.c.  */
  
***************
*** 4769,4774 ****
--- 4775,4791 ----
          KillTimer (hwnd, mouse_move_timer);
          mouse_move_timer = 0;
        }
+       else if (wParam == menu_free_timer)
+       {
+         KillTimer (hwnd, menu_free_timer);
+         menu_free_timer = 0;
+         if (!f->output_data.w32->menu_command_in_progress)
+           {
+             /* Free memory used by owner-drawn and help-echo strings.  */
+             w32_free_menu_strings (hwnd);
+             f->output_data.w32->menubar_active = 0;
+           }
+       }
        return 0;
    
      case WM_NCACTIVATE:
***************
*** 4824,4835 ****
      case WM_EXITMENULOOP:
        f = x_window_to_frame (dpyinfo, hwnd);
  
!       /* Free memory used by owner-drawn and help-echo strings.  */
!       w32_free_menu_strings (hwnd);
! 
!       /* Indicate that menubar can be modified again.  */
!       if (f)
!       f->output_data.w32->menubar_active = 0;
        goto dflt;
  
      case WM_MENUSELECT:
--- 4841,4851 ----
      case WM_EXITMENULOOP:
        f = x_window_to_frame (dpyinfo, hwnd);
  
!       /* If a menu command is not already in progress, check again
!        after a short delay, since Windows often (always?) sends the
!        WM_EXITMENULOOP before the corresponding WM_COMMAND message.  */
!       if (f && !f->output_data.w32->menu_command_in_progress)
!       menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL);
        goto dflt;
  
      case WM_MENUSELECT:
***************
*** 4966,4974 ****
          w32_system_caret_hwnd = NULL;
          DestroyCaret ();
        }
      case WM_MOVE:
      case WM_SIZE:
-     case WM_COMMAND:
      command:
        wmsg.dwModifiers = w32_get_modifiers ();
        my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
--- 4982,5001 ----
          w32_system_caret_hwnd = NULL;
          DestroyCaret ();
        }
+       goto command;
+     case WM_COMMAND:
+       f = x_window_to_frame (dpyinfo, hwnd);
+       if (f && HIWORD (wParam) == 0)
+       {
+         f->output_data.w32->menu_command_in_progress = 1;
+         if (menu_free_timer)
+           {
+             KillTimer (hwnd, menu_free_timer);
+             menu_free_timer = 0;        
+           }
+       }
      case WM_MOVE:
      case WM_SIZE:
      command:
        wmsg.dwModifiers = w32_get_modifiers ();
        my_post_msg (&wmsg, hwnd, msg, wParam, lParam);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]