[mutter] wayland: Add gtk_surface.present to gtk-shell



commit f6ba3bdfc2e8f1fbb30729e4c730c3f50e445d63
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Mar 8 16:33:27 2016 +0800

    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(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 1a59484..b130ade 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 aa9993d..2e750ea 100644
--- a/src/wayland/protocol/gtk-shell.xml
+++ b/src/wayland/protocol/gtk-shell.xml
@@ -42,6 +42,10 @@
 
     <request name="set_modal"/>
     <request name="unset_modal"/>
+
+    <request name="present">
+      <arg name="time" type="uint"/>
+    </request>
   </interface>
 
 </protocol>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]