From 67260eec22d9173e89dc61e85488d8d6e93f8370 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 5 Oct 2013 14:57:53 +0200 Subject: [PATCH] container: Deprecate resize mode Resize modes don't work anymore, both because nobody ever uses them and because the frame clock changed the way things work quite a bit. So we don't want to advertise them as a good idea. https://bugzilla.gnome.org/show_bug.cgi?id=708787 --- gtk/gtkcontainer.c | 16 ++++++++++++++++ gtk/gtkcontainer.h | 4 ++-- gtk/gtkplug.c | 4 ++++ gtk/gtkstylecontext.c | 2 ++ gtk/gtkwindow.c | 10 ++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 82fda082a6..be375b06ed 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -1419,7 +1419,9 @@ gtk_container_set_property (GObject *object, gtk_container_set_border_width (container, g_value_get_uint (value)); break; case PROP_RESIZE_MODE: + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (container, g_value_get_enum (value)); + G_GNUC_END_IGNORE_DEPRECATIONS; break; case PROP_CHILD: gtk_container_add (container, GTK_WIDGET (g_value_get_object (value))); @@ -1595,6 +1597,10 @@ _gtk_container_dequeue_resize_handler (GtkContainer *container) * The resize mode of a container determines whether a resize request * will be passed to the container's parent, queued for later execution * or executed immediately. + * + * Deprecated: 3.12: Resize modes are deprecated. They aren't necessary + * anymore since frame clocks and might introduce obscure bugs if + * used. **/ void gtk_container_set_resize_mode (GtkContainer *container, @@ -1630,6 +1636,10 @@ gtk_container_set_resize_mode (GtkContainer *container, * gtk_container_set_resize_mode (). * * Return value: the current resize mode + * + * Deprecated: 3.12: Resize modes are deprecated. They aren't necessary + * anymore since frame clocks and might introduce obscure bugs if + * used. **/ GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container) @@ -1748,7 +1758,9 @@ gtk_container_queue_resize_handler (GtkContainer *container) { GtkWidget *widget; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; g_return_if_fail (GTK_IS_RESIZE_CONTAINER (container)); + G_GNUC_END_IGNORE_DEPRECATIONS; widget = GTK_WIDGET (container); @@ -1793,8 +1805,10 @@ _gtk_container_queue_resize_internal (GtkContainer *container, _gtk_widget_set_alloc_needed (widget, TRUE); _gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget)); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (GTK_IS_RESIZE_CONTAINER (widget)) break; + G_GNUC_END_IGNORE_DEPRECATIONS; widget = gtk_widget_get_parent (widget); } @@ -1879,6 +1893,7 @@ gtk_container_real_check_resize (GtkContainer *container) if (requisition.width > allocation.width || requisition.height > allocation.height) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (GTK_IS_RESIZE_CONTAINER (container)) { gtk_widget_size_allocate (widget, &allocation); @@ -1886,6 +1901,7 @@ gtk_container_real_check_resize (GtkContainer *container) } else gtk_widget_queue_resize (widget); + G_GNUC_END_IGNORE_DEPRECATIONS; } else { diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index 4a334df783..0a1f7b68dc 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -119,10 +119,10 @@ GDK_AVAILABLE_IN_ALL void gtk_container_remove (GtkContainer *container, GtkWidget *widget); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_12 void gtk_container_set_resize_mode (GtkContainer *container, GtkResizeMode resize_mode); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_3_12 GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container); GDK_AVAILABLE_IN_ALL diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c index c2fb49304b..66917a3db7 100644 --- a/gtk/gtkplug.c +++ b/gtk/gtkplug.c @@ -313,7 +313,9 @@ gtk_plug_set_is_child (GtkPlug *plug, gtk_widget_unmap (widget); _gtk_window_set_is_toplevel (GTK_WINDOW (plug), FALSE); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (GTK_CONTAINER (plug), GTK_RESIZE_PARENT); + G_GNUC_END_IGNORE_DEPRECATIONS; _gtk_widget_propagate_hierarchy_changed (widget, widget); } @@ -328,7 +330,9 @@ gtk_plug_set_is_child (GtkPlug *plug, gtk_window_group_add_window (priv->modality_group, GTK_WINDOW (plug)); _gtk_window_set_is_toplevel (GTK_WINDOW (plug), TRUE); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (GTK_CONTAINER (plug), GTK_RESIZE_QUEUE); + G_GNUC_END_IGNORE_DEPRECATIONS; _gtk_widget_propagate_hierarchy_changed (GTK_WIDGET (plug), NULL); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index b02f45fd3e..9f35f42c82 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -1069,10 +1069,12 @@ gtk_style_context_set_invalid (GtkStyleContext *context, if (invalid) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (GTK_IS_RESIZE_CONTAINER (priv->widget)) _gtk_container_queue_restyle (GTK_CONTAINER (priv->widget)); else if (priv->parent) gtk_style_context_set_invalid (priv->parent, TRUE); + G_GNUC_END_IGNORE_DEPRECATIONS; } } diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index ba685c0a09..bcb23e9a6f 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1287,7 +1287,9 @@ gtk_window_init (GtkWindow *window) _gtk_widget_set_is_toplevel (widget, TRUE); _gtk_widget_set_anchored (widget, TRUE); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE); + G_GNUC_END_IGNORE_DEPRECATIONS; priv->title = NULL; priv->wmclass_name = g_strdup (g_get_prgname ()); @@ -5780,7 +5782,9 @@ gtk_window_realize (GtkWidget *widget) if (gtk_widget_get_parent_window (widget)) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (GTK_CONTAINER (widget), GTK_RESIZE_PARENT); + G_GNUC_END_IGNORE_DEPRECATIONS; attributes.x = allocation.x; attributes.y = allocation.y; @@ -5804,7 +5808,9 @@ gtk_window_realize (GtkWidget *widget) return; } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE); + G_GNUC_END_IGNORE_DEPRECATIONS; /* ensure widget tree is properly size allocated */ if (allocation.x == -1 && @@ -9040,8 +9046,10 @@ gtk_window_move_resize (GtkWindow *window) gdk_window_process_updates (gdk_window, TRUE); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE) gtk_widget_queue_draw (widget); + G_GNUC_END_IGNORE_DEPRECATIONS; } else { @@ -9064,11 +9072,13 @@ gtk_window_move_resize (GtkWindow *window) * FIXME: we should also dequeue the pending redraws here, since * we handle those ourselves upon ->configure_notify_received==TRUE. */ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE) { gtk_widget_queue_resize_no_redraw (widget); _gtk_container_dequeue_resize_handler (container); } + G_GNUC_END_IGNORE_DEPRECATIONS; } } else