[gtk+] widget: Remove gtk_widget_set_double_buffered()



commit 4a95f8802c22971976dc50e8818af6256218a54d
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 11 00:17:31 2016 +0200

    widget: Remove gtk_widget_set_double_buffered()
    
    Everything is always double-buffered.

 docs/reference/gtk/gtk4-sections.txt |    2 -
 gtk/gtkwidget.c                      |  136 ++--------------------------------
 gtk/gtkwidget.h                      |    6 --
 gtk/gtkwidgetprivate.h               |    1 -
 4 files changed, 6 insertions(+), 139 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 2db3dbc..04ee867 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5140,7 +5140,6 @@ gtk_widget_push_composite_child
 gtk_widget_queue_draw_area
 gtk_widget_queue_draw_region
 gtk_widget_set_app_paintable
-gtk_widget_set_double_buffered
 gtk_widget_set_redraw_on_allocate
 gtk_widget_mnemonic_activate
 gtk_widget_class_install_style_property
@@ -5206,7 +5205,6 @@ gtk_widget_get_can_focus
 gtk_widget_set_can_focus
 gtk_widget_get_focus_on_click
 gtk_widget_set_focus_on_click
-gtk_widget_get_double_buffered
 gtk_widget_get_has_window
 gtk_widget_set_has_window
 gtk_widget_get_sensitive
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index fe6511d..a997c96 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -583,7 +583,6 @@ enum {
   PROP_TOOLTIP_TEXT,
   PROP_WINDOW,
   PROP_OPACITY,
-  PROP_DOUBLE_BUFFERED,
   PROP_HALIGN,
   PROP_VALIGN,
   PROP_MARGIN_START,
@@ -1307,22 +1306,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                            GTK_PARAM_READABLE);
 
   /**
-   * GtkWidget:double-buffered:
-   *
-   * Whether the widget is double buffered.
-   *
-   * Since: 2.18
-   *
-   * Deprecated: 3.14: Widgets should not use this property.
-   */
-  widget_props[PROP_DOUBLE_BUFFERED] =
-      g_param_spec_boolean ("double-buffered",
-                            P_("Double Buffered"),
-                            P_("Whether the widget is double buffered"),
-                            TRUE,
-                            GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
-
-  /**
    * GtkWidget:halign:
    *
    * How to distribute horizontal space if widget gets extra space, see #GtkAlign
@@ -3403,11 +3386,6 @@ gtk_widget_set_property (GObject         *object,
       if (_gtk_widget_get_visible (widget))
         gtk_widget_queue_tooltip_query (widget);
       break;
-    case PROP_DOUBLE_BUFFERED:
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      gtk_widget_set_double_buffered (widget, g_value_get_boolean (value));
-      G_GNUC_END_IGNORE_DEPRECATIONS
-      break;
     case PROP_HALIGN:
       gtk_widget_set_halign (widget, g_value_get_enum (value));
       break;
@@ -3557,11 +3535,6 @@ gtk_widget_get_property (GObject         *object,
     case PROP_WINDOW:
       g_value_set_object (value, _gtk_widget_get_window (widget));
       break;
-    case PROP_DOUBLE_BUFFERED:
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      g_value_set_boolean (value, gtk_widget_get_double_buffered (widget));
-      G_GNUC_END_IGNORE_DEPRECATIONS
-      break;
     case PROP_HALIGN:
       g_value_set_enum (value, gtk_widget_get_halign (widget));
       break;
@@ -3943,7 +3916,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
 
   priv->sensitive = TRUE;
   priv->composite_child = composite_child_stack != 0;
-  priv->double_buffered = TRUE;
   priv->redraw_on_alloc = TRUE;
   priv->alloc_needed = TRUE;
   priv->alloc_needed_on_child = TRUE;
@@ -8618,77 +8590,6 @@ gtk_widget_get_app_paintable (GtkWidget *widget)
 }
 
 /**
- * gtk_widget_set_double_buffered:
- * @widget: a #GtkWidget
- * @double_buffered: %TRUE to double-buffer a widget
- *
- * Widgets are double buffered by default; you can use this function
- * to turn off the buffering. “Double buffered” simply means that
- * gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() are called
- * automatically around expose events sent to the
- * widget. gdk_window_begin_draw_frame() diverts all drawing to a widget's
- * window to an offscreen buffer, and gdk_window_end_draw_frame() draws the
- * buffer to the screen. The result is that users see the window
- * update in one smooth step, and don’t see individual graphics
- * primitives being rendered.
- *
- * In very simple terms, double buffered widgets don’t flicker,
- * so you would only use this function to turn off double buffering
- * if you had special needs and really knew what you were doing.
- *
- * Note: if you turn off double-buffering, you have to handle
- * expose events, since even the clearing to the background color or
- * pixmap will not happen automatically (as it is done in
- * gdk_window_begin_draw_frame()).
- *
- * In 3.10 GTK and GDK have been restructured for translucent drawing. Since
- * then expose events for double-buffered widgets are culled into a single
- * event to the toplevel GDK window. If you now unset double buffering, you
- * will cause a separate rendering pass for every widget. This will likely
- * cause rendering problems - in particular related to stacking - and usually
- * increases rendering times significantly.
- *
- * Deprecated: 3.14: This function does not work under non-X11 backends or with
- * non-native windows.
- * It should not be used in newly written code.
- **/
-void
-gtk_widget_set_double_buffered (GtkWidget *widget,
-                               gboolean   double_buffered)
-{
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  double_buffered = (double_buffered != FALSE);
-
-  if (widget->priv->double_buffered != double_buffered)
-    {
-      widget->priv->double_buffered = double_buffered;
-
-      g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_DOUBLE_BUFFERED]);
-    }
-}
-
-/**
- * gtk_widget_get_double_buffered:
- * @widget: a #GtkWidget
- *
- * Determines whether the widget is double buffered.
- *
- * See gtk_widget_set_double_buffered()
- *
- * Returns: %TRUE if the widget is double buffered
- *
- * Since: 2.18
- **/
-gboolean
-gtk_widget_get_double_buffered (GtkWidget *widget)
-{
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-
-  return widget->priv->double_buffered;
-}
-
-/**
  * gtk_widget_set_redraw_on_allocate:
  * @widget: a #GtkWidget
  * @redraw_on_allocate: if %TRUE, the entire widget will be redrawn
@@ -16162,47 +16063,22 @@ gtk_widget_render (GtkWidget            *widget,
                    GdkWindow            *window,
                    const cairo_region_t *region)
 {
-  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GdkDrawingContext *context;
   gboolean do_clip;
   cairo_t *cr;
   int x, y;
-  gboolean is_double_buffered;
 
-  /* We take the value here, in case somebody manages to changes
-   * the double_buffered value inside a ::draw call, and ends up
-   * breaking everything.
-   */
-  is_double_buffered = priv->double_buffered;
-  if (is_double_buffered)
-    {
-      /* We only render double buffered on native windows */
-      if (!gdk_window_has_native (window))
-        return;
+  /* We only render double buffered on native windows */
+  if (!gdk_window_has_native (window))
+    return;
 
-      context = gdk_window_begin_draw_frame (window, region);
-      cr = gdk_drawing_context_get_cairo_context (context);
-    }
-  else
-    {
-      /* This is annoying, but it has to stay because Firefox
-       * disables double buffering on a top-level GdkWindow,
-       * which breaks the drawing context.
-       *
-       * Candidate for deletion in the next major API bump.
-       */
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      cr = gdk_cairo_create (window);
-G_GNUC_END_IGNORE_DEPRECATIONS
-    }
+  context = gdk_window_begin_draw_frame (window, region);
+  cr = gdk_drawing_context_get_cairo_context (context);
 
   do_clip = _gtk_widget_get_translation_to_window (widget, window, &x, &y);
   cairo_translate (cr, -x, -y);
 
   gtk_widget_draw_internal (widget, cr, do_clip);
 
-  if (is_double_buffered)
-    gdk_window_end_draw_frame (window, context);
-  else
-    cairo_destroy (cr);
+  gdk_window_end_draw_frame (window, context);
 }
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 27ecbb8..4c5ac48 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -857,12 +857,6 @@ void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
 GDK_AVAILABLE_IN_ALL
 gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
 
-GDK_DEPRECATED_IN_3_14
-void                  gtk_widget_set_double_buffered    (GtkWidget    *widget,
-                                                        gboolean      double_buffered);
-GDK_DEPRECATED_IN_3_14
-gboolean              gtk_widget_get_double_buffered    (GtkWidget    *widget);
-
 GDK_AVAILABLE_IN_ALL
 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
                                                         gboolean      redraw_on_allocate);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index ea5dcd7..1fe2c03 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -67,7 +67,6 @@ struct _GtkWidgetPrivate
   guint has_grab              : 1;
   guint shadowed              : 1;
   guint app_paintable         : 1;
-  guint double_buffered       : 1;
   guint redraw_on_alloc       : 1;
   guint no_show_all           : 1;
   guint child_visible         : 1;


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