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
This commit is contained in:
Jonas Ådahl 2016-03-08 16:33:27 +08:00
parent 99bba9e56c
commit f6ba3bdfc2
2 changed files with 20 additions and 0 deletions

View File

@ -2017,10 +2017,26 @@ gtk_surface_unset_modal (struct wl_client *client,
meta_window_set_type (surface->window, META_WINDOW_NORMAL); 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 = { static const struct gtk_surface1_interface meta_wayland_gtk_surface_interface = {
gtk_surface_set_dbus_properties, gtk_surface_set_dbus_properties,
gtk_surface_set_modal, gtk_surface_set_modal,
gtk_surface_unset_modal, gtk_surface_unset_modal,
gtk_surface_present,
}; };
static void static void

View File

@ -42,6 +42,10 @@
<request name="set_modal"/> <request name="set_modal"/>
<request name="unset_modal"/> <request name="unset_modal"/>
<request name="present">
<arg name="time" type="uint"/>
</request>
</interface> </interface>
</protocol> </protocol>