[gtk/present-toplevel-2: 22/83] surface: Rename gdk_surface_input_shape_combine_region



commit b2ae6ce8ffe204969f48aef15fd2bc117c28163d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 1 11:29:06 2020 -0800

    surface: Rename gdk_surface_input_shape_combine_region
    
    There is no shape combining going on anymore, so
    call this just gdk_surface_set_input_region, and
    remove the offset arguments too. All callers pass
    0 anyway.
    
    Update all callers and implementations.

 gdk/broadway/gdksurface-broadway.c |  8 +++-----
 gdk/gdksurface.c                   | 31 ++++++++++++-------------------
 gdk/gdksurface.h                   |  6 ++----
 gdk/gdksurfaceprivate.h            |  8 +++-----
 gdk/wayland/gdksurface-wayland.c   | 15 +++++----------
 gdk/win32/gdksurface-win32.c       |  8 +++-----
 gdk/x11/gdksurface-x11.c           | 15 ++++++---------
 gtk/gtkpopover.c                   |  4 ++--
 gtk/gtkwindow.c                    |  2 +-
 9 files changed, 37 insertions(+), 60 deletions(-)
---
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 90efc414ef..644014262c 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -689,10 +689,8 @@ gdk_broadway_surface_get_device_state (GdkSurface      *surface,
 }
 
 static void
-gdk_broadway_surface_input_shape_combine_region (GdkSurface       *surface,
-                                                 const cairo_region_t *shape_region,
-                                                 gint             offset_x,
-                                                 gint             offset_y)
+gdk_broadway_surface_set_input_region (GdkSurface     *surface,
+                                       cairo_region_t *shape_region)
 {
 }
 
@@ -1410,7 +1408,7 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
   impl_class->get_geometry = gdk_broadway_surface_get_geometry;
   impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
   impl_class->get_device_state = gdk_broadway_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_broadway_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_broadway_surface_set_input_region;
   impl_class->destroy = _gdk_broadway_surface_destroy;
   impl_class->beep = gdk_broadway_surface_beep;
 
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 188c8dc230..70a62487d2 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -582,8 +582,8 @@ gdk_surface_finalize (GObject *object)
       _gdk_surface_destroy (surface, FALSE);
     }
 
-  if (surface->input_shape)
-    cairo_region_destroy (surface->input_shape);
+  if (surface->input_region)
+    cairo_region_destroy (surface->input_region);
 
   if (surface->cursor)
     g_object_unref (surface->cursor);
@@ -2372,11 +2372,9 @@ gdk_surface_get_root_coords (GdkSurface *surface,
 }
 
 /**
- * gdk_surface_input_shape_combine_region:
+ * gdk_surface_set_input_region:
  * @surface: a #GdkSurface
- * @shape_region: region of surface to be non-transparent
- * @offset_x: X position of @shape_region in @surface coordinates
- * @offset_y: Y position of @shape_region in @surface coordinates
+ * @region: region of surface to be reactive
  *
  * Apply the region to the surface for the purpose of event
  * handling. Mouse events which happen while the pointer position
@@ -2396,28 +2394,23 @@ gdk_surface_get_root_coords (GdkSurface *surface,
  * function does nothing.
  */
 void
-gdk_surface_input_shape_combine_region (GdkSurface       *surface,
-                                        const cairo_region_t *shape_region,
-                                        gint             offset_x,
-                                        gint             offset_y)
+gdk_surface_set_input_region (GdkSurface     *surface,
+                              cairo_region_t *region)
 {
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface))
     return;
 
-  if (surface->input_shape)
-    cairo_region_destroy (surface->input_shape);
+  if (surface->input_region)
+    cairo_region_destroy (surface->input_region);
 
-  if (shape_region)
-    {
-      surface->input_shape = cairo_region_copy (shape_region);
-      cairo_region_translate (surface->input_shape, offset_x, offset_y);
-    }
+  if (region)
+    surface->input_region = cairo_region_copy (region);
   else
-    surface->input_shape = NULL;
+    surface->input_region = NULL;
 
