1
0
Fork 0

compositor: Use MetaWaylandCompositor API to drive focus synchronization

Use Wayland API directly here, and avoid using MetaDisplay API that will
go away.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
This commit is contained in:
Carlos Garnacho 2023-11-02 14:30:02 +01:00 committed by Marge Bot
parent a2d2e04d80
commit 38421b07c7

View file

@ -22,6 +22,8 @@
#include "compositor/meta-compositor-server.h"
#include "compositor/meta-compositor-view.h"
#include "core/display-private.h"
#include "meta/meta-wayland-compositor.h"
#include "wayland/meta-wayland.h"
G_DEFINE_TYPE (MetaCompositorServer, meta_compositor_server, META_TYPE_COMPOSITOR)
@ -39,13 +41,28 @@ meta_compositor_server_monotonic_to_high_res_xserver_time (MetaCompositor *compo
return meta_translate_to_high_res_xserver_time (monotonic_time_us);
}
#ifdef HAVE_WAYLAND
static MetaWaylandCompositor *
wayland_compositor_from_display (MetaDisplay *display)
{
MetaContext *context = meta_display_get_context (display);
return meta_context_get_wayland_compositor (context);
}
#endif
static void
meta_compositor_server_grab_begin (MetaCompositor *compositor)
{
MetaDisplay *display;
MetaDisplay *display = meta_compositor_get_display (compositor);
#ifdef HAVE_WAYLAND
MetaWaylandCompositor *wayland_compositor =
wayland_compositor_from_display (display);
#endif
display = meta_compositor_get_display (compositor);
meta_display_sync_wayland_input_focus (display);
#ifdef HAVE_WAYLAND
meta_wayland_compositor_sync_focus (wayland_compositor);
#endif
meta_display_cancel_touch (display);
#ifdef HAVE_WAYLAND
@ -56,13 +73,14 @@ meta_compositor_server_grab_begin (MetaCompositor *compositor)
static void
meta_compositor_server_grab_end (MetaCompositor *compositor)
{
MetaDisplay *display;
display = meta_compositor_get_display (compositor);
#ifdef HAVE_WAYLAND
MetaDisplay *display = meta_compositor_get_display (compositor);;
MetaWaylandCompositor *wayland_compositor =
wayland_compositor_from_display (display);
meta_dnd_wayland_handle_end_modal (compositor);
meta_wayland_compositor_sync_focus (wayland_compositor);
#endif
meta_display_sync_wayland_input_focus (display);
}
static MetaCompositorView *