window: Move has_pointer_x11 to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
This commit is contained in:
parent
19a36b8879
commit
0236506cff
@ -90,6 +90,10 @@
|
||||
#include "x11/window-x11.h"
|
||||
#include "x11/xprops.h"
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
#include "x11/window-x11-private.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
#include "wayland/meta-wayland-surface-private.h"
|
||||
@ -7314,36 +7318,17 @@ window_has_pointer_wayland (MetaWindow *window)
|
||||
return pointer_actor && clutter_actor_contains (window_actor, pointer_actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_has_pointer_x11 (MetaWindow *window)
|
||||
{
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
Window root, child;
|
||||
double root_x, root_y, x, y;
|
||||
XIButtonState buttons;
|
||||
XIModifierState mods;
|
||||
XIGroupState group;
|
||||
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
XIQueryPointer (x11_display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
x11_display->xroot,
|
||||
&root, &child,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods, &group);
|
||||
meta_x11_error_trap_pop (x11_display);
|
||||
free (buttons.mask);
|
||||
|
||||
return meta_x11_display_lookup_x_window (x11_display, child) == window;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_has_pointer (MetaWindow *window)
|
||||
{
|
||||
if (meta_is_wayland_compositor ())
|
||||
return window_has_pointer_wayland (window);
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
else
|
||||
return window_has_pointer_x11 (window);
|
||||
return meta_window_x11_has_pointer (window);
|
||||
#else
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -100,4 +100,6 @@ Window meta_window_x11_get_user_time_window (MetaWindow *window);
|
||||
|
||||
Window meta_window_x11_get_xtransient_for (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_x11_has_pointer (MetaWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -4463,3 +4463,26 @@ meta_window_x11_get_xtransient_for (MetaWindow *window)
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_x11_has_pointer (MetaWindow *window)
|
||||
{
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
Window root, child;
|
||||
double root_x, root_y, x, y;
|
||||
XIButtonState buttons;
|
||||
XIModifierState mods;
|
||||
XIGroupState group;
|
||||
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
XIQueryPointer (x11_display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
x11_display->xroot,
|
||||
&root, &child,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods, &group);
|
||||
meta_x11_error_trap_pop (x11_display);
|
||||
free (buttons.mask);
|
||||
|
||||
return meta_x11_display_lookup_x_window (x11_display, child) == window;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user