[gtk+] gdk: Remove gdk_window_set_debug_updates()



commit e76ba9a3c3fbf0712b70b66b170c959a63777dee
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 11 16:26:16 2016 +0200

    gdk: Remove gdk_window_set_debug_updates()
    
    The update tracking code was ugly and using deprecated drawing APIs. It
    was also in the wrong place.
    
    So instead of trying to keep it working, I'll remove it. We need to find
    a better way to put it and make it work there.

 docs/reference/gdk/gdk4-sections.txt |    1 -
 gdk/gdk-private.c                    |    2 -
 gdk/gdk-private.h                    |    8 ----
 gdk/gdkdisplay.c                     |   17 -------
 gdk/gdkdisplayprivate.h              |    3 -
 gdk/gdkinternals.h                   |    1 -
 gdk/gdkwindow.c                      |   78 ----------------------------------
 gdk/gdkwindow.h                      |    4 --
 gtk/gtkmain.c                        |    3 -
 gtk/inspector/visual.c               |    8 ++-
 10 files changed, 5 insertions(+), 120 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 33efa6d..4b2252f 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -417,7 +417,6 @@ gdk_window_freeze_updates
 gdk_window_thaw_updates
 gdk_window_process_all_updates
 gdk_window_process_updates
-gdk_window_set_debug_updates
 gdk_window_enable_synchronized_configure
 gdk_window_configure_finished
 gdk_window_get_frame_clock
diff --git a/gdk/gdk-private.c b/gdk/gdk-private.c
index 37a4ee6..c765934 100644
--- a/gdk/gdk-private.c
+++ b/gdk/gdk-private.c
@@ -15,8 +15,6 @@ gdk__private__ (void)
     gdk_window_thaw_toplevel_updates,
     gdk_display_get_rendering_mode,
     gdk_display_set_rendering_mode,
-    gdk_display_get_debug_updates,
-    gdk_display_set_debug_updates,
     gdk_window_move_to_rect
   };
 
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 69d1266..ba16b92 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -27,10 +27,6 @@ GdkRenderingMode gdk_display_get_rendering_mode (GdkDisplay       *display);
 void             gdk_display_set_rendering_mode (GdkDisplay       *display,
                                                  GdkRenderingMode  mode);
 
