summaryrefslogtreecommitdiff
path: root/gtk/gtkviewport.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-11-15 21:04:51 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-11-15 21:04:51 +0000
commitb27345fe2cf7277bb3483d06651c8bb6820003ec (patch)
tree5d692b7598d24fb038d1c02b9304cb9b68e4a236 /gtk/gtkviewport.c
parent41f14d359739ba21d0725d7025885da880100f33 (diff)
downloadgtk+-b27345fe2cf7277bb3483d06651c8bb6820003ec.tar.gz
Cal gdk_window_invalidate_maybe_recurse() for recursion. (Soeren Sandmann)
Thu Nov 15 14:19:34 2001 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.c (gdk_window_invalidate_maybe_recurse): Cal gdk_window_invalidate_maybe_recurse() for recursion. (Soeren Sandmann) * gtk/gtkviewport.c: Make !redraw_on_allocate. (Soeren Sandmann) * gtk/gtkcontainer.c (gtk_container_expose): Call gtk_container_forall() not _foreach() to propagate, since we need to propagate exposes to internal children as well. * gtk/gtkwidget.c (gtk_widget_set_events, gtk_widget_add_events): Remove the restriction of only being able to call these on window widgets, since we have lots of NO_WINDOW widgets with windows now; for add events, recurse over the children of widget->window to find one owned by the widget. * gtk/gtkbutton.[ch]: Make a NO_WINDOW widget, using an input-only window to catch events. * gtk/gtktogglebutton.[ch]: Remove the code for switching between NO_WINDOW and WINDOW widgets based on the mode. * gtk/gtkcheckbutton.c gtk/gtkoptionmenu.c gtk/gtkclist.c gtk/gtktreeview.c: Adopt to NO_WINDOW change for GtkButton. * gtk/gtkrange.[ch]: Make into a NO_WINDOW widget. * gtk/gtkhscale.c, gtk/gtkvscale.c: Adopt to NO_WINDOW change for range. * gtk/gtknotebook.[ch]: Make into a NO_WINDOW widget. * docs/Changes-2.0.txt: Add a note about the NO_WINDOW changes.
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r--gtk/gtkviewport.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 8446beee4e..4ab5c7afb1 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -218,6 +218,7 @@ gtk_viewport_init (GtkViewport *viewport)
{
GTK_WIDGET_UNSET_FLAGS (viewport, GTK_NO_WINDOW);
+ gtk_widget_set_redraw_on_allocate (GTK_WIDGET (viewport), FALSE);
gtk_container_set_resize_mode (GTK_CONTAINER (viewport), GTK_RESIZE_QUEUE);
viewport->shadow_type = GTK_SHADOW_IN;
@@ -619,18 +620,11 @@ static void
gtk_viewport_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- GtkViewport *viewport;
- GtkBin *bin;
+ GtkViewport *viewport = GTK_VIEWPORT (widget);
+ GtkBin *bin = GTK_BIN (widget);
GtkAllocation child_allocation;
gint hval, vval;
- gint border_width;
-
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- viewport = GTK_VIEWPORT (widget);
- bin = GTK_BIN (widget);
+ gint border_width = GTK_CONTAINER (widget)->border_width;
/* demand creation */
if (!viewport->hadjustment)
@@ -638,15 +632,24 @@ gtk_viewport_size_allocate (GtkWidget *widget,
if (!viewport->vadjustment)
gtk_viewport_set_hadjustment (viewport, NULL);
- border_width = GTK_CONTAINER (widget)->border_width;
+ /* If our size changed, and we have a shadow, queue a redraw on widget->window to
+ * redraw the shadow correctly.
+ */
+ if (GTK_WIDGET_MAPPED (widget) &&
+ viewport->shadow_type != GTK_SHADOW_NONE &&
+ (widget->allocation.width != allocation->width ||
+ widget->allocation.height != allocation->height))
+ gdk_window_invalidate_rect (widget->window, NULL, FALSE);
+
+ widget->allocation = *allocation;
child_allocation.x = 0;
child_allocation.y = 0;
if (viewport->shadow_type != GTK_SHADOW_NONE)
{
- child_allocation.x = GTK_WIDGET (viewport)->style->xthickness;
- child_allocation.y = GTK_WIDGET (viewport)->style->ythickness;
+ child_allocation.x = widget->style->xthickness;
+ child_allocation.y = widget->style->ythickness;
}
child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2 - border_width * 2);