surface: Simplify gdk_surface_invalidate_region()
authorBenjamin Otte <otte@redhat.com>
Wed, 21 Mar 2018 03:07:37 +0000 (04:07 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 21 Mar 2018 03:10:07 +0000 (04:10 +0100)
Remove duplicate functions and unused arguments.

Functionality is identical otherwise.

12 files changed:
gdk/gdkinternals.h
gdk/gdksurface.c
gdk/gdksurface.h
gdk/wayland/gdkdnd-wayland.c
gdk/wayland/gdksurface-wayland.c
gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkgeometry-x11.c [deleted file]
gdk/x11/gdkprivate-x11.h
gdk/x11/gdksurface-x11.c
gdk/x11/meson.build
gtk/gtkdebugupdates.c
gtk/gtkwidget.c

index 1bde9056992643652f9308901d6d3a2e53b2a2ce..435cd504e818e9336c98785bb396a18435d7f08b 100644 (file)
@@ -342,9 +342,6 @@ void _gdk_windowing_got_event                (GdkDisplay       *display,
 
 #define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_SURFACE_STATE_WITHDRAWN) == 0)
 
-void _gdk_surface_invalidate_for_expose (GdkSurface       *surface,
-                                        cairo_region_t       *region);
-
 GdkSurface * _gdk_surface_find_child_at (GdkSurface *surface,
                                        double x, double y);
 GdkSurface * _gdk_surface_find_descendant_at (GdkSurface *toplevel,
index 4a0816600201ec38811f17ed8eff8bf5aeaf415b..b490ebd4b7772b946cd1727f75330a48ec5113fc 100644 (file)
@@ -131,12 +131,6 @@ static void update_cursor               (GdkDisplay *display,
                                          GdkDevice  *device);
 static void impl_surface_add_update_area (GdkSurface *impl_surface,
                                         cairo_region_t *region);
-static void gdk_surface_invalidate_region_full (GdkSurface       *surface,
-                                              const cairo_region_t *region,
-                                              gboolean         invalidate_children);
-static void gdk_surface_invalidate_rect_full (GdkSurface          *surface,
-                                            const GdkRectangle *rect,
-                                            gboolean            invalidate_children);
 static cairo_surface_t *gdk_surface_ref_impl_surface (GdkSurface *surface);
 
 static void gdk_surface_set_frame_clock (GdkSurface      *surface,
@@ -2173,10 +2167,20 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
   g_object_unref (surface);
 }
 
-static void
-gdk_surface_invalidate_rect_full (GdkSurface          *surface,
-                                 const GdkRectangle *rect,
-                                 gboolean            invalidate_children)
+/**
+ * gdk_surface_invalidate_rect:
+ * @surface: a #GdkSurface
+ * @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
+ *      surface
+ * @invalidate_children: whether to also invalidate child surfaces
+ *
+ * A convenience wrapper around gdk_surface_invalidate_region() which
+ * invalidates a rectangular region. See
+ * gdk_surface_invalidate_region() for details.
+ **/
+void
+gdk_surface_invalidate_rect (GdkSurface        *surface,
+                           const GdkRectangle *rect)
 {
   GdkRectangle surface_rect;
   cairo_region_t *region;
@@ -2199,29 +2203,10 @@ gdk_surface_invalidate_rect_full (GdkSurface          *surface,
     }
 
   region = cairo_region_create_rectangle (rect);
-  gdk_surface_invalidate_region_full (surface, region, invalidate_children);
+  gdk_surface_invalidate_region (surface, region);
   cairo_region_destroy (region);
 }
 
-/**
- * gdk_surface_invalidate_rect:
- * @surface: a #GdkSurface
- * @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
- *      surface
- * @invalidate_children: whether to also invalidate child surfaces
- *
- * A convenience wrapper around gdk_surface_invalidate_region() which
- * invalidates a rectangular region. See
- * gdk_surface_invalidate_region() for details.
- **/
-void
-gdk_surface_invalidate_rect (GdkSurface          *surface,
-                           const GdkRectangle *rect,
-                           gboolean            invalidate_children)
-{
-  gdk_surface_invalidate_rect_full (surface, rect, invalidate_children);
-}
-
 static void
 impl_surface_add_update_area (GdkSurface *impl_surface,
                             cairo_region_t *region)
@@ -2236,9 +2221,27 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
     }
 }
 
-static void
-gdk_surface_invalidate_full (GdkSurface           *surface,
-                            const cairo_region_t *region)
+/**
+ * gdk_surface_invalidate_region:
+ * @surface: a #GdkSurface
+ * @region: a #cairo_region_t
+ * @invalidate_children: %TRUE to also invalidate child surfaces
+ *
+ * Adds @region to the update area for @surface. The update area is the
+ * region that needs to be redrawn, or “dirty region.”
+ *
+ * GDK will process all updates whenever the frame clock schedules a redraw,
+ * so there’s no need to do forces redraws manually, you just need to
+ * invalidate regions that you know should be redrawn.
+ *
+ * The @invalidate_children parameter controls whether the region of
+ * each child surface that intersects @region will also be invalidated.
+ * If %FALSE, then the update area for child surfaces will remain
+ * unaffected.
+ **/
+void
+gdk_surface_invalidate_region (GdkSurface          *surface,
+                             const cairo_region_t *region)
 {
   cairo_region_t *visible_region;
   cairo_rectangle_int_t r;
@@ -2281,62 +2284,6 @@ gdk_surface_invalidate_full (GdkSurface           *surface,
   cairo_region_destroy (visible_region);
 }
 
-static void
-gdk_surface_invalidate_region_full (GdkSurface       *surface,
-                                   const cairo_region_t *region,
-                                   gboolean         invalidate_children)
-{
-  gdk_surface_invalidate_full (surface, region);
-}
-
-/**
- * gdk_surface_invalidate_region:
- * @surface: a #GdkSurface
- * @region: a #cairo_region_t
- * @invalidate_children: %TRUE to also invalidate child surfaces
- *
- * Adds @region to the update area for @surface. The update area is the
- * region that needs to be redrawn, or “dirty region.”
- *
- * GDK will process all updates whenever the frame clock schedules a redraw,
- * so there’s no need to do forces redraws manually, you just need to
- * invalidate regions that you know should be redrawn.
- *
- * The @invalidate_children parameter controls whether the region of
- * each child surface that intersects @region will also be invalidated.
- * If %FALSE, then the update area for child surfaces will remain
- * unaffected.
- **/
-void
-gdk_surface_invalidate_region (GdkSurface       *surface,
-                             const cairo_region_t *region,
-                             gboolean         invalidate_children)
-{
-  gdk_surface_invalidate_full (surface, region);
-}
-
-/**
- * _gdk_surface_invalidate_for_expose:
- * @surface: a #GdkSurface
- * @region: a #cairo_region_t
- *
- * Adds @region to the update area for @surface.
- *
- * GDK will process all updates whenever the frame clock schedules a redraw,
- * so there’s no need to do forces redraws manually, you just need to
- * invalidate regions that you know should be redrawn.
- *
- * This version of invalidation is used when you recieve expose events
- * from the native surface system. It exposes the native surface, plus
- * any non-native child surfaces.
- **/
-void
-_gdk_surface_invalidate_for_expose (GdkSurface       *surface,
-                                  cairo_region_t       *region)
-{
-  gdk_surface_invalidate_full (surface, region);
-}
-
 /**
  * _gdk_surface_clear_update_area:
  * @surface: a #GdkSurface.
@@ -2770,7 +2717,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
       recompute_visible_regions (surface, FALSE);
 
       if (gdk_surface_is_viewable (surface))
-        gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
+        gdk_surface_invalidate_rect (surface, NULL);
     }
 }
 
@@ -2821,7 +2768,7 @@ gdk_surface_raise (GdkSurface *surface)
       !gdk_surface_is_toplevel (surface) &&
       gdk_surface_is_viewable (surface) &&
       !surface->input_only)
-    gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
+    gdk_surface_invalidate_rect (surface, NULL);
 }
 
 static void
@@ -2862,7 +2809,7 @@ gdk_surface_invalidate_in_parent (GdkSurface *private)
   child.height = private->height;
   gdk_rectangle_intersect (&r, &child, &r);
 
-  gdk_surface_invalidate_rect_full (private->parent, &r, TRUE);
+  gdk_surface_invalidate_rect (private->parent, &r);
 }
 
 
@@ -3365,7 +3312,7 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
 
       cairo_region_union (new_region, old_region);
 
-      gdk_surface_invalidate_region_full (surface->parent, new_region, TRUE);
+      gdk_surface_invalidate_region (surface->parent, new_region);
 
       cairo_region_destroy (old_region);
       cairo_region_destroy (new_region);
@@ -5841,7 +5788,7 @@ gdk_surface_set_opacity (GdkSurface *surface,
   else
     {
       recompute_visible_regions (surface, FALSE);
-      gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
+      gdk_surface_invalidate_rect (surface, NULL);
     }
 }
 
index cc64c790646d476b230c9e6b9795883c39e5a77d..8aaea641327284ae1fce371d520381c0ce5ff9c5 100644 (file)
@@ -804,12 +804,10 @@ void gdk_surface_begin_move_drag_for_device   (GdkSurface     *surface,
 /* Interface for dirty-region queueing */
 GDK_AVAILABLE_IN_ALL
 void       gdk_surface_invalidate_rect           (GdkSurface          *surface,
-                                                const GdkRectangle *rect,
-                                                gboolean            invalidate_children);
+                                                const GdkRectangle   *rect);
 GDK_AVAILABLE_IN_ALL
 void       gdk_surface_invalidate_region         (GdkSurface          *surface,
-                                                const cairo_region_t    *region,
-                                                gboolean            invalidate_children);
+                                                const cairo_region_t *region);
 
 GDK_AVAILABLE_IN_ALL
 void       gdk_surface_freeze_updates      (GdkSurface    *surface);
