Revert "window: Make meta_window_has_pointer() per protocol implemented"
Windows from Xwayland still needs to use the Wayland path, but is
represented an MetaWindowX11, thus the abstraction introduced in
"window: Make meta_window_has_pointer() per protocol implemented"
is wrong. Lets turn back time, and reconsider how this can be
abstracted more correctly in the future.
This reverts commit 9fb891d216
.
This commit is contained in:
parent
b6e13c459a
commit
8942e98e1d
4 changed files with 43 additions and 43 deletions
|
@ -527,7 +527,6 @@ struct _MetaWindowClass
|
|||
void (*update_main_monitor) (MetaWindow *window);
|
||||
void (*main_monitor_changed) (MetaWindow *window,
|
||||
const MetaMonitorInfo *old);
|
||||
gboolean (*has_pointer) (MetaWindow *window);
|
||||
};
|
||||
|
||||
/* These differ from window->has_foo_func in that they consider
|
||||
|
|
|
@ -7534,10 +7534,52 @@ mouse_mode_focus (MetaWindow *window,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_has_pointer_wayland (MetaWindow *window)
|
||||
{
|
||||
ClutterDeviceManager *dm;
|
||||
ClutterInputDevice *dev;
|
||||
ClutterActor *pointer_actor, *window_actor;
|
||||
|
||||
dm = clutter_device_manager_get_default ();
|
||||
dev = clutter_device_manager_get_core_device (dm, CLUTTER_POINTER_DEVICE);
|
||||
pointer_actor = clutter_input_device_get_pointer_actor (dev);
|
||||
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
|
||||
|
||||
return pointer_actor && clutter_actor_contains (window_actor, pointer_actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_has_pointer_x11 (MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = window->display;
|
||||
MetaScreen *screen = window->screen;
|
||||
Window root, child;
|
||||
double root_x, root_y, x, y;
|
||||
XIButtonState buttons;
|
||||
XIModifierState mods;
|
||||
XIGroupState group;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
XIQueryPointer (display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
screen->xroot,
|
||||
&root, &child,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods, &group);
|
||||
meta_error_trap_pop (display);
|
||||
free (buttons.mask);
|
||||
|
||||
return meta_display_lookup_x_window (display, child) == window;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_has_pointer (MetaWindow *window)
|
||||
{
|
||||
return META_WINDOW_GET_CLASS (window)->has_pointer (window);
|
||||
if (meta_is_wayland_compositor ())
|
||||
return window_has_pointer_wayland (window);
|
||||
else
|
||||
return window_has_pointer_x11 (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -432,21 +432,6 @@ meta_window_wayland_main_monitor_changed (MetaWindow *window,
|
|||
meta_window_emit_size_changed (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_window_wayland_has_pointer (MetaWindow *window)
|
||||
{
|
||||
ClutterDeviceManager *dm;
|
||||
ClutterInputDevice *dev;
|
||||
ClutterActor *pointer_actor, *window_actor;
|
||||
|
||||
dm = clutter_device_manager_get_default ();
|
||||
dev = clutter_device_manager_get_core_device (dm, CLUTTER_POINTER_DEVICE);
|
||||
pointer_actor = clutter_input_device_get_pointer_actor (dev);
|
||||
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
|
||||
|
||||
return pointer_actor && clutter_actor_contains (window_actor, pointer_actor);
|
||||
}
|
||||
|
||||
static void
|
||||
appears_focused_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
|
@ -481,7 +466,6 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
|
|||
window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
|
||||
window_class->update_main_monitor = meta_window_wayland_update_main_monitor;
|
||||
window_class->main_monitor_changed = meta_window_wayland_main_monitor_changed;
|
||||
window_class->has_pointer = meta_window_wayland_has_pointer;
|
||||
}
|
||||
|
||||
MetaWindow *
|
||||
|
|
|
@ -1481,30 +1481,6 @@ meta_window_x11_main_monitor_changed (MetaWindow *window,
|
|||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_window_x11_has_pointer (MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = window->display;
|
||||
MetaScreen *screen = window->screen;
|
||||
Window root, child;
|
||||
double root_x, root_y, x, y;
|
||||
XIButtonState buttons;
|
||||
XIModifierState mods;
|
||||
XIGroupState group;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
XIQueryPointer (display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
screen->xroot,
|
||||
&root, &child,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods, &group);
|
||||
meta_error_trap_pop (display);
|
||||
free (buttons.mask);
|
||||
|
||||
return meta_display_lookup_x_window (display, child) == window;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_x11_class_init (MetaWindowX11Class *klass)
|
||||
{
|
||||
|
@ -1525,7 +1501,6 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
|
|||
window_class->update_icon = meta_window_x11_update_icon;
|
||||
window_class->update_main_monitor = meta_window_x11_update_main_monitor;
|
||||
window_class->main_monitor_changed = meta_window_x11_main_monitor_changed;
|
||||
window_class->has_pointer = meta_window_x11_has_pointer;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue