mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
wayland: Use MetaWaylandCompositor API to drive focus synchronization
Keep this within the wayland code itself, and avoid poking MetaDisplay API that will go away. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
This commit is contained in:
parent
9383171958
commit
a2d2e04d80
@ -406,11 +406,12 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
|
|||||||
*/
|
*/
|
||||||
if (drag_grab->generic.pointer->grab == (MetaWaylandPointerGrab *) drag_grab)
|
if (drag_grab->generic.pointer->grab == (MetaWaylandPointerGrab *) drag_grab)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = display_from_data_device (data_device);
|
MetaWaylandCompositor *wayland_compositor =
|
||||||
|
meta_wayland_seat_get_compositor (data_device->seat);
|
||||||
|
|
||||||
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
|
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
|
||||||
meta_wayland_keyboard_end_grab (drag_grab->keyboard_grab.keyboard);
|
meta_wayland_keyboard_end_grab (drag_grab->keyboard_grab.keyboard);
|
||||||
meta_display_sync_wayland_input_focus (display);
|
meta_wayland_compositor_sync_focus (wayland_compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (drag_grab);
|
g_free (drag_grab);
|
||||||
|
@ -158,15 +158,10 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
MetaWaylandCompositor *compositor =
|
MetaWaylandCompositor *compositor =
|
||||||
meta_wayland_seat_get_compositor (seat);
|
meta_wayland_seat_get_compositor (seat);
|
||||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
|
||||||
MetaDisplay *display;
|
|
||||||
|
|
||||||
meta_wayland_keyboard_enable (seat->keyboard);
|
meta_wayland_keyboard_enable (seat->keyboard);
|
||||||
|
|
||||||
/* Post-initialization, ensure the input focus is in sync */
|
meta_wayland_compositor_sync_focus (compositor);
|
||||||
display = meta_context_get_display (context);
|
|
||||||
if (display)
|
|
||||||
meta_display_sync_wayland_input_focus (display);
|
|
||||||
}
|
}
|
||||||
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_KEYBOARD))
|
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_KEYBOARD))
|
||||||
meta_wayland_keyboard_disable (seat->keyboard);
|
meta_wayland_keyboard_disable (seat->keyboard);
|
||||||
|
@ -592,11 +592,15 @@ xdg_popup_destructor (struct wl_resource *resource)
|
|||||||
META_WAYLAND_SURFACE_ROLE (xdg_popup);
|
META_WAYLAND_SURFACE_ROLE (xdg_popup);
|
||||||
MetaWaylandSurface *surface =
|
MetaWaylandSurface *surface =
|
||||||
meta_wayland_surface_role_get_surface (surface_role);
|
meta_wayland_surface_role_get_surface (surface_role);
|
||||||
|
MetaDisplay *display = display_from_surface (surface);
|
||||||
|
MetaContext *context = meta_display_get_context (display);
|
||||||
|
MetaWaylandCompositor *wayland_compositor =
|
||||||
|
meta_context_get_wayland_compositor (context);
|
||||||
|
|
||||||
dismiss_popup (xdg_popup);
|
dismiss_popup (xdg_popup);
|
||||||
xdg_popup->resource = NULL;
|
xdg_popup->resource = NULL;
|
||||||
|
|
||||||
meta_display_sync_wayland_input_focus (display_from_surface (surface));
|
meta_wayland_compositor_sync_focus (wayland_compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -88,12 +88,10 @@ meta_xwayland_keyboard_grab_end (MetaXwaylandKeyboardActiveGrab *active_grab)
|
|||||||
{
|
{
|
||||||
MetaWaylandCompositor *compositor =
|
MetaWaylandCompositor *compositor =
|
||||||
meta_wayland_seat_get_compositor (active_grab->seat);
|
meta_wayland_seat_get_compositor (active_grab->seat);
|
||||||
MetaContext *context = meta_wayland_compositor_get_context (compositor);
|
|
||||||
MetaDisplay *display = meta_context_get_display (context);
|
|
||||||
|
|
||||||
meta_wayland_keyboard_end_grab (active_grab->keyboard_grab.keyboard);
|
meta_wayland_keyboard_end_grab (active_grab->keyboard_grab.keyboard);
|
||||||
meta_wayland_keyboard_set_focus (active_grab->keyboard_grab.keyboard, NULL);
|
meta_wayland_keyboard_set_focus (active_grab->keyboard_grab.keyboard, NULL);
|
||||||
meta_display_sync_wayland_input_focus (display);
|
meta_wayland_compositor_sync_focus (compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!active_grab->surface)
|
if (!active_grab->surface)
|
||||||
|
@ -87,6 +87,9 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
MetaDisplay *display = window->display;
|
MetaDisplay *display = window->display;
|
||||||
MetaXwaylandSurface *xwayland_surface;
|
MetaXwaylandSurface *xwayland_surface;
|
||||||
|
MetaContext *context = meta_display_get_context (display);
|
||||||
|
MetaWaylandCompositor *wayland_compositor =
|
||||||
|
meta_context_get_wayland_compositor (context);
|
||||||
|
|
||||||
if (!meta_wayland_surface_assign_role (surface,
|
if (!meta_wayland_surface_assign_role (surface,
|
||||||
META_TYPE_XWAYLAND_SURFACE,
|
META_TYPE_XWAYLAND_SURFACE,
|
||||||
@ -103,7 +106,7 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window,
|
|||||||
meta_xwayland_surface_associate_with_window (xwayland_surface, window);
|
meta_xwayland_surface_associate_with_window (xwayland_surface, window);
|
||||||
|
|
||||||
/* Now that we have a surface check if it should have focus. */
|
/* Now that we have a surface check if it should have focus. */
|
||||||
meta_display_sync_wayland_input_focus (display);
|
meta_wayland_compositor_sync_focus (wayland_compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user