aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-09-02 10:45:04 +0400
committerDmitry Antipov2013-09-02 10:45:04 +0400
commit1fccc5306363a88fc3f663e2a149d0251612d3e9 (patch)
tree598c320c94cf1fb004a8b09aad138d37115ec109 /src
parentb7da754d21b4515b3e75b9f28608d99185ea0ec3 (diff)
downloademacs-1fccc5306363a88fc3f663e2a149d0251612d3e9.tar.gz
emacs-1fccc5306363a88fc3f663e2a149d0251612d3e9.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/msdos.c14
-rw-r--r--src/nsterm.m16
-rw-r--r--src/w32term.c17
-rw-r--r--src/xterm.c41
5 files changed, 47 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dd47935f47b..1806e642c71 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
12013-09-02 Dmitry Antipov <dmantipov@yandex.ru> 12013-09-02 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 * msdos.c (last_mouse_window): Move to...
4 (dos_rawgetc): ...this function and adjust comment.
5 * nsterm.m (last_window): Rename to last_mouse_window, move to...
6 (mouseMoved): ...this function and adjust comment.
7 * w32term.c (last_window): Likewise with...
8 (w32_read_socket): ...this function.
9 * xterm.c (last_window): Likewise with...
10 (handle_one_xevent): ...this function.
11
122013-09-02 Dmitry Antipov <dmantipov@yandex.ru>
13
3 * window.h (Vmouse_window, Vmouse_event): Remove the leftovers. 14 * window.h (Vmouse_window, Vmouse_event): Remove the leftovers.
4 * xterm.c (toplevel): Drop obsolete comment and move compose_status... 15 * xterm.c (toplevel): Drop obsolete comment and move compose_status...
5 (handle_one_xevent): ...to here. 16 (handle_one_xevent): ...to here.
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)
946 Mouse Highlight (and friends..) 946 Mouse Highlight (and friends..)
947 ************************************************************************/ 947 ************************************************************************/
948 948
949/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
950static Lisp_Object last_mouse_window;
951
952static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ 949static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */
953 950
954int 951int
@@ -2668,10 +2665,10 @@ dos_rawgetc (void)
2668 /* Generate SELECT_WINDOW_EVENTs when needed. */ 2665 /* Generate SELECT_WINDOW_EVENTs when needed. */
2669 if (!NILP (Vmouse_autoselect_window)) 2666 if (!NILP (Vmouse_autoselect_window))
2670 { 2667 {
2671 mouse_window = window_from_coordinates (SELECTED_FRAME (), 2668 static Lisp_Object last_mouse_window;
2672 mouse_last_x, 2669
2673 mouse_last_y, 2670 mouse_window = window_from_coordinates
2674 0, 0); 2671 (SELECTED_FRAME (), mouse_last_x, mouse_last_y, 0, 0);
2675 /* A window will be selected only when it is not 2672 /* A window will be selected only when it is not
2676 selected now, and the last mouse movement event was 2673 selected now, and the last mouse movement event was
2677 not in it. A minibuffer window will be selected iff 2674 not in it. A minibuffer window will be selected iff
@@ -2686,10 +2683,9 @@ dos_rawgetc (void)
2686 event.timestamp = event_timestamp (); 2683 event.timestamp = event_timestamp ();
2687 kbd_buffer_store_event (&event); 2684 kbd_buffer_store_event (&event);
2688 } 2685 }
2686 /* Remember the last window where we saw the mouse. */
2689 last_mouse_window = mouse_window; 2687 last_mouse_window = mouse_window;
2690 } 2688 }
2691 else
2692 last_mouse_window = Qnil;
2693 2689
2694 previous_help_echo_string = help_echo_string; 2690 previous_help_echo_string = help_echo_string;
2695 help_echo_string = help_echo_object = help_echo_window = Qnil; 2691 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 */
184Lisp_Object ns_display_name_list; 184Lisp_Object ns_display_name_list;
185long context_menu_value = 0; 185long context_menu_value = 0;
186 186
187/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
188static Lisp_Object last_window;
189
190/* display update */ 187/* display update */
191NSPoint last_mouse_motion_position; 188NSPoint last_mouse_motion_position;
192static NSRect last_mouse_glyph; 189static NSRect last_mouse_glyph;
@@ -5458,11 +5455,13 @@ not_in_argv (NSString *arg)
5458 if (!NILP (Vmouse_autoselect_window)) 5455 if (!NILP (Vmouse_autoselect_window))
5459 { 5456 {
5460 NSTRACE (mouse_autoselect_window); 5457 NSTRACE (mouse_autoselect_window);
5461 Lisp_Object window; 5458 static Lisp_Object last_mouse_window;
5462 window = window_from_coordinates(emacsframe, last_mouse_motion_position.x, 5459 Lisp_Object window = window_from_coordinates
5463 last_mouse_motion_position.y, 0, 0); 5460 (emacsframe, last_mouse_motion_position.x,
5461 last_mouse_motion_position.y, 0, 0);
5462
5464 if (WINDOWP (window) 5463 if (WINDOWP (window)
5465 && !EQ (window, last_window) 5464 && !EQ (window, last_mouse_window)
5466 && !EQ (window, selected_window) 5465 && !EQ (window, selected_window)
5467 && (focus_follows_mouse 5466 && (focus_follows_mouse
5468 || (EQ (XWINDOW (window)->frame, 5467 || (EQ (XWINDOW (window)->frame,
@@ -5473,7 +5472,8 @@ not_in_argv (NSString *arg)
5473 emacs_event->frame_or_window = window; 5472 emacs_event->frame_or_window = window;
5474 EV_TRAILER2 (e); 5473 EV_TRAILER2 (e);
5475 } 5474 }
5476 last_window = window; 5475 /* Remember the last window where we saw the mouse. */
5476 last_mouse_window = window;
5477 } 5477 }
5478 5478
5479 if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x, 5479 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;
84 84
85static int any_help_event_p; 85static int any_help_event_p;
86 86
87/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
88static Lisp_Object last_window;
89
90extern unsigned int msh_mousewheel; 87extern unsigned int msh_mousewheel;
91 88
92extern void free_frame_menubar (struct frame *); 89extern void free_frame_menubar (struct frame *);
@@ -4503,18 +4500,16 @@ w32_read_socket (struct terminal *terminal,
4503 /* Generate SELECT_WINDOW_EVENTs when needed. */ 4500 /* Generate SELECT_WINDOW_EVENTs when needed. */
4504 if (!NILP (Vmouse_autoselect_window)) 4501 if (!NILP (Vmouse_autoselect_window))
4505 { 4502 {
4506 Lisp_Object window; 4503 static Lisp_Object last_mouse_window;
4507 int x = LOWORD (msg.msg.lParam); 4504 Lisp_Object window = window_from_coordinates
4508 int y = HIWORD (msg.msg.lParam); 4505 (f, LOWORD (msg.msg.lParam), HIWORD (msg.msg.lParam), 0, 0);
4509
4510 window = window_from_coordinates (f, x, y, 0, 0);
4511 4506
4512 /* Window will be selected only when it is not 4507 /* Window will be selected only when it is not
4513 selected now and last mouse movement event was 4508 selected now and last mouse movement event was
4514 not in it. Minibuffer window will be selected 4509 not in it. Minibuffer window will be selected
4515 only when it is active. */ 4510 only when it is active. */
4516 if (WINDOWP (window) 4511 if (WINDOWP (window)
4517 && !EQ (window, last_window) 4512 && !EQ (window, last_mouse_window)
4518 && !EQ (window, selected_window) 4513 && !EQ (window, selected_window)
4519 /* For click-to-focus window managers 4514 /* For click-to-focus window managers
4520 create event iff we don't leave the 4515 create event iff we don't leave the
@@ -4526,8 +4521,8 @@ w32_read_socket (struct terminal *terminal,
4526 inev.kind = SELECT_WINDOW_EVENT; 4521 inev.kind = SELECT_WINDOW_EVENT;
4527 inev.frame_or_window = window; 4522 inev.frame_or_window = window;
4528 } 4523 }
4529 4524 /* Remember the last window where we saw the mouse. */
4530 last_window = window; 4525 last_mouse_window = window;
4531 } 4526 }
4532 if (!note_mouse_movement (f, &msg.msg)) 4527 if (!note_mouse_movement (f, &msg.msg))
4533 help_echo_string = previous_help_echo_string; 4528 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;
140int use_xim = 0; /* configure --without-xim */ 140int use_xim = 0; /* configure --without-xim */
141#endif 141#endif
142 142
143
144
145/* Non-zero means that a HELP_EVENT has been generated since Emacs 143/* Non-zero means that a HELP_EVENT has been generated since Emacs
146 start. */ 144 start. */
147 145
148static bool any_help_event_p; 146static bool any_help_event_p;
149 147
150/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
151static Lisp_Object last_window;
152
153/* This is a chain of structures for all the X displays currently in 148/* This is a chain of structures for all the X displays currently in
154 use. */ 149 use. */
155 150
@@ -6656,18 +6651,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6656 /* Generate SELECT_WINDOW_EVENTs when needed. 6651 /* Generate SELECT_WINDOW_EVENTs when needed.
6657 Don't let popup menus influence things (bug#1261). */ 6652 Don't let popup menus influence things (bug#1261). */
6658 if (!NILP (Vmouse_autoselect_window) && !popup_activated ()) 6653 if (!NILP (Vmouse_autoselect_window) && !popup_activated ())
6659 { 6654 {
6660 Lisp_Object window; 6655 static Lisp_Object last_mouse_window;
6661 6656 Lisp_Object window = window_from_coordinates
6662 window = window_from_coordinates (f, 6657 (f, event.xmotion.x, event.xmotion.y, 0, 0);
6663 event.xmotion.x, event.xmotion.y, 6658
6664 0, 0); 6659 /* Window will be selected only when it is not selected now and
6665 6660 last mouse movement event was not in it. Minibuffer window
6666 /* Window will be selected only when it is not selected now and 6661 will be selected only when it is active. */
6667 last mouse movement event was not in it. Minibuffer window 6662 if (WINDOWP (window)
6668 will be selected only when it is active. */ 6663 && !EQ (window, last_mouse_window)
6669 if (WINDOWP (window)
6670 && !EQ (window, last_window)
6671 && !EQ (window, selected_window) 6664 && !EQ (window, selected_window)
6672 /* For click-to-focus window managers 6665 /* For click-to-focus window managers
6673 create event iff we don't leave the 6666 create event iff we don't leave the
@@ -6675,13 +6668,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6675 && (focus_follows_mouse 6668 && (focus_follows_mouse
6676 || (EQ (XWINDOW (window)->frame, 6669 || (EQ (XWINDOW (window)->frame,
6677 XWINDOW (selected_window)->frame)))) 6670 XWINDOW (selected_window)->frame))))
6678 { 6671 {
6679 inev.ie.kind = SELECT_WINDOW_EVENT; 6672 inev.ie.kind = SELECT_WINDOW_EVENT;
6680 inev.ie.frame_or_window = window; 6673 inev.ie.frame_or_window = window;
6681 } 6674 }
6682 6675 /* Remember the last window where we saw the mouse. */
6683 last_window=window; 6676 last_mouse_window = window;
6684 } 6677 }
6685 if (!note_mouse_movement (f, &event.xmotion)) 6678 if (!note_mouse_movement (f, &event.xmotion))
6686 help_echo_string = previous_help_echo_string; 6679 help_echo_string = previous_help_echo_string;
6687 } 6680 }