[gtk+] paned: Fix drawing
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] paned: Fix drawing
- Date: Sun, 14 Feb 2016 15:13:06 +0000 (UTC)
commit 6edb420e510e5bed5f5d67b1a3b48670fba32287
Author: Benjamin Otte <otte redhat com>
Date: Sun Feb 14 16:10:07 2016 +0100
paned: Fix drawing
Clip children to their window's size. That way no overdraw happens for
these widgets. But don't clip the handle.
We might in the future consider not clipping un-shrinkable children.
https://bugzilla.gnome.org/show_bug.cgi?id=762021
gtk/gtkpaned.c | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 336b06a..1d16ab0 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1796,23 +1796,42 @@ gtk_paned_render (GtkCssGadget *gadget,
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkPaned *paned = GTK_PANED (widget);
GtkPanedPrivate *priv = paned->priv;
+ GtkAllocation widget_allocation;
+ int window_x, window_y;
- cairo_save (cr);
- cairo_rectangle (cr, x, y, width, height);
- cairo_clip (cr);
-
+ gtk_widget_get_allocation (widget, &widget_allocation);
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)) &&
priv->child1 && gtk_widget_get_visible (priv->child1) &&
priv->child2 && gtk_widget_get_visible (priv->child2))
gtk_css_gadget_draw (priv->handle_gadget, cr);
- if (gtk_cairo_should_draw_window (cr, priv->child1_window))
- gtk_container_propagate_draw (GTK_CONTAINER (widget), priv->child1, cr);
-
- if (gtk_cairo_should_draw_window (cr, priv->child2_window))
- gtk_container_propagate_draw (GTK_CONTAINER (widget), priv->child2, cr);
+ if (priv->child1 && gtk_widget_get_visible (priv->child1))
+ {
+ gdk_window_get_position (priv->child1_window, &window_x, &window_y);
+ cairo_save (cr);
+ cairo_rectangle (cr,
+ window_x - widget_allocation.x,
+ window_y - widget_allocation.y,
+ gdk_window_get_width (priv->child1_window),
+ gdk_window_get_height (priv->child1_window));
+ cairo_clip (cr);
+ gtk_container_propagate_draw (GTK_CONTAINER (widget), priv->child1, cr);
+ cairo_restore (cr);
+ }
- cairo_restore (cr);
+ if (priv->child2 && gtk_widget_get_visible (priv->child2))
+ {
+ gdk_window_get_position (priv->child2_window, &window_x, &window_y);
+ cairo_save (cr);
+ cairo_rectangle (cr,
+ window_x - widget_allocation.x,
+ window_y - widget_allocation.y,
+ gdk_window_get_width (priv->child2_window),
+ gdk_window_get_height (priv->child2_window));
+ cairo_clip (cr);
+ gtk_container_propagate_draw (GTK_CONTAINER (widget), priv->child2, cr);
+ cairo_restore (cr);
+ }
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]