[gtk+/gtk-3-0] widget: Don't create the style context if not necessary
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-0] widget: Don't create the style context if not necessary
- Date: Sun, 27 Mar 2011 00:16:48 +0000 (UTC)
commit 866e37f57dd1e4e66e0418f69d45d9fec7ba6334
Author: Benjamin Otte <otte redhat com>
Date: Sat Mar 26 15:22:11 2011 +0100
widget: Don't create the style context if not necessary
If all we want to do is update the context's screen, we don't need to
create it if it doesn't exist yet.
gtk/gtkwidget.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index bc67013..44c3ccd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8530,7 +8530,7 @@ do_screen_change (GtkWidget *widget,
{
if (old_screen != new_screen)
{
- GtkStyleContext *context;
+ GtkWidgetPrivate *priv = widget->priv;
if (old_screen)
{
@@ -8541,8 +8541,8 @@ do_screen_change (GtkWidget *widget,
_gtk_tooltip_hide (widget);
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_screen (context, gtk_widget_get_screen (widget));
+ if (new_screen && priv->context)
+ gtk_style_context_set_screen (priv->context, new_screen);
g_signal_emit (widget, widget_signals[SCREEN_CHANGED], 0, old_screen);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]