]> git.eshelyaron.com Git - emacs.git/commitdiff
* nsterm.m (last_window): New variable.
authorJan Djärv <jan.h.d@swipnet.se>
Wed, 28 Aug 2013 16:20:15 +0000 (18:20 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Wed, 28 Aug 2013 16:20:15 +0000 (18:20 +0200)
(EV_TRAILER2): New macro.
(EV_TRAILER): Call EV_TRAILER2.
(mouseMoved:):  Add support for mouse-autoselect-window
on nextstep.

Fixes: debbugs:6888
src/ChangeLog
src/nsterm.m

index e543c982ae1c05889d7ae468ec16b34000bf4a0e..7cae8e05f2573a3045443be3de8b7ae188382c44 100644 (file)
@@ -1,3 +1,11 @@
+2013-08-28  Davor Cubranic  <cubranic@stat.ubc.ca> (tiny change)
+
+       * nsterm.m (last_window): New variable.
+       (EV_TRAILER2): New macro.
+       (EV_TRAILER): Call EV_TRAILER2.
+       (mouseMoved:):  Add support for mouse-autoselect-window
+       on nextstep (Bug#6888).
+
 2013-08-28  Andreas Schwab  <schwab@suse.de>
 
        * regex.c (CHAR_CHARSET, CHARSET_LEADING_CODE_BASE, CHAR_HEAD_P)
index 750d8b25b4d7b3e17eb686920f2a24cf403acf3e..1f4ebcfefd9f097c65fadaca2f418dc4e8dcb09e 100644 (file)
@@ -184,6 +184,9 @@ 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;
@@ -308,8 +311,13 @@ static CGPoint menu_mouse_point;
 /* This is a piece of code which is common to all the event handling
    methods.  Maybe it should even be a function.  */
 #define EV_TRAILER(e)                                                   \
-    {                                                                   \
-      XSETFRAME (emacs_event->frame_or_window, emacsframe);             \
+  {                                                                     \
+    XSETFRAME (emacs_event->frame_or_window, emacsframe);               \
+    EV_TRAILER2 (e);                                                    \
+  }
+
+#define EV_TRAILER2(e)                                                  \
+  {                                                                     \
       if (e) emacs_event->timestamp = EV_TIMESTAMP (e);                 \
       if (q_event_ptr)                                                  \
         {                                                               \
@@ -5465,6 +5473,27 @@ not_in_argv (NSString *arg)
   previous_help_echo_string = help_echo_string;
   help_echo_string = Qnil;
 
+  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);
+      if (WINDOWP (window)
+          && !EQ (window, last_window)
+          && !EQ (window, selected_window)
+          && (focus_follows_mouse
+              || (EQ (XWINDOW (window)->frame,
+                      XWINDOW (selected_window)->frame))))
+        {
+          NSTRACE (in_window);
+          emacs_event->kind = SELECT_WINDOW_EVENT;
+          emacs_event->frame_or_window = window;
+          EV_TRAILER2 (e);
+        }
+      last_window = window;
+    }
+
   if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x,
                             last_mouse_motion_position.y))
     help_echo_string = previous_help_echo_string;