[gtk+/gtk-3-22] wayland: apply empty input shape on parent commit



commit 78f8f236e9d084411d77280643bdc16d386dc382
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Nov 16 15:05:43 2016 +0100

    wayland: apply empty input shape on parent commit
    
    For subsurfaces, the new state which includes the input shape is not
    applied by the compositor if the subsurface is in effective synchronous
    mode.
    
    So we need to apply the input shape once parent surface is in effective
    desynchronized mode, which is when it's committed, otherwise the input
    shape may never be applied if the widget is not using being_paint() /
    end_paint() to draw on its subsurface, like clutter does.
    
    We do that only for empty input shape as those won't need update when
    the subsurface is resized, for all other non-empty input shape, the
    client still has to use begin_paint()/end_paint() for the input shape to
    be applied.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774534

 gdk/wayland/gdkwindow-wayland.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index ce09b09..0314117 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1207,6 +1207,31 @@ gdk_wayland_window_sync_input_region (GdkWindow *window)
 }
 
 static void
+gdk_wayland_set_input_region_if_empty (GdkWindow *window)
+{
+  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+  GdkWaylandDisplay *display;
+  struct wl_region *empty;
+
+  if (!impl->input_region_dirty)
+    return;
+
+  if (impl->input_region == NULL)
+    return;
+
+  if (!cairo_region_is_empty (impl->input_region))
+    return;
+
+  display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
+  empty = wl_compositor_create_region (display->compositor);
+
+  wl_surface_set_input_region (impl->display_server.wl_surface, empty);
+  wl_region_destroy (empty);
+
+  impl->input_region_dirty = FALSE;
+}
+
+static void
 surface_enter (void              *data,
                struct wl_surface *wl_surface,
                struct wl_output  *output)
@@ -1255,6 +1280,9 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
   impl->parent_surface_committed_handler = 0;
 
   wl_subsurface_set_desync (impl->display_server.wl_subsurface);
+
+  /* Special case if the input region is empty, it won't change on resize */
+  gdk_wayland_set_input_region_if_empty (window);
 }
 
 static void


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