From 88cf5470290cd03ada031641cb6ee1c90df75e7d Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 9 Oct 2010 22:15:34 -0400 Subject: Fix handling of the geometry widget The geometry widget feature of gtk_window_set_geometry_hints() has never really worked right because the calculation that GTK+ did to compute the base size of the window only worked when the geometry widget had a larger minimum size than anything else in the window. Setup: * Move the GtkSizeGroup private functions to a new private header gtksizegroup-private.h * Add the possibilty to pass flags to _gtk_size_group_queue_resize(), with the flag GTK_QUEUE_RESIZE_INVALIDATE_ONLY to suppress adding the widget's toplevel to the resize queue. * _gtk_container_resize_invalidate() is added to implement that feature * _gtk_widget_override_size_request()/_gtk_widget_restore_size_request() allow temporarily forcing a large minimum size on the geometry widget without creating resize loops. GtkWindow: * Compute the extra width/height around the geometry widget correctly; print a warning if the computation fails. * Always make the minimum size at least the natural minimum size of the toplevel; GTK+ now fails badly with underallocation. * Always set the base size hint; we were failing to set it properly when the specified minimum size was overriden, but it's harmless to always set it. Tests: * New test 'testgeometry' that replaces the 'gridded geometry' test from testgtk. The new test is roughly similar but creates a bunch of windows showing different possibilities. * The testgtk test is removed. No need to have both. https://bugzilla.gnome.org/show_bug.cgi?id=68668 --- gtk/gtksizegroup-private.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 gtk/gtksizegroup-private.h (limited to 'gtk/gtksizegroup-private.h') diff --git a/gtk/gtksizegroup-private.h b/gtk/gtksizegroup-private.h new file mode 100644 index 0000000000..3f80d3fd7b --- /dev/null +++ b/gtk/gtksizegroup-private.h @@ -0,0 +1,49 @@ +/* GTK - The GIMP Toolkit + * gtksizegroup-private.h: + * Copyright (C) 2000-2010 Red Hat Software + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GTK_SIZE_GROUP_PRIVATE_H__ +#define __GTK_SIZE_GROUP_PRIVATE_H__ + +#include + +/** + * GtkQueueResizeFlags: + * @GTK_QUEUE_RESIZE_INVALIDATE_ONLY: invalidate all cached sizes + * as we would normally do when a widget is queued for resize, + * but don't actually add the toplevel resize container to the + * resize queue. Useful if we want to change the size of a widget + * see how that would affect the overall layout, then restore + * the old size. + * + * Flags that affect the operation of queueing a widget for resize. + */ +typedef enum +{ + GTK_QUEUE_RESIZE_INVALIDATE_ONLY = 1 << 0 +} GtkQueueResizeFlags; + +void _gtk_size_group_bump_requisition (GtkWidget *widget, + GtkSizeGroupMode mode, + gint *minimum, + gint *natural); +void _gtk_size_group_queue_resize (GtkWidget *widget, + GtkQueueResizeFlags flags); + +#endif /* __GTK_SIZE_GROUP_PRIVATE_H__ */ -- cgit v1.2.1