-  GDK_SURFACE_GET_CLASS (surface)->input_shape_combine_region (surface, surface->input_shape, 0, 0);
+  GDK_SURFACE_GET_CLASS (surface)->set_input_region (surface, surface->input_region);
 }
 
 /**
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index bc0753c5b9..bec64d2df7 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -386,10 +386,8 @@ void          gdk_surface_set_focus_on_map      (GdkSurface     *surface,
                                                  gboolean       focus_on_map);
 
 GDK_AVAILABLE_IN_ALL
-void gdk_surface_input_shape_combine_region (GdkSurface       *surface,
-                                             const cairo_region_t *shape_region,
-                                             gint             offset_x,
-                                             gint             offset_y);
+void          gdk_surface_set_input_region      (GdkSurface     *surface,
+                                                 cairo_region_t *region);
 
 GDK_AVAILABLE_IN_ALL
 gboolean gdk_surface_is_viewable    (GdkSurface *surface);
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index e1e1f3687c..583a9bd12c 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -89,7 +89,7 @@ struct _GdkSurface
   GdkCursor *cursor;
   GHashTable *device_cursor;
 
-  cairo_region_t *input_shape;
+  cairo_region_t *input_region;
 
   GList *devices_inside;
 
@@ -142,10 +142,8 @@ struct _GdkSurfaceClass
                                          gdouble         *y,
                                          GdkModifierType *mask);
 
-  void         (* input_shape_combine_region) (GdkSurface       *surface,
-                                               const cairo_region_t *shape_region,
-                                               gint             offset_x,
-                                               gint             offset_y);
+  void         (* set_input_region)     (GdkSurface      *surface,
+                                         cairo_region_t  *shape_region);
 
 /* Called to do the windowing system specific part of gdk_surface_destroy(),
  *
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index e84bd37960..de29755357 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -2935,10 +2935,8 @@ gdk_wayland_surface_get_device_state (GdkSurface       *surface,
 }
 
 static void
-gdk_wayland_surface_input_shape_combine_region (GdkSurface           *surface,
-                                                const cairo_region_t *shape_region,
-                                                gint                  offset_x,
-                                                gint                  offset_y)
+gdk_wayland_surface_set_input_region (GdkSurface     *surface,
+                                      cairo_region_t *input_region)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
@@ -2947,11 +2945,8 @@ gdk_wayland_surface_input_shape_combine_region (GdkSurface           *surface,
 
   g_clear_pointer (&impl->input_region, cairo_region_destroy);
 
-  if (shape_region)
-    {
-      impl->input_region = cairo_region_copy (shape_region);
-      cairo_region_translate (impl->input_region, offset_x, offset_y);
-    }
+  if (input_region)
+    impl->input_region = cairo_region_copy (input_region);
 
   impl->input_region_dirty = TRUE;
 }
@@ -3909,7 +3904,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->get_geometry = gdk_wayland_surface_get_geometry;
   impl_class->get_root_coords = gdk_wayland_surface_get_root_coords;
   impl_class->get_device_state = gdk_wayland_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_wayland_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_wayland_surface_set_input_region;
   impl_class->destroy = gdk_wayland_surface_destroy;
   impl_class->beep = gdk_wayland_surface_beep;
 
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 8e877ed3d7..75d4b68593 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -5166,10 +5166,8 @@ _gdk_win32_surface_get_unscaled_size (GdkSurface *window,
 }
 
 static void
-gdk_win32_input_shape_combine_region (GdkSurface            *window,
-                                      const cairo_region_t *shape_region,
-                                      gint                  offset_x,
-                                      gint                  offset_y)
+gdk_win32_surface_set_input_region (GdkSurface     *window,
+                                    cairo_region_t *input_region)
 {
   /* Partial input shape support is implemented by handling the
    * NC_NCHITTEST message
@@ -5199,7 +5197,7 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->get_device_state = gdk_surface_win32_get_device_state;
   impl_class->get_root_coords = gdk_win32_surface_get_root_coords;
 
-  impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
+  impl_class->set_input_region = gdk_win32_surface_set_input_region;
   impl_class->destroy = gdk_win32_surface_destroy;
 
   //impl_class->beep = gdk_x11_surface_beep;
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 411f0b5a6e..53a91af8a0 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -2617,10 +2617,8 @@ gdk_x11_surface_get_device_state (GdkSurface       *surface,
 }
 
 static void 
-gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
-                                           const cairo_region_t *shape_region,
-                                           gint                  offset_x,
-                                           gint                  offset_y)
+gdk_x11_surface_set_input_region (GdkSurface     *surface,
+                                  cairo_region_t *input_region)
 {
 #ifdef ShapeInput
   GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@@ -2631,7 +2629,7 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
   if (!gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface)))
     return;
 
-  if (shape_region == NULL)
+  if (input_region == NULL)
     {
       XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface),
                          GDK_SURFACE_XID (surface),
@@ -2646,15 +2644,14 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
       gint n_rects = 0;
       XRectangle *xrects = NULL;
 
-      _gdk_x11_region_get_xrectangles (shape_region,
+      _gdk_x11_region_get_xrectangles (input_region,
                                        0, 0, impl->surface_scale,
                                        &xrects, &n_rects);
       
       XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface),
                                GDK_SURFACE_XID (surface),
                               ShapeInput,
-                               offset_x * impl->surface_scale,
-                               offset_y * impl->surface_scale,
+                               0, 0,
                                xrects, n_rects,
                                ShapeSet,
                                YXBanded);
@@ -4697,7 +4694,7 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
   impl_class->get_geometry = gdk_x11_surface_get_geometry;
   impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
   impl_class->get_device_state = gdk_x11_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_x11_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_x11_surface_set_input_region;
   impl_class->destroy = gdk_x11_surface_destroy;
   impl_class->beep = gdk_x11_surface_beep;
 
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index b3e3e79b3b..0224b21a42 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1175,11 +1175,11 @@ gtk_popover_update_shape (GtkPopover *popover)
       region = gdk_cairo_region_create_from_surface (cairo_surface);
       cairo_surface_destroy (cairo_surface);
 
-      gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
+      gdk_surface_set_input_region (priv->surface, region);
       cairo_region_destroy (region);
     }
   else
-    gdk_surface_input_shape_combine_region (priv->surface, NULL, 0, 0);
+    gdk_surface_set_input_region (priv->surface, NULL);
 }
 
 static gint
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index ee054a20c3..d34051c30c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5346,7 +5346,7 @@ update_csd_shape (GtkWindow *window)
       if (priv->extra_input_region)
         cairo_region_intersect (region, priv->extra_input_region);
 
-      gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
+      gdk_surface_set_input_region (priv->surface, region);
       cairo_region_destroy (region);
     }
 }


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