summaryrefslogtreecommitdiff
path: root/gtk/gtkviewport.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-02-25 16:14:37 +0100
committerBenjamin Otte <otte@redhat.com>2016-02-25 16:52:58 +0100
commit4e8fb33f5677e086e1ba9f5a5650a12be99da99c (patch)
tree74b9a99679a95ca2296c68ad376672d2008ec5ae /gtk/gtkviewport.c
parent71a9fd9d83f118abc2ed087792459f3e47a555dd (diff)
downloadgtk+-4e8fb33f5677e086e1ba9f5a5650a12be99da99c.tar.gz
pixelcache: Don't have a style context argument
That would imply the pixelcache monitors the style context for changes and it doesn't do that. Its only use case was opacity checks, so add gtk_pixel_cache_se_is_opaque() instead.
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r--gtk/gtkviewport.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 368374c5e3..088951487e 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -33,7 +33,8 @@
#include "gtkpixelcacheprivate.h"
#include "gtkprivate.h"
#include "gtkscrollable.h"
-#include "gtkrender.h"
+#include "gtkrenderbackgroundprivate.h"
+#include "gtkstylecontextprivate.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
@@ -938,16 +939,32 @@ gtk_viewport_draw (GtkWidget *widget,
}
static void
+gtk_viewport_update_pixelcache_opacity (GtkWidget *child,
+ GtkViewport *viewport)
+{
+ GtkViewportPrivate *priv = viewport->priv;
+
+ gtk_pixel_cache_set_is_opaque (priv->pixel_cache,
+ gtk_css_style_render_background_is_opaque (
+ gtk_style_context_lookup_style (
+ gtk_widget_get_style_context (child))));
+}
+
+static void
gtk_viewport_remove (GtkContainer *container,
GtkWidget *child)
{
GtkViewport *viewport = GTK_VIEWPORT (container);
GtkViewportPrivate *priv = viewport->priv;
- GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->remove (container, child);
+ if (g_signal_handlers_disconnect_by_func (child, gtk_viewport_update_pixelcache_opacity, viewport) != 1)
+ {
+ g_assert_not_reached ();
+ }
- _gtk_pixel_cache_set_style_context (priv->pixel_cache, NULL);
+ GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->remove (container, child);
+ gtk_pixel_cache_set_is_opaque (priv->pixel_cache, FALSE);
}
static void
@@ -961,11 +978,11 @@ gtk_viewport_add (GtkContainer *container,
g_return_if_fail (gtk_bin_get_child (bin) == NULL);
gtk_widget_set_parent_window (child, priv->bin_window);
-
- _gtk_pixel_cache_set_style_context (priv->pixel_cache,
- gtk_widget_get_style_context (child));
-
+
GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->add (container, child);
+
+ g_signal_connect (child, "style-updated", G_CALLBACK (gtk_viewport_update_pixelcache_opacity), viewport);
+ gtk_viewport_update_pixelcache_opacity (child, viewport);
}
static void