aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-04-19 18:51:28 +0800
committerPo Lu2022-04-19 18:51:45 +0800
commit5fe75feafc706b16af2f1e47a77c8fe46efd348c (patch)
tree1b313f38bd8d8be0c5b45de9d2a564657fe89241 /src
parent237f4f9295d17d15c58ffce9728b72aa1e529172 (diff)
downloademacs-5fe75feafc706b16af2f1e47a77c8fe46efd348c.tar.gz
emacs-5fe75feafc706b16af2f1e47a77c8fe46efd348c.zip
Fix `x-mouse-click-focus-ignore-position' for odd coincidences across displays
* src/xterm.c (handle_one_xevent): Save the display alongside the next mouse click timeout. (x_delete_display): Clear that display here if applicable. (x_initialize): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 3eecd5e204b..03d5a503f8a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -756,6 +756,10 @@ static bool toolkit_scroll_bar_interaction;
756 756
757static Time ignore_next_mouse_click_timeout; 757static Time ignore_next_mouse_click_timeout;
758 758
759/* The display that ignore_next_mouse_click_timeout applies to. */
760
761static struct x_display_info *mouse_click_timeout_display;
762
759/* Used locally within XTread_socket. */ 763/* Used locally within XTread_socket. */
760 764
761static int x_noop_count; 765static int x_noop_count;
@@ -15169,7 +15173,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
15169 f = any; 15173 f = any;
15170 15174
15171 if (f && x_mouse_click_focus_ignore_position) 15175 if (f && x_mouse_click_focus_ignore_position)
15172 ignore_next_mouse_click_timeout = event->xmotion.time + 200; 15176 {
15177 ignore_next_mouse_click_timeout = event->xmotion.time + 200;
15178 mouse_click_timeout_display = dpyinfo;
15179 }
15173 15180
15174 /* EnterNotify counts as mouse movement, 15181 /* EnterNotify counts as mouse movement,
15175 so update things that depend on mouse position. */ 15182 so update things that depend on mouse position. */
@@ -16046,7 +16053,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
16046 && event->xbutton.button < 9 16053 && event->xbutton.button < 9
16047 && f) 16054 && f)
16048 { 16055 {
16049 if (ignore_next_mouse_click_timeout) 16056 if (ignore_next_mouse_click_timeout
16057 && dpyinfo == mouse_click_timeout_display)
16050 { 16058 {
16051 if (event->type == ButtonPress 16059 if (event->type == ButtonPress
16052 && event->xbutton.time > ignore_next_mouse_click_timeout) 16060 && event->xbutton.time > ignore_next_mouse_click_timeout)
@@ -16115,7 +16123,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
16115 if (! popup_activated ()) 16123 if (! popup_activated ())
16116#endif 16124#endif
16117 { 16125 {
16118 if (ignore_next_mouse_click_timeout) 16126 if (ignore_next_mouse_click_timeout
16127 && dpyinfo == mouse_click_timeout_display)
16119 { 16128 {
16120 if (event->type == ButtonPress 16129 if (event->type == ButtonPress
16121 && event->xbutton.time > ignore_next_mouse_click_timeout) 16130 && event->xbutton.time > ignore_next_mouse_click_timeout)
@@ -16412,7 +16421,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
16412 f = any; 16421 f = any;
16413 16422
16414 if (f && x_mouse_click_focus_ignore_position) 16423 if (f && x_mouse_click_focus_ignore_position)
16415 ignore_next_mouse_click_timeout = xi_event->time + 200; 16424 {
16425 ignore_next_mouse_click_timeout = xev->time + 200;
16426 mouse_click_timeout_display = dpyinfo;
16427 }
16416 16428
16417 /* EnterNotify counts as mouse movement, 16429 /* EnterNotify counts as mouse movement,
16418 so update things that depend on mouse position. */ 16430 so update things that depend on mouse position. */
@@ -23578,6 +23590,9 @@ x_delete_display (struct x_display_info *dpyinfo)
23578 if (next_noop_dpyinfo == dpyinfo) 23590 if (next_noop_dpyinfo == dpyinfo)
23579 next_noop_dpyinfo = dpyinfo->next; 23591 next_noop_dpyinfo = dpyinfo->next;
23580 23592
23593 if (mouse_click_timeout_display == dpyinfo)
23594 mouse_click_timeout_display = NULL;
23595
23581 if (x_display_list == dpyinfo) 23596 if (x_display_list == dpyinfo)
23582 x_display_list = dpyinfo->next; 23597 x_display_list = dpyinfo->next;
23583 else 23598 else
@@ -23865,6 +23880,7 @@ x_initialize (void)
23865 x_noop_count = 0; 23880 x_noop_count = 0;
23866 any_help_event_p = false; 23881 any_help_event_p = false;
23867 ignore_next_mouse_click_timeout = 0; 23882 ignore_next_mouse_click_timeout = 0;
23883 mouse_click_timeout_display = NULL;
23868 23884
23869#ifdef USE_GTK 23885#ifdef USE_GTK
23870 current_count = -1; 23886 current_count = -1;