]> git.eshelyaron.com Git - emacs.git/commitdiff
* msdos.c (last_mouse_window): Move to...
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 2 Sep 2013 06:45:04 +0000 (10:45 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 2 Sep 2013 06:45:04 +0000 (10:45 +0400)
(dos_rawgetc): ...this function and adjust comment.
* nsterm.m (last_window): Rename to last_mouse_window, move to...
(mouseMoved): ...this function and adjust comment.
* w32term.c (last_window): Likewise with...
(w32_read_socket): ...this function.
* xterm.c (last_window): Likewise with...
(handle_one_xevent): ...this function.

src/ChangeLog
src/msdos.c
src/nsterm.m
src/w32term.c
src/xterm.c

index dd47935f47b4eb64f7c63b482ccd69f25259308e..1806e642c7142b94d866d1d6f54ce700a3d26e20 100644 (file)
@@ -1,3 +1,14 @@
+2013-09-02  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * msdos.c (last_mouse_window): Move to...
+       (dos_rawgetc): ...this function and adjust comment.
+       * nsterm.m (last_window): Rename to last_mouse_window, move to...
+       (mouseMoved): ...this function and adjust comment.
+       * w32term.c (last_window): Likewise with...
+       (w32_read_socket): ...this function.
+       * xterm.c (last_window): Likewise with...
+       (handle_one_xevent): ...this function.
+
 2013-09-02  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * window.h (Vmouse_window, Vmouse_event): Remove the leftovers.
index 025b685e26c01734cc32ccf8db0f933b204f0589..7142c3ada773cecc39bb70738add0a64e1313208 100644 (file)
@@ -946,9 +946,6 @@ IT_write_glyphs (struct frame *f, struct glyph *str, int str_len)
                          Mouse Highlight (and friends..)
  ************************************************************************/
 
-/* Last window where we saw the mouse.  Used by mouse-autoselect-window.  */
-static Lisp_Object last_mouse_window;
-
 static int mouse_preempted = 0;        /* non-zero when XMenu gobbles mouse events */
 
 int
@@ -2668,10 +2665,10 @@ dos_rawgetc (void)
          /* Generate SELECT_WINDOW_EVENTs when needed.  */
          if (!NILP (Vmouse_autoselect_window))
            {
-             mouse_window = window_from_coordinates (SELECTED_FRAME (),
-                                                     mouse_last_x,
-                                                     mouse_last_y,
-                                                     0, 0);
+             static Lisp_Object last_mouse_window;
+
+             mouse_window = window_from_coordinates
+               (SELECTED_FRAME (), mouse_last_x, mouse_last_y, 0, 0);
              /* A window will be selected only when it is not
                 selected now, and the last mouse movement event was
                 not in it.  A minibuffer window will be selected iff
@@ -2686,10 +2683,9 @@ dos_rawgetc (void)
                  event.timestamp = event_timestamp ();
                  kbd_buffer_store_event (&event);
                }
+             /* Remember the last window where we saw the mouse.  */
              last_mouse_window = mouse_window;
            }
-         else
-           last_mouse_window = Qnil;
 
          previous_help_echo_string = help_echo_string;
          help_echo_string = help_echo_object = help_echo_window = Qnil;
index e4c88ff2ad4dee5637bd9ef816bf5fee00606c75..31053ca7a0d3ef5fee5708a5640b272de356f1c5 100644 (file)
@@ -184,9 +184,6 @@ struct ns_display_info *x_display_list; /* Chain of existing displays */
 Lisp_Object ns_display_name_list;
 long context_menu_value = 0;
 
-/* Last window where we saw the mouse.  Used by mouse-autoselect-window.  */
-static Lisp_Object last_window;
-
 /* display update */
 NSPoint last_mouse_motion_position;
 static NSRect last_mouse_glyph;
@@ -5458,11 +5455,13 @@ not_in_argv (NSString *arg)
   if (!NILP (Vmouse_autoselect_window))
     {
       NSTRACE (mouse_autoselect_window);
-      Lisp_Object window;
-      window = window_from_coordinates(emacsframe, last_mouse_motion_position.x,
-                                       last_mouse_motion_position.y, 0, 0);
+      static Lisp_Object last_mouse_window;
+      Lisp_Object window = window_from_coordinates
+       (emacsframe, last_mouse_motion_position.x,
+        last_mouse_motion_position.y, 0, 0);
+
       if (WINDOWP (window)
-          && !EQ (window, last_window)
+          && !EQ (window, last_mouse_window)
           && !EQ (window, selected_window)
           && (focus_follows_mouse
               || (EQ (XWINDOW (window)->frame,
@@ -5473,7 +5472,8 @@ not_in_argv (NSString *arg)
           emacs_event->frame_or_window = window;
           EV_TRAILER2 (e);
         }
-      last_window = window;
+      /* Remember the last window where we saw the mouse.  */
+      last_mouse_window = window;
     }
 
   if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x,
index 4cf025771b4c2d2c04a085be75791c7a0cc7b75f..532ded7cdada14f1d508cf6eda7f6c495bf51f77 100644 (file)
@@ -84,9 +84,6 @@ static int last_mousemove_y = 0;
 
 static int any_help_event_p;
 
-/* Last window where we saw the mouse.  Used by mouse-autoselect-window.  */
-static Lisp_Object last_window;
-
 extern unsigned int msh_mousewheel;
 
 extern void free_frame_menubar (struct frame *);
@@ -4503,18 +4500,16 @@ w32_read_socket (struct terminal *terminal,
              /* Generate SELECT_WINDOW_EVENTs when needed.  */
              if (!NILP (Vmouse_autoselect_window))
                {
-                 Lisp_Object window;
-                 int x = LOWORD (msg.msg.lParam);
-                 int y = HIWORD (msg.msg.lParam);
-
-                 window = window_from_coordinates (f, x, y, 0, 0);
+                 static Lisp_Object last_mouse_window;
+                 Lisp_Object window = window_from_coordinates
+                   (f, LOWORD (msg.msg.lParam), HIWORD (msg.msg.lParam), 0, 0);
 
                  /* Window will be selected only when it is not
                     selected now and last mouse movement event was
                     not in it.  Minibuffer window will be selected
                     only when it is active.  */
                  if (WINDOWP (window)
-                     && !EQ (window, last_window)
+                     && !EQ (window, last_mouse_window)
                      && !EQ (window, selected_window)
                      /* For click-to-focus window managers
                         create event iff we don't leave the
@@ -4526,8 +4521,8 @@ w32_read_socket (struct terminal *terminal,
                      inev.kind = SELECT_WINDOW_EVENT;
                      inev.frame_or_window = window;
                    }
-
-                 last_window = window;
+                 /* Remember the last window where we saw the mouse.  */
+                 last_mouse_window = window;
                }
              if (!note_mouse_movement (f, &msg.msg))
                help_echo_string = previous_help_echo_string;
index c4e3aeaa615adf268bfbaeb3b77c0ddf5c335284..4355e9d6b83523b4b8fb346503be768485c8f091 100644 (file)
@@ -140,16 +140,11 @@ int use_xim = 1;
 int use_xim = 0;  /* configure --without-xim */
 #endif
 
-\f
-
 /* Non-zero means that a HELP_EVENT has been generated since Emacs
    start.  */
 
 static bool any_help_event_p;
 
-/* Last window where we saw the mouse.  Used by mouse-autoselect-window.  */
-static Lisp_Object last_window;
-
 /* This is a chain of structures for all the X displays currently in
    use.  */
 
@@ -6656,18 +6651,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
             /* Generate SELECT_WINDOW_EVENTs when needed.
                Don't let popup menus influence things (bug#1261).  */
             if (!NILP (Vmouse_autoselect_window) && !popup_activated ())
-              {
-                Lisp_Object window;
-
-                window = window_from_coordinates (f,
-                                                  event.xmotion.x, event.xmotion.y,
-                                                  0, 0);
-
-                /* Window will be selected only when it is not selected now and
-                   last mouse movement event was not in it.  Minibuffer window
-                   will be selected only when it is active.  */
-                if (WINDOWP (window)
-                    && !EQ (window, last_window)
+             {
+               static Lisp_Object last_mouse_window;
+               Lisp_Object window = window_from_coordinates
+                 (f, event.xmotion.x, event.xmotion.y, 0, 0);
+
+               /* Window will be selected only when it is not selected now and
+                  last mouse movement event was not in it.  Minibuffer window
+                  will be selected only when it is active.  */
+               if (WINDOWP (window)
+                   && !EQ (window, last_mouse_window)
                    && !EQ (window, selected_window)
                    /* For click-to-focus window managers
                       create event iff we don't leave the
@@ -6675,13 +6668,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
                    && (focus_follows_mouse
                        || (EQ (XWINDOW (window)->frame,
                                XWINDOW (selected_window)->frame))))
-                  {
-                    inev.ie.kind = SELECT_WINDOW_EVENT;
-                    inev.ie.frame_or_window = window;
-                  }
-
-                last_window=window;
-              }
+                 {
+                   inev.ie.kind = SELECT_WINDOW_EVENT;
+                   inev.ie.frame_or_window = window;
+                 }
+               /* Remember the last window where we saw the mouse.  */
+               last_mouse_window = window;
+             }
             if (!note_mouse_movement (f, &event.xmotion))
              help_echo_string = previous_help_echo_string;
           }