GNU bug report logs -
#6888
mouse-autoselect-window on OS X
Previous Next
Reported by: Éric Martin <emartin <at> cse.unsw.edu.au>
Date: Fri, 20 Aug 2010 13:53:02 UTC
Severity: normal
Tags: help, patch
Found in version 23.2
Done: Jan Djärv <jan.h.d <at> swipnet.se>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
26 aug 2013 kl. 15:16 skrev martin rudalics <rudalics <at> gmx.at>:
>> It does but I don't want to check it in as is. It needs formatting fixes and there is some unfortunate code duplication that needs to be done in another way.
>
> Can you please tell Davor how to rewrite it?
>
> Thanks, martin
=== modified file 'src/nsterm.m'
--- src/nsterm.m 2013-08-23 04:03:25 +0000
+++ src/nsterm.m 2013-08-24 09:18:57 +0000
@@ -184,6 +184,9 @@
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 @@
/* 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) \
{ \
@@ -5490,6 +5498,27 @@
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;
This bug report was last modified 11 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.