diff options
-rw-r--r-- | gtk/gtk.symbols | 2 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 78 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 4 |
3 files changed, 79 insertions, 5 deletions
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 9b624676a0..8f17063cbe 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -4957,6 +4957,7 @@ gtk_widget_event gtk_widget_freeze_child_notify gtk_widget_get_accessible gtk_widget_get_ancestor +gtk_widget_get_app_paintable gtk_widget_get_child_requisition gtk_widget_get_child_visible gtk_widget_get_clipboard @@ -4968,6 +4969,7 @@ gtk_widget_get_default_style gtk_widget_get_default_visual gtk_widget_get_direction gtk_widget_get_display +gtk_widget_get_double_buffered gtk_widget_get_events gtk_widget_get_extension_events gtk_widget_get_has_tooltip diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 4f664cb8d9..143281974f 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -154,7 +154,8 @@ enum { PROP_HAS_TOOLTIP, PROP_TOOLTIP_MARKUP, PROP_TOOLTIP_TEXT, - PROP_WINDOW + PROP_WINDOW, + PROP_DOUBLE_BUFFERED }; typedef struct _GtkStateData GtkStateData; @@ -692,6 +693,21 @@ gtk_widget_class_init (GtkWidgetClass *klass) GDK_TYPE_WINDOW, GTK_PARAM_READABLE)); + /** + * GtkWidget::double-buffered + * + * Whether or not the widget is double buffered. + * + * Since: 2.18 + */ + g_object_class_install_property (gobject_class, + PROP_DOUBLE_BUFFERED, + g_param_spec_boolean ("double-buffered", + P_("Double Buffered"), + P_("Whether or not the widget is double buffered"), + TRUE, + GTK_PARAM_READWRITE)); + widget_signals[SHOW] = g_signal_new (I_("show"), G_TYPE_FROM_CLASS (gobject_class), @@ -2523,6 +2539,9 @@ gtk_widget_set_property (GObject *object, if (GTK_WIDGET_VISIBLE (widget)) gtk_widget_queue_tooltip_query (widget); break; + case PROP_DOUBLE_BUFFERED: + gtk_widget_set_double_buffered (widget, g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2630,6 +2649,9 @@ 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_value_set_boolean (value, gtk_widget_get_double_buffered (widget)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -5651,6 +5673,27 @@ gtk_widget_set_app_paintable (GtkWidget *widget, } /** + * gtk_widget_get_app_paintable: + * @widget: a #GtkWidget + * + * Determines whether the application intends to draw on the widget in + * an #GtkWidget::expose-event handler. + * + * See gtk_widget_set_app_paintable() + * + * Return value: %TRUE if the widget is app paintable + * + * Since: 2.18 + **/ +gboolean +gtk_widget_get_app_paintable (GtkWidget *widget) +{ + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + + return (GTK_WIDGET_FLAGS (widget) & GTK_APP_PAINTABLE) != 0; +} + +/** * gtk_widget_set_double_buffered: * @widget: a #GtkWidget * @double_buffered: %TRUE to double-buffer a widget @@ -5680,10 +5723,35 @@ gtk_widget_set_double_buffered (GtkWidget *widget, { g_return_if_fail (GTK_IS_WIDGET (widget)); - if (double_buffered) - GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED); - else - GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED); + if (double_buffered != GTK_WIDGET_DOUBLE_BUFFERED (widget)) + { + if (double_buffered) + GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED); + else + GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED); + + g_object_notify (G_OBJECT (widget), "double-buffered"); + } +} + +/** + * gtk_widget_get_double_buffered: + * @widget: a #GtkWidget + * + * Determines whether the widget is double buffered. + * + * See gtk_widget_set_double_buffered() + * + * Return value: %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 (GTK_WIDGET_FLAGS (widget) & GTK_DOUBLE_BUFFERED) != 0; } /** diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index decd6d566f..70be8efe15 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -580,8 +580,12 @@ gboolean gtk_widget_get_has_window (GtkWidget *widget); void gtk_widget_set_app_paintable (GtkWidget *widget, gboolean app_paintable); +gboolean gtk_widget_get_app_paintable (GtkWidget *widget); + void gtk_widget_set_double_buffered (GtkWidget *widget, gboolean double_buffered); +gboolean gtk_widget_get_double_buffered (GtkWidget *widget); + void gtk_widget_set_redraw_on_allocate (GtkWidget *widget, gboolean redraw_on_allocate); void gtk_widget_set_parent (GtkWidget *widget, |