-gboolean         gdk_display_get_debug_updates (GdkDisplay *display);
-void             gdk_display_set_debug_updates (GdkDisplay *display,
-                                                gboolean    debug_updates);
-
 void            gdk_window_move_to_rect         (GdkWindow          *window,
                                                  const GdkRectangle *rect,
                                                  GdkGravity          rect_anchor,
@@ -61,10 +57,6 @@ typedef struct {
   void             (* gdk_display_set_rendering_mode) (GdkDisplay       *display,
                                                        GdkRenderingMode  mode);
 
-  gboolean         (* gdk_display_get_debug_updates) (GdkDisplay *display);
-  void             (* gdk_display_set_debug_updates) (GdkDisplay *display,
-                                                      gboolean    debug_updates);
-
   void (* gdk_window_move_to_rect) (GdkWindow          *window,
                                     const GdkRectangle *rect,
                                     GdkGravity          rect_anchor,
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 53b9179..92ac894 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2409,23 +2409,6 @@ gdk_display_set_rendering_mode (GdkDisplay       *display,
 }
 
 void
-gdk_display_set_debug_updates (GdkDisplay *display,
-                               gboolean    debug_updates)
-{
-  display->debug_updates = debug_updates;
-  display->debug_updates_set = TRUE;
-}
-
-gboolean
-gdk_display_get_debug_updates (GdkDisplay *display)
-{
-  if (display->debug_updates_set)
-    return display->debug_updates;
-  else
-    return _gdk_debug_updates;
-}
-
-void
 gdk_display_add_seat (GdkDisplay *display,
                       GdkSeat    *seat)
 {
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index fea52aa..c2a3c08 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -123,9 +123,6 @@ struct _GdkDisplay
   guint has_gl_extension_texture_non_power_of_two : 1;
   guint has_gl_extension_texture_rectangle : 1;
 
-  guint debug_updates     : 1;
-  guint debug_updates_set : 1;
-
   GdkRenderingMode rendering_mode;
 
   GList *seats;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 25496fc..03e49b6 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -92,7 +92,6 @@ extern GdkWindow        *_gdk_parent_root;
 extern guint _gdk_debug_flags;
 extern guint _gdk_gl_flags;
 extern GdkRenderingMode    _gdk_rendering_mode;
-extern gboolean _gdk_debug_updates;
 
 #ifdef G_ENABLE_DEBUG
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index b7ffc53..678fdca 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -183,10 +183,6 @@ static cairo_surface_t *gdk_window_ref_impl_surface (GdkWindow *window);
 static void gdk_window_set_frame_clock (GdkWindow      *window,
                                         GdkFrameClock  *clock);
 
-static void draw_ugly_color (GdkWindow       *window,
-                             const cairo_region_t *region,
-                             int color);
-
 
 static guint signals[LAST_SIGNAL] = { 0 };
 static GParamSpec *properties[LAST_PROP] = { NULL, };
@@ -3533,7 +3529,6 @@ gdk_cairo_create (GdkWindow *window)
 /* Code for dirty-region queueing
  */
 static GSList *update_windows = NULL;
-gboolean _gdk_debug_updates = FALSE;
 
 static inline gboolean
 gdk_window_is_ancestor (GdkWindow *window,
@@ -3832,9 +3827,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
 {
   GdkWindowImplClass *impl_class;
   GdkWindow *toplevel;
-  GdkDisplay *display;
 
-  display = gdk_window_get_display (window);
   toplevel = gdk_window_get_toplevel (window);
   if (toplevel->geometry_dirty)
     {
@@ -3877,18 +3870,6 @@ gdk_window_process_updates_internal (GdkWindow *window)
          /* Clip to part visible in impl window */
          cairo_region_intersect (expose_region, window->clip_region);
 
-         if (gdk_display_get_debug_updates (display))
-           {
-              cairo_region_t *swap_region = cairo_region_copy (expose_region);
-              cairo_region_subtract (swap_region, window->active_update_area);
-              draw_ugly_color (window, swap_region, 1);
-              cairo_region_destroy (swap_region);
-
-             /* Make sure we see the red invalid area before redrawing. */
-             gdk_display_sync (gdk_window_get_display (window));
-             g_usleep (70000);
-           }
-
           if (impl_class->queue_antiexpose)
             impl_class->queue_antiexpose (window, expose_region);
 
@@ -4198,29 +4179,6 @@ gdk_window_set_invalidate_handler (GdkWindow                      *window,
 }
 
 static void
-draw_ugly_color (GdkWindow       *window,
-                const cairo_region_t *region,
-                 int color)
-{
-  cairo_t *cr;
-
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  cr = gdk_cairo_create (window);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
-  /* Draw ugly color all over the newly-invalid region */
-  if (color == 0)
-    cairo_set_source_rgb (cr, 50000/65535., 10000/65535., 10000/65535.);
-  else
-    cairo_set_source_rgb (cr, 10000/65535., 50000/65535., 10000/65535.);
-
-  gdk_cairo_region (cr, region);
-  cairo_fill (cr);
-
-  cairo_destroy (cr);
-}
-
-static void
 impl_window_add_update_area (GdkWindow *impl_window,
                             cairo_region_t *region)
 {
@@ -4322,7 +4280,6 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow            *window,
 {
   cairo_region_t *visible_region;
   cairo_rectangle_int_t r;
-  GdkDisplay *display;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -4343,10 +4300,6 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow            *window,
   if (child_func)
     invalidate_impl_subwindows (window, region, child_func, user_data);
 
-  display = gdk_window_get_display (window);
-  if (gdk_display_get_debug_updates (display))
-    draw_ugly_color (window, visible_region, 0);
-
   while (window != NULL && 
         !cairo_region_is_empty (visible_region))
     {
@@ -4689,37 +4642,6 @@ gdk_window_thaw_toplevel_updates (GdkWindow *window)
 }
 
 /**
- * gdk_window_set_debug_updates:
- * @setting: %TRUE to turn on update debugging
- *
- * With update debugging enabled, calls to
- * gdk_window_invalidate_region() clear the invalidated region of the
- * screen to a noticeable color, and GDK pauses for a short time
- * before sending exposes to windows during
- * gdk_window_process_updates().  The net effect is that you can see
- * the invalid region for each window and watch redraws as they
- * occur. This allows you to diagnose inefficiencies in your application.
- *
- * In essence, because the GDK rendering model prevents all flicker,
- * if you are redrawing the same region 400 times you may never
- * notice, aside from noticing a speed problem. Enabling update
- * debugging causes GTK to flicker slowly and noticeably, so you can
- * see exactly what’s being redrawn when, in what order.
- *
- * The --gtk-debug=updates command line option passed to GTK+ programs
- * enables this debug option at application startup time. That's
- * usually more useful than calling gdk_window_set_debug_updates()
- * yourself, though you might want to use this function to enable
- * updates sometime after application startup time.
- *
- **/
-void
-gdk_window_set_debug_updates (gboolean setting)
-{
-  _gdk_debug_updates = setting;
-}
-
-/**
  * gdk_window_constrain_size:
  * @geometry: a #GdkGeometry structure
  * @flags: a mask indicating what portions of @geometry are set
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 9e14c6f..fb495a9 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -1037,10 +1037,6 @@ GDK_AVAILABLE_IN_ALL
 void       gdk_window_process_updates     (GdkWindow    *window,
                                           gboolean      update_children);
 
-/* Enable/disable flicker, so you can tell if your code is inefficient. */
-GDK_AVAILABLE_IN_ALL
-void       gdk_window_set_debug_updates   (gboolean      setting);
-
 GDK_AVAILABLE_IN_ALL
 void       gdk_window_constrain_size      (GdkGeometry    *geometry,
                                            GdkWindowHints  flags,
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 5c0dcb1..9e2a6df 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -736,9 +736,6 @@ do_post_parse_initialization (int    *argc,
       g_log_set_always_fatal (fatal_mask);
     }
 
-  if (debug_flags[0].flags & GTK_DEBUG_UPDATES)
-    gdk_window_set_debug_updates (TRUE);
-
   gtk_widget_set_default_direction (gtk_get_locale_direction ());
 
   _gtk_ensure_resources ();
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index bb36432..7b68a1d 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -185,19 +185,21 @@ font_scale_entry_activated (GtkEntry           *entry,
 static void
 updates_activate (GtkSwitch *sw)
 {
+#if 0
   gboolean updates;
 
   updates = gtk_switch_get_active (sw);
-  GDK_PRIVATE_CALL (gdk_display_set_debug_updates) (gdk_display_get_default (), updates);
+  /* FIXME: Do something */
   redraw_everything ();
+#endif
 }
 
 static void
 init_updates (GtkInspectorVisual *vis)
 {
-  gboolean updates;
+  gboolean updates = FALSE;
 
-  updates = GDK_PRIVATE_CALL (gdk_display_get_debug_updates) (gdk_display_get_default ());
+  /* FIXME: Do something */
   gtk_switch_set_active (GTK_SWITCH (vis->priv->updates_switch), updates);
 }
 


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