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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
This commit is contained in:
Carlos Garnacho 2023-02-01 11:20:22 +01:00
parent 3356823ca2
commit 67a69709b9
3 changed files with 27 additions and 38 deletions

View File

@ -1287,38 +1287,6 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
return meta_x11_display_get_current_time_roundtrip (display->x11_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 static gboolean
window_raise_with_delay_callback (void *data) window_raise_with_delay_callback (void *data)
{ {

View File

@ -168,10 +168,6 @@ META_EXPORT
GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display, GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display,
GSList *windows); GSList *windows);
META_EXPORT
void meta_display_add_ignored_crossing_serial (MetaDisplay *display,
unsigned long serial);
META_EXPORT META_EXPORT
void meta_display_clear_mouse_mode (MetaDisplay *display); void meta_display_clear_mouse_mode (MetaDisplay *display);

View File

@ -2381,6 +2381,31 @@ meta_x11_display_focus_sentinel_clear (MetaX11Display *x11_display)
return (x11_display->sentinel_counter == 0); 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 void
meta_x11_display_set_stage_input_region (MetaX11Display *x11_display, meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
XserverRegion region) XserverRegion region)
@ -2402,7 +2427,7 @@ meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
* focus-follows-mouse focus - it's not the user doing something, it's the * focus-follows-mouse focus - it's not the user doing something, it's the
* environment changing under the user. * environment changing under the user.
*/ */
meta_display_add_ignored_crossing_serial (x11_display->display, meta_x11_display_add_ignored_crossing_serial (x11_display,
XNextRequest (xdisplay)); XNextRequest (xdisplay));
XFixesSetWindowShapeRegion (xdisplay, XFixesSetWindowShapeRegion (xdisplay,
x11_display->composite_overlay_window, x11_display->composite_overlay_window,