[gtk+/widget-padding: 67/71] Merge remote branch 'origin/master' into widget-padding
- From: Havoc Pennington <hp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/widget-padding: 67/71] Merge remote branch 'origin/master' into widget-padding
- Date: Sat, 11 Sep 2010 23:58:48 +0000 (UTC)
commit c818f8714fced77aa39c4a00dc25f84b088fb617
Merge: 1812b00 08dd02f
Author: Havoc Pennington <hp pobox com>
Date: Sat Sep 11 12:59:47 2010 -0400
Merge remote branch 'origin/master' into widget-padding
NEWS | 42 +
configure.ac | 2 +-
demos/gtk-demo/appwindow.c | 6 +-
demos/gtk-demo/hypertext.c | 4 +-
demos/testgtk/main.c | 16 +-
docs/reference/gdk/gdk3-sections.txt | 2 -
docs/reference/gdk/tmpl/keys.sgml | 11 +-
docs/reference/gdk/tmpl/threads.sgml | 7 -
docs/reference/gtk/gtk-docs.sgml | 1 -
docs/reference/gtk/gtk3-sections.txt | 20 +-
docs/reference/gtk/gtk3.types | 1 -
docs/reference/gtk/migrating-2to3.xml | 14 +
docs/reference/gtk/tmpl/gtkfeatures.sgml | 58 -
docs/reference/gtk/tmpl/gtkfilesel.sgml | 226 --
docs/reference/gtk/tmpl/gtkitem.sgml | 75 -
docs/tools/shooter.c | 6 +-
docs/tools/widgets.c | 4 +-
docs/tutorial/gtk-tut.sgml | 32 +-
examples/calendar/calendar.c | 2 +-
examples/colorsel/colorsel.c | 4 +-
gdk/Makefile.am | 3 +-
gdk/gdk.c | 13 +-
gdk/gdk.h | 23 +-
gdk/gdk.symbols | 13 -
gdk/gdkglobals.c | 4 -
gdk/gdkinternals.h | 16 +-
gdk/gdkkeynames.c | 2 +-
gdk/gdkkeys.c | 152 +-
gdk/gdkkeysyms-compat.h | 2208 +++++++++++
gdk/gdkkeysyms-update.pl | 50 +-
gdk/gdkkeysyms.h | 4350 +++++++++++-----------
gdk/gdkoffscreenwindow.c | 36 -
gdk/gdktypes.h | 10 -
gdk/gdkwindow.c | 52 +-
gdk/gdkwindow.h | 7 -
gdk/gdkwindowimpl.h | 3 -
gdk/quartz/gdkwindow-quartz.c | 9 -
gdk/win32/gdkdevicemanager-win32.c | 25 +-
gdk/win32/gdkevents-win32.c | 10 +-
gdk/win32/gdkkeys-win32.c | 238 +-
gdk/win32/gdkwindow-win32.c | 9 -
gdk/x11/gdkdevicemanager-core.c | 10 +-
gdk/x11/gdkdevicemanager-xi2.c | 10 +-
gdk/x11/gdkdisplay-x11.c | 7 +-
gdk/x11/gdkglobals-x11.c | 1 -
gdk/x11/gdkkeys-x11.c | 46 +-
gdk/x11/gdkwindow-x11.c | 53 -
gdk/x11/gdkx.h | 8 -
gtk/Makefile.am | 2 -
gtk/gtk.h | 1 -
gtk/gtk.symbols | 35 +-
gtk/gtkaboutdialog.c | 6 +-
gtk/gtkaccelgroup.c | 26 +-
gtk/gtkarrow.c | 79 +-
gtk/gtkbindings.c | 4 +-
gtk/gtkbuilder.c | 2 +-
gtk/gtkbuilderparser.c | 2 +-
gtk/gtkcalendar.c | 20 +-
gtk/gtkcellrendereraccel.c | 8 +-
gtk/gtkcellrendererspin.c | 4 +-
gtk/gtkcolorsel.c | 38 +-
gtk/gtkcombobox.c | 46 +-
gtk/gtkcontainer.c | 1 -
gtk/gtkdebug.h | 15 +-
gtk/gtkdialog.c | 2 +-
gtk/gtkdnd.c | 28 +-
gtk/gtkentry.c | 140 +-
gtk/gtkfilechooserdefault.c | 72 +-
gtk/gtkfilechooserentry.c | 2 +-
gtk/gtkfontsel.c | 9 +-
gtk/gtkhandlebox.c | 182 +-
gtk/gtkhsv.c | 16 +-
gtk/gtkiconcache.c | 2 +-
gtk/gtkiconview.c | 282 +-
gtk/gtkimage.c | 58 +-
gtk/gtkimcontextsimple.c | 2 +-
gtk/gtkinfobar.c | 2 +-
gtk/gtkitem.c | 179 -
gtk/gtkitem.h | 79 -
gtk/gtklabel.c | 80 +-
gtk/gtkmain.c | 153 +-
gtk/gtkmain.h | 25 +-
gtk/gtkmenu.c | 377 ++-
gtk/gtkmenubar.c | 16 +-
gtk/gtkmenuitem.c | 81 +-
gtk/gtkmenuitem.h | 12 +-
gtk/gtkmenushell.c | 18 +-
gtk/gtkmisc.c | 37 +-
gtk/gtknotebook.c | 386 ++-
gtk/gtkpaned.c | 80 +-
gtk/gtkpathbar.c | 46 +-
gtk/gtkplug-win32.c | 4 +-
gtk/gtkprintjob.c | 2 +-
gtk/gtkprintoperation-win32.c | 6 +-
gtk/gtkprivate.h | 28 +-
gtk/gtkrange.c | 2 +-
gtk/gtkrbtree.c | 22 +-
gtk/gtkruler.c | 119 +-
gtk/gtkscale.c | 72 +-
gtk/gtkscalebutton.c | 14 +-
gtk/gtkscrolledwindow.c | 30 +-
gtk/gtkselection.c | 4 +-
gtk/gtkseparator.c | 63 +-
gtk/gtksizegroup.c | 1 -
gtk/gtksizerequest.c | 93 +-
gtk/gtksocket-win32.c | 4 +-
gtk/gtksocket.c | 5 -
gtk/gtkspinbutton.c | 126 +-
gtk/gtkspinner.c | 1 -
gtk/gtkstatusicon.c | 10 +-
gtk/gtktextbtree.c | 30 +-
gtk/gtktextchild.c | 7 +-
gtk/gtktextiter.c | 2 +-
gtk/gtktextlayout.c | 4 +-
gtk/gtktextlayout.h | 4 +-
gtk/gtktextsegment.c | 14 +-
gtk/gtktexttypes.c | 9 +-
gtk/gtktexttypes.h | 28 +-
gtk/gtktextview.c | 311 +-
gtk/gtktoolbar.c | 22 +-
gtk/gtktreestore.c | 2 +-
gtk/gtktreeview.c | 499 ++-
gtk/gtkwidget.c | 837 +++--
gtk/gtkwidget.h | 55 +-
gtk/gtkwin32embedwidget.c | 4 +-
gtk/gtkwindow.c | 1291 ++++---
gtk/gtkwindow.h | 60 +-
gtk/tests/testing.c | 2 +-
gtk/tests/textbuffer.c | 7 +-
modules/engines/ms-windows/msw_style.c | 53 +-
modules/input/gtkimcontextime.c | 4 +-
modules/input/gtkimcontextmultipress.c | 2 +-
modules/input/gtkimcontextthai.c | 36 +-
modules/input/imam-et.c | 8 +-
modules/input/imcedilla.c | 12 +-
modules/input/imcyrillic-translit.c | 268 +-
modules/input/iminuktitut.c | 4 +-
modules/input/imipa.c | 120 +-
modules/input/imti-er.c | 8 +-
modules/input/imti-et.c | 8 +-
modules/input/imviqr.c | 322 +-
modules/other/gail/Makefile.am | 2 -
modules/other/gail/gail.c | 7 +-
modules/other/gail/gail.h | 1 -
modules/other/gail/gailbutton.c | 4 +-
modules/other/gail/gailcell.c | 5 -
modules/other/gail/gailcell.h | 3 -
modules/other/gail/gailcombobox.c | 2 +-
modules/other/gail/gailentry.c | 2 +-
modules/other/gail/gailexpander.c | 2 +-
modules/other/gail/gailitem.c | 707 ----
modules/other/gail/gailitem.h | 56 -
modules/other/gail/gailmenuitem.c | 535 +++-
modules/other/gail/gailmenuitem.h | 11 +-
modules/other/gail/gailrange.c | 19 +-
modules/other/gail/gailwindow.c | 12 +-
modules/printbackends/cups/gtkprintbackendcups.c | 2 +-
po-properties/POTFILES.in | 1 -
po/POTFILES.in | 1 -
po/nb.po | 530 ++--
tests/testgtk.c | 20 +-
tests/testthreads.c | 2 +-
162 files changed, 9583 insertions(+), 7536 deletions(-)
---
diff --cc gtk/gtksizerequest.c
index 5322be2,7c67c7e..543bbc1
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@@ -170,97 -146,15 +146,66 @@@ get_cached_size (gint for_siz
}
static void
- destroy_cache (SizeRequestCache *cache)
- {
- g_slice_free (SizeRequestCache, cache);
- }
-
- static SizeRequestCache *
- get_cache (GtkSizeRequest *widget,
- gboolean create)
- {
- SizeRequestCache *cache;
-
- cache = g_object_get_qdata (G_OBJECT (widget), quark_cache);
- if (!cache && create)
- {
- cache = g_slice_new0 (SizeRequestCache);
-
- cache->cached_width_age = 1;
- cache->cached_height_age = 1;
-
- g_object_set_qdata_full (G_OBJECT (widget), quark_cache, cache,
- (GDestroyNotify)destroy_cache);
- }
-
- return cache;
- }
-
-
- static void
- do_size_request (GtkWidget *widget)
+ do_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
{
- if (GTK_WIDGET_REQUEST_NEEDED (widget))
- {
- gtk_widget_ensure_style (widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_REQUEST_NEEDED);
- g_signal_emit_by_name (widget,
- "size-request",
- &widget->requisition);
- }
+ /* Now we dont bother caching the deprecated "size-request" returns,
+ * just unconditionally invoke here just in case we run into legacy stuff */
+ gtk_widget_ensure_style (widget);
+ g_signal_emit_by_name (widget, "size-request", requisition);
}
+#ifndef G_DISABLE_CHECKS
+static GQuark recursion_check_quark = 0;
+#endif /* G_DISABLE_CHECKS */
+
+static void
+push_recursion_check (GtkSizeRequest *request,
+ GtkSizeGroupMode orientation,
+ gint for_size)
+{
+#ifndef G_DISABLE_CHECKS
+ const char *previous_method;
+ const char *method;
+
+ if (recursion_check_quark == 0)
+ recursion_check_quark = g_quark_from_static_string ("gtk-size-request-in-progress");
+
+ previous_method = g_object_get_qdata (G_OBJECT (request), recursion_check_quark);
+
+ if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
+ {
+ method = for_size < 0 ? "get_width" : "get_width_for_height";
+ }
+ else
+ {
+ method = for_size < 0 ? "get_height" : "get_height_for_width";
+ }
+
+ if (previous_method != NULL)
+ {
+ g_warning ("%s %p: widget tried to gtk_size_request_%s inside "
+ " GtkSizeRequest::%s implementation. "
+ "Should just invoke GTK_SIZE_REQUEST_GET_IFACE(widget)->%s "
+ "directly rather than using gtk_size_request_%s",
+ G_OBJECT_TYPE_NAME (request), request,
+ method, previous_method,
+ method, method);
+ }
+
+ g_object_set_qdata (G_OBJECT (request), recursion_check_quark, (char*) method);
+#endif /* G_DISABLE_CHECKS */
+}
+
+static void
+pop_recursion_check (GtkSizeRequest *request,
+ GtkSizeGroupMode orientation)
+{
+#ifndef G_DISABLE_CHECKS
+ g_object_set_qdata (G_OBJECT (request), recursion_check_quark, NULL);
+#endif
+}
+
static void
compute_size_for_orientation (GtkSizeRequest *request,
GtkSizeGroupMode orientation,
@@@ -311,12 -205,11 +257,12 @@@
gint group_size, requisition_size;
/* Unconditional size request runs but is often unhandled. */
- do_size_request (widget);
+ do_size_request (widget, &requisition);
+ push_recursion_check (request, orientation, for_size);
if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
{
- requisition_size = widget->requisition.width;
+ requisition_size = requisition.width;
if (for_size < 0)
GTK_SIZE_REQUEST_GET_IFACE (request)->get_width (request, &min_size, &nat_size);
diff --cc gtk/gtkwidget.c
index b04f99a,a203236..39c07a9
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@@ -4114,9 -3974,9 +4192,10 @@@ voi
gtk_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
+ GtkWidgetPrivate *priv;
GdkRectangle real_allocation;
GdkRectangle old_allocation;
+ GdkRectangle adjusted_allocation;
gboolean alloc_needed;
gboolean size_changed;
gboolean position_changed;
@@@ -4146,33 -4008,13 +4227,34 @@@
#endif /* G_ENABLE_DEBUG */
alloc_needed = GTK_WIDGET_ALLOC_NEEDED (widget);
- if (!GTK_WIDGET_REQUEST_NEEDED (widget)) /* Preserve request/allocate ordering */
+ if (!GTK_WIDGET_WIDTH_REQUEST_NEEDED (widget) &&
+ !GTK_WIDGET_HEIGHT_REQUEST_NEEDED (widget)) /* Preserve request/allocate ordering */
GTK_PRIVATE_UNSET_FLAG (widget, GTK_ALLOC_NEEDED);
- old_allocation = widget->allocation;
+ old_allocation = priv->allocation;
real_allocation = *allocation;
+ adjusted_allocation = real_allocation;
+ GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, &adjusted_allocation);
+
+ if (adjusted_allocation.x < real_allocation.x ||
+ adjusted_allocation.y < real_allocation.y ||
+ (adjusted_allocation.x + adjusted_allocation.width) >
+ (real_allocation.x + real_allocation.width) ||
+ (adjusted_allocation.y + adjusted_allocation.height >
+ real_allocation.y + real_allocation.height))
+ {
+ g_warning ("%s %p attempted to adjust its size allocation from %d,%d %dx%d to %d,%d %dx%d. adjust_size_allocation must keep allocation inside original bounds",
+ G_OBJECT_TYPE_NAME (widget), widget,
+ real_allocation.x, real_allocation.y, real_allocation.width, real_allocation.height,
+ adjusted_allocation.x, adjusted_allocation.y, adjusted_allocation.width, adjusted_allocation.height);
+ adjusted_allocation = real_allocation; /* veto it */
+ }
+ else
+ {
+ real_allocation = adjusted_allocation;
+ }
+
if (real_allocation.width < 0 || real_allocation.height < 0)
{
g_warning ("gtk_widget_size_allocate(): attempt to allocate widget with width %d and height %d",
@@@ -9248,50 -9049,10 +9410,50 @@@ static voi
gtk_widget_real_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- requisition->width = widget->requisition.width;
- requisition->height = widget->requisition.height;
+ requisition->width = 0;
+ requisition->height = 0;
}
+static void
+gtk_widget_real_adjust_size_request (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ const GtkWidgetAuxInfo *aux_info;
+
+ aux_info =_gtk_widget_get_aux_info_or_defaults (widget);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL &&
+ aux_info->width > 0)
+ {
+ *minimum_size = MAX (*minimum_size, aux_info->width);
+ }
+ else if (orientation == GTK_ORIENTATION_VERTICAL &&
+ aux_info->height > 0)
+ {
+ *minimum_size = MAX (*minimum_size, aux_info->height);
+ }
+
+ /* Fix it if set_size_request made natural size smaller than min size.
+ * This would also silently fix broken widgets, but we warn about them
+ * in gtksizerequest.c when calling their size request vfuncs.
+ */
+ *natural_size = MAX (*natural_size, *minimum_size);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ *minimum_size += (aux_info->padding.left + aux_info->padding.right);
+ *natural_size += (aux_info->padding.left + aux_info->padding.right);
+ }
+ else
+ {
+ *minimum_size += (aux_info->padding.top + aux_info->padding.bottom);
+ *natural_size += (aux_info->padding.top + aux_info->padding.bottom);
+ }
+}
+
/**
* _gtk_widget_peek_colormap:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]