From 67a69709b9cad4e5e9aae9d249c5d866b53ada25 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 1 Feb 2023 11:20:22 +0100 Subject: [PATCH] core: Make "adding ignored serials" private API This sounds unnecessary from shell code, and possibly even harmful. Make this API private and move it into the X11 parts where it belongs. Part-of: --- src/core/display.c | 32 -------------------------------- src/meta/display.h | 4 ---- src/x11/meta-x11-display.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index 9be22a4f1..60c3f5fdc 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1287,38 +1287,6 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display) return meta_x11_display_get_current_time_roundtrip (display->x11_display); } -/** - * meta_display_add_ignored_crossing_serial: - * @display: a #MetaDisplay - * @serial: the serial to ignore - * - * Save the specified serial and ignore crossing events with that - * serial for the purpose of focus-follows-mouse. This can be used - * for certain changes to the window hierarchy that we don't want - * to change the focus window, even if they cause the pointer to - * end up in a new window. - */ -void -meta_display_add_ignored_crossing_serial (MetaDisplay *display, - unsigned long serial) -{ - int i; - - /* don't add the same serial more than once */ - if (display->ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS-1] == serial) - return; - - /* shift serials to the left */ - i = 0; - while (i < (N_IGNORED_CROSSING_SERIALS - 1)) - { - display->ignored_crossing_serials[i] = display->ignored_crossing_serials[i+1]; - ++i; - } - /* put new one on the end */ - display->ignored_crossing_serials[i] = serial; -} - static gboolean window_raise_with_delay_callback (void *data) { diff --git a/src/meta/display.h b/src/meta/display.h index 510d802e2..78048e5e2 100644 --- a/src/meta/display.h +++ b/src/meta/display.h @@ -168,10 +168,6 @@ META_EXPORT GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display, GSList *windows); -META_EXPORT -void meta_display_add_ignored_crossing_serial (MetaDisplay *display, - unsigned long serial); - META_EXPORT void meta_display_clear_mouse_mode (MetaDisplay *display); diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index 222500c84..af26ff1b8 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -2381,6 +2381,31 @@ meta_x11_display_focus_sentinel_clear (MetaX11Display *x11_display) return (x11_display->sentinel_counter == 0); } + +static void +meta_x11_display_add_ignored_crossing_serial (MetaX11Display *x11_display, + unsigned long serial) +{ + MetaDisplay *display = x11_display->display; + int i; + + /* don't add the same serial more than once */ + if (serial == + display->ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS - 1]) + return; + + /* shift serials to the left */ + i = 0; + while (i < (N_IGNORED_CROSSING_SERIALS - 1)) + { + display->ignored_crossing_serials[i] = + display->ignored_crossing_serials[i + 1]; + ++i; + } + /* put new one on the end */ + display->ignored_crossing_serials[i] = serial; +} + void meta_x11_display_set_stage_input_region (MetaX11Display *x11_display, XserverRegion region) @@ -2402,8 +2427,8 @@ meta_x11_display_set_stage_input_region (MetaX11Display *x11_display, * focus-follows-mouse focus - it's not the user doing something, it's the * environment changing under the user. */ - meta_display_add_ignored_crossing_serial (x11_display->display, - XNextRequest (xdisplay)); + meta_x11_display_add_ignored_crossing_serial (x11_display, + XNextRequest (xdisplay)); XFixesSetWindowShapeRegion (xdisplay, x11_display->composite_overlay_window, ShapeInput, 0, 0, region);