index c9893390afc84899ab11d126d6e6c5d7c0ce1da5..7f72a4c47f90897027c3b2e7e8168315ddd70b61 100644 (file)
@@ -384,7 +384,7 @@ gdk_wayland_drag_context_set_hotspot (GdkDragContext *context,
 
   _gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
                                              -hot_x, -hot_y);
-  gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect, FALSE);
+  gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect);
 }
 
 static void
index 463cc326058c2c60e712322a728c4a33799de0a6..04811eb08fe3f20e59b265dccbf024f246a92bdb 100644 (file)
@@ -314,8 +314,6 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
                                 int        scale)
 {
   GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
-  GdkRectangle area;
-  cairo_region_t *region;
 
   if ((surface->width == width) &&
       (surface->height == height) &&
@@ -333,14 +331,7 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
   if (impl->display_server.wl_surface)
     wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
 
-  area.x = 0;
-  area.y = 0;
-  area.width = surface->width;
-  area.height = surface->height;
-
-  region = cairo_region_create_rectangle (&area);
-  _gdk_surface_invalidate_for_expose (surface, region);
-  cairo_region_destroy (region);
+  gdk_surface_invalidate_rect (surface, NULL);
 }
 
 static const gchar *
index 844c14f02f38f4883598e807680f42ff7c159767..1386acbb4996774f54cb3e3fa0f732ebf64e7329 100644 (file)
@@ -748,7 +748,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
         y2 = (xevent->xexpose.y + xevent->xexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
         expose_rect.height = y2 - expose_rect.y;
 
-        _gdk_x11_surface_process_expose (surface, xevent->xexpose.serial, &expose_rect);
+        gdk_surface_invalidate_rect (surface, &expose_rect);
         return_val = FALSE;
       }
 
@@ -778,7 +778,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
         y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
         expose_rect.height = y2 - expose_rect.y;
 
-        _gdk_x11_surface_process_expose (surface, xevent->xgraphicsexpose.serial, &expose_rect);
+        gdk_surface_invalidate_rect (surface, &expose_rect);
         return_val = FALSE;
       }
       break;
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
deleted file mode 100644 (file)
index 74601eb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "gdksurface-x11.h"
-
-
-void
-_gdk_x11_surface_process_expose (GdkSurface    *surface,
-                                gulong        serial,
-                                GdkRectangle *area)
-{
-  cairo_region_t *invalidate_region = cairo_region_create_rectangle (area);
-
-  if (!cairo_region_is_empty (invalidate_region))
-    _gdk_surface_invalidate_for_expose (surface, invalidate_region);
-
-  cairo_region_destroy (invalidate_region);
-}
index e89e64732dfb218607f000d88682611a37ef45c3..3c9f6ca7ad0f6e5449e0311cf9688690098a8c45 100644 (file)
@@ -78,11 +78,6 @@ gint _gdk_x11_display_send_xevent (GdkDisplay *display,
                                    glong       event_mask,
                                    XEvent     *event_send);
 
