From f6ba3bdfc2e8f1fbb30729e4c730c3f50e445d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 8 Mar 2016 16:33:27 +0800 Subject: [PATCH] wayland: Add gtk_surface.present to gtk-shell This commits adds a gtk_surface.present request and its implementation. The timestamp is assumed to be from some input event that the client responded to. The timestamps we deal with when managing windows will usually come from two different clocks: CLOCK_MONOTONIC if they come from libinput/evdev, or CLOCK_MONOTONIC_COARSE if they come from the X server. Luckily these are quite similar, the difference beeing that the X server timestamps having lower resolution, so we can just pass the timestamps no matter where they came from and it'll most likely work fine, except for the race condition described in bug 756272 which might happen here too until it is properly fixed. https://bugzilla.gnome.org/show_bug.cgi?id=763295 --- src/wayland/meta-wayland-surface.c | 16 ++++++++++++++++ src/wayland/protocol/gtk-shell.xml | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 1a5948401..b130ade61 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -2017,10 +2017,26 @@ gtk_surface_unset_modal (struct wl_client *client, meta_window_set_type (surface->window, META_WINDOW_NORMAL); } +static void +gtk_surface_present (struct wl_client *client, + struct wl_resource *resource, + uint32_t timestamp) +{ + MetaWaylandSurface *surface = wl_resource_get_user_data (resource); + MetaWindow *window = surface->window; + + if (!window) + return; + + meta_window_activate_full (window, timestamp, + META_CLIENT_TYPE_APPLICATION, NULL); +} + static const struct gtk_surface1_interface meta_wayland_gtk_surface_interface = { gtk_surface_set_dbus_properties, gtk_surface_set_modal, gtk_surface_unset_modal, + gtk_surface_present, }; static void diff --git a/src/wayland/protocol/gtk-shell.xml b/src/wayland/protocol/gtk-shell.xml index aa9993d66..2e750ea0f 100644 --- a/src/wayland/protocol/gtk-shell.xml +++ b/src/wayland/protocol/gtk-shell.xml @@ -42,6 +42,10 @@ + + + +