1
0
Fork 0

wayland: Avoid MetaWaylandKeyboard struct access

Use the MetaWaylandSeat focus, instead of peeking at MetaWaylandKeyboard
internals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
This commit is contained in:
Carlos Garnacho 2024-02-27 12:45:55 +01:00 committed by Marge Bot
parent 81df305645
commit 017eff6663

View file

@ -905,34 +905,31 @@ void
meta_wayland_compositor_restore_shortcuts (MetaWaylandCompositor *compositor, meta_wayland_compositor_restore_shortcuts (MetaWaylandCompositor *compositor,
ClutterInputDevice *source) ClutterInputDevice *source)
{ {
MetaWaylandKeyboard *keyboard; MetaWaylandSurface *focus;
/* Clutter is not multi-seat aware yet, use the default seat instead */ /* Clutter is not multi-seat aware yet, use the default seat instead */
keyboard = compositor->seat->keyboard; focus = meta_wayland_seat_get_input_focus (compositor->seat);
if (!keyboard || !keyboard->focus_surface) if (!focus)
return; return;
if (!meta_wayland_surface_is_shortcuts_inhibited (keyboard->focus_surface, if (!meta_wayland_surface_is_shortcuts_inhibited (focus, compositor->seat))
compositor->seat))
return; return;
meta_wayland_surface_restore_shortcuts (keyboard->focus_surface, meta_wayland_surface_restore_shortcuts (focus, compositor->seat);
compositor->seat);
} }
gboolean gboolean
meta_wayland_compositor_is_shortcuts_inhibited (MetaWaylandCompositor *compositor, meta_wayland_compositor_is_shortcuts_inhibited (MetaWaylandCompositor *compositor,
ClutterInputDevice *source) ClutterInputDevice *source)
{ {
MetaWaylandKeyboard *keyboard; MetaWaylandSurface *focus;
/* Clutter is not multi-seat aware yet, use the default seat instead */ /* Clutter is not multi-seat aware yet, use the default seat instead */
keyboard = compositor->seat->keyboard; focus = meta_wayland_seat_get_input_focus (compositor->seat);
if (keyboard && keyboard->focus_surface != NULL) if (!focus)
return meta_wayland_surface_is_shortcuts_inhibited (keyboard->focus_surface, return FALSE;
compositor->seat);
return FALSE; return meta_wayland_surface_is_shortcuts_inhibited (focus, compositor->seat);
} }
void void