From: Dmitry Antipov Date: Mon, 2 Sep 2013 06:45:04 +0000 (+0400) Subject: * msdos.c (last_mouse_window): Move to... X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~24 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1fccc5306363a88fc3f663e2a149d0251612d3e9;p=emacs.git * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index dd47935f47b..1806e642c71 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2013-09-02 Dmitry Antipov + + * 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 * window.h (Vmouse_window, Vmouse_event): Remove the leftovers. diff --git a/src/msdos.c b/src/msdos.c index 025b685e26c..7142c3ada77 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -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; diff --git a/src/nsterm.m b/src/nsterm.m index e4c88ff2ad4..31053ca7a0d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -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, diff --git a/src/w32term.c b/src/w32term.c index 4cf025771b4..532ded7cdad 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -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; diff --git a/src/xterm.c b/src/xterm.c index c4e3aeaa615..4355e9d6b83 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -140,16 +140,11 @@ int use_xim = 1; int use_xim = 0; /* configure --without-xim */ #endif - - /* 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; }