diff --git a/src/compositor/meta-compositor-server.c b/src/compositor/meta-compositor-server.c index 2a113c1ca..ce0ac6880 100644 --- a/src/compositor/meta-compositor-server.c +++ b/src/compositor/meta-compositor-server.c @@ -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 *