-/* Routines from gdkgeometry-x11.c */
-void _gdk_x11_surface_process_expose    (GdkSurface     *window,
-                                        gulong         serial,
-                                        GdkRectangle  *area);
-
 cairo_region_t* _gdk_x11_xwindow_get_shape  (Display *xdisplay,
                                              Window   window,
                                              gint     scale,
index ef914c19301f391866240d059f3ae49f758612b7..60da5f292628f944ff01a9e743f4f43ffe62e617 100644 (file)
@@ -1638,7 +1638,7 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
                      surface->height * impl->surface_scale);
     }
 
-  gdk_surface_invalidate_rect (surface, NULL, TRUE);
+  gdk_surface_invalidate_rect (surface, NULL);
 }
 
 static void
index 3912031c185ba6ef101477651ff99e8bcf9de632..dbffdcca5f1ea63295939d48b6d1f1bb65c10203 100644 (file)
@@ -13,7 +13,6 @@ gdk_x11_sources = files([
   'gdkdnd-x11.c',
   'gdkeventsource.c',
   'gdkeventtranslator.c',
-  'gdkgeometry-x11.c',
   'gdkglcontext-x11.c',
   'gdkkeys-x11.c',
   'gdkmain-x11.c',
index 672afae4d4c3741bcbf37ac961c150dce901fabc..b371603bc4c61e4c0b318d0013219a1133a193ad 100644 (file)
@@ -180,7 +180,7 @@ gtk_window_manage_updates (GtkWidget     *widget,
       cairo_region_union (region, draw->region);
     }
   gtk_debug_updates_print (updates, region, "Queued update");
-  gdk_surface_invalidate_region (gtk_widget_get_surface (widget), region, TRUE);
+  gdk_surface_invalidate_region (gtk_widget_get_surface (widget), region);
   cairo_region_destroy (region);
 
   /* Then remove all outdated regions */
index 989b2d09d695b660dbeb32d82590d09801071a19..257b0e7b98d21b0f1369202fa88228c7408123bb 100644 (file)
@@ -4338,7 +4338,7 @@ gtk_widget_queue_draw_region (GtkWidget            *widget,
 
 invalidate:
   gtk_debug_updates_add (windowed_parent, region2);
-  gdk_surface_invalidate_region (_gtk_widget_get_surface (widget), region2, TRUE);
+  gdk_surface_invalidate_region (_gtk_widget_get_surface (widget), region2);
 
   cairo_region_destroy (region2);