]> Pileus Git - ~andy/gtk/commitdiff
fail silently for toplevels. if resize_mode changes to GTK_RESIZE_PARENT,
authorTim Janik <timj@gtk.org>
Fri, 19 Jun 1998 06:56:15 +0000 (06:56 +0000)
committerTim Janik <timj@src.gnome.org>
Fri, 19 Jun 1998 06:56:15 +0000 (06:56 +0000)
Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
        for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
        resize widget list before queuing the container for a new reize.
        (gtk_container_need_resize): changed return value to FALSE, since this
        used to indicate that no further resizes are needed.
        (gtk_container_set_arg):
        (gtk_container_get_arg):
        (gtk_container_class_init): implemented GtkContainer::resize_mode
        argument.

        (gtk_container_resize_children): when we walk up the tree of a resize
        widget we need to stop if we are the current parent.

        * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
        GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
        (gtk_widget_hide_all): retrive the toplevel widget from via
        gtk_widget_get_resize_container().

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtk.defs
gtk/gtkcontainer.c
gtk/gtkwidget.c

index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 61e10299c4231a589a8b8ee49fe1120dc653a7ca..d1827a0413f24a133862846a0b2d2ad7b87fee84 100644 (file)
@@ -1,3 +1,23 @@
+Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
+       for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
+       resize widget list before queuing the container for a new reize.
+       (gtk_container_need_resize): changed return value to FALSE, since this
+       used to indicate that no further resizes are needed.
+       (gtk_container_set_arg): 
+       (gtk_container_get_arg): 
+       (gtk_container_class_init): implemented GtkContainer::resize_mode
+       argument.
+
+       (gtk_container_resize_children): when we walk up the tree of a resize
+       widget we need to stop if we are the current parent.
+
+       * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
+       GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
+       (gtk_widget_hide_all): retrive the toplevel widget from via
+       gtk_widget_get_resize_container().
+
 Thu Jun 18 23:08:36 1998  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtklist.c (gtk_list_button_press): Only respond
index 4b2a3fef102717c3c0ed6dff403445349eb551ca..05293048fd6f6490e8424f84b0a8ae762169663e 100644 (file)
@@ -1,7 +1,7 @@
 ;; generated by makeenums.pl  ; -*- scheme -*-
 
 
-; enumerations from "../../gtk+/gtk/gtkclist.h"
+; enumerations from "./gtkclist.h"
 
 (define-enum GtkCellType
    (empty GTK_CELL_EMPTY)
@@ -10,7 +10,7 @@
    (pixtext GTK_CELL_PIXTEXT)
    (widget GTK_CELL_WIDGET))
 
-; enumerations from "../../gtk+/gtk/gtkctree.h"
+; enumerations from "./gtkctree.h"
 
 (define-enum GtkCTreePos
    (before GTK_CTREE_POS_BEFORE)
    (dotted GTK_CTREE_LINES_DOTTED)
    (none GTK_CTREE_LINES_NONE))
 
-; enumerations from "../../gtk+/gtk/gtkdebug.h"
+; enumerations from "./gtkdebug.h"
 
 (define-flags GtkDebugFlag
    (objects GTK_DEBUG_OBJECTS)
    (misc GTK_DEBUG_MISC)
    (signals GTK_DEBUG_SIGNALS))
 
-; enumerations from "../../gtk+/gtk/gtkenums.h"
+; enumerations from "./gtkenums.h"
 
 (define-flags GtkAccelFlags
    (visible GTK_ACCEL_VISIBLE)
    (dialog GTK_WINDOW_DIALOG)
    (popup GTK_WINDOW_POPUP))
 
-; enumerations from "../../gtk+/gtk/gtkfontsel.h"
+; enumerations from "./gtkfontsel.h"
 
 (define-enum GtkFontMetricType
    (ixels-metric PIXELS_METRIC)
    (oints-metric POINTS_METRIC))
 
-; enumerations from "../../gtk+/gtk/gtkobject.h"
+; enumerations from "./gtkobject.h"
 
 (define-flags GtkObjectFlags
    (destroyed GTK_DESTROYED)
    (mask GTK_ARG_MASK)
    (readwrite GTK_ARG_READWRITE))
 
-; enumerations from "../../gtk+/gtk/gtkpacker.h"
+; enumerations from "./gtkpacker.h"
 
 (define-flags GtkPackerOptions
    (expand GTK_PACK_EXPAND)
    (w GTK_ANCHOR_W)
    (e GTK_ANCHOR_E))
 
-; enumerations from "../../gtk+/gtk/gtkprivate.h"
+; enumerations from "./gtkprivate.h"
 
 (define-flags GtkPrivateFlags
    (user-style PRIVATE_GTK_USER_STYLE)
    (has-shape-mask PRIVATE_GTK_HAS_SHAPE_MASK)
    (in-reparent PRIVATE_GTK_IN_REPARENT))
 
-; enumerations from "../../gtk+/gtk/gtkspinbutton.h"
+; enumerations from "./gtkspinbutton.h"
 
 (define-enum GtkSpinButtonUpdatePolicy
    (always GTK_UPDATE_ALWAYS)
    (if-valid GTK_UPDATE_IF_VALID))
 
-; enumerations from "../../gtk+/gtk/gtktoolbar.h"
+; enumerations from "./gtktoolbar.h"
 
 (define-enum GtkToolbarChildType
    (space GTK_TOOLBAR_CHILD_SPACE)
    (radiobutton GTK_TOOLBAR_CHILD_RADIOBUTTON)
    (widget GTK_TOOLBAR_CHILD_WIDGET))
 
-; enumerations from "../../gtk+/gtk/gtktree.h"
+; enumerations from "./gtktree.h"
 
 (define-enum GtkTreeViewMode
    (line GTK_TREE_VIEW_LINE)
    (item GTK_TREE_VIEW_ITEM))
 
-; enumerations from "../../gtk+/gtk/gtktypeutils.h"
+; enumerations from "./gtktypeutils.h"
 
 (define-enum GtkFundamentalType
    (invalid GTK_TYPE_INVALID)
    (c-callback GTK_TYPE_C_CALLBACK)
    (object GTK_TYPE_OBJECT))
 
-; enumerations from "../../gtk+/gtk/gtkwidget.h"
+; enumerations from "./gtkwidget.h"
 
 (define-flags GtkWidgetFlags
    (toplevel GTK_TOPLEVEL)
    (rc-style GTK_RC_STYLE)
    (basic GTK_BASIC))
 
-; enumerations from "../../gtk+/gdk/gdkprivate.h"
+; enumerations from "../gdk/gdkprivate.h"
 
 (define-flags GdkDebugFlag
    (misc GDK_DEBUG_MISC)
    (color-context GDK_DEBUG_COLOR_CONTEXT)
    (xim GDK_DEBUG_XIM))
 
-; enumerations from "../../gtk+/gdk/gdktypes.h"
+; enumerations from "../gdk/gdktypes.h"
 
 (define-enum GdkWindowType
    (root GDK_WINDOW_ROOT)
index 84a62b0e92da0731fd4ee933010c142857fcdf22..a92a259190edaba668c098c01d8920939c187c12 100644 (file)
@@ -35,6 +35,7 @@ enum {
 enum {
   ARG_0,
   ARG_BORDER_WIDTH,
+  ARG_RESIZE_MODE,
   ARG_CHILD
 };
 
@@ -168,6 +169,7 @@ gtk_container_class_init (GtkContainerClass *class)
   hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
   
   gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
+  gtk_object_add_arg_type ("GtkContainer::resize_mode", GTK_TYPE_RESIZE_MODE, GTK_ARG_READWRITE, ARG_RESIZE_MODE);
   gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);
 
   container_signals[ADD] =
@@ -697,6 +699,9 @@ gtk_container_set_arg (GtkContainer *container,
     case ARG_BORDER_WIDTH:
       gtk_container_border_width (container, GTK_VALUE_ULONG (*arg));
       break;
+    case ARG_RESIZE_MODE:
+      gtk_container_set_resize_mode (container, GTK_VALUE_ENUM (*arg));
+      break;
     case ARG_CHILD:
       gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
       break;
@@ -715,6 +720,9 @@ gtk_container_get_arg (GtkContainer *container,
     case ARG_BORDER_WIDTH:
       GTK_VALUE_ULONG (*arg) = container->border_width;
       break;
+    case ARG_RESIZE_MODE:
+      GTK_VALUE_ENUM (*arg) = container->resize_mode;
+      break;
     default:
       arg->type = GTK_TYPE_INVALID;
       break;
@@ -819,19 +827,25 @@ gtk_container_set_resize_mode (GtkContainer  *container,
 {
   g_return_if_fail (container != NULL);
   g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (!(GTK_WIDGET_TOPLEVEL (container) && 
-                     resize_mode == GTK_RESIZE_PARENT));
-
-  container->resize_mode = resize_mode;
-
-  if (container->resize_widgets != NULL)
+  g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE);
+  
+  if (GTK_WIDGET_TOPLEVEL (container) &&
+      resize_mode == GTK_RESIZE_PARENT)
+    resize_mode = GTK_RESIZE_QUEUE;
+  
+  if (container->resize_mode != resize_mode)
     {
-      if (resize_mode == GTK_RESIZE_IMMEDIATE)
-       gtk_container_check_resize (container);
-      else if (resize_mode == GTK_RESIZE_PARENT)
+      container->resize_mode = resize_mode;
+      
+      if (container->resize_widgets != NULL)
        {
-         gtk_widget_queue_resize (GTK_WIDGET (container));
-         container->resize_widgets = NULL;
+         if (resize_mode == GTK_RESIZE_IMMEDIATE)
+           gtk_container_check_resize (container);
+         else if (resize_mode == GTK_RESIZE_PARENT)
+           {
+             gtk_container_clear_resize_widgets (container);
+             gtk_widget_queue_resize (GTK_WIDGET (container));
+           }
        }
     }
 }
@@ -849,7 +863,7 @@ gint
 gtk_container_need_resize (GtkContainer     *container)
 {
   gtk_container_check_resize (container);
-  return TRUE;
+  return FALSE;
 }
 
 static void
@@ -876,7 +890,7 @@ gtk_container_real_check_resize (GtkContainer *container)
     }
 }
 
-/* The window hasn't changed size but one of its children
+/* The container hasn't changed size but one of its children
  *  queued a resize request. Which means that the allocation
  *  is not sufficient for the requisition of some child.
  *  We've already performed a size request at this point,
@@ -895,12 +909,12 @@ gtk_container_resize_children (GtkContainer *container)
   GSList *resize_containers;
   GSList *node;
   
-  resize_widgets = container->resize_widgets;
-  container->resize_widgets = NULL;
-  
   g_return_if_fail (container != NULL);
   g_return_if_fail (GTK_IS_CONTAINER (container));
 
+  resize_widgets = container->resize_widgets;
+  container->resize_widgets = NULL;
+  
   for (node = resize_widgets; node; node = node->next)
     {
       widget = node->data;
index accf1fc350d646e1a5c8b65ae8a8527f9e34d675..307e7aafb820adda496ee2144333aefda8352e7f 100644 (file)
@@ -1421,7 +1421,7 @@ gtk_widget_hide_all (GtkWidget *widget)
     {
       GtkWidget *toplevel;
 
-      toplevel = gtk_widget_get_toplevel (widget);
+      toplevel = gtk_widget_get_resize_container (widget);
       GTK_CONTAINER (toplevel)->resize_widgets =
        g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
       GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
@@ -1675,11 +1675,17 @@ gtk_widget_queue_resize (GtkWidget *widget)
              break;
 
            case GTK_RESIZE_IMMEDIATE:
-             container->resize_widgets = 
-               g_slist_prepend (container->resize_widgets, widget);
-             gtk_container_check_resize (container);
+             if (!GTK_WIDGET_RESIZE_NEEDED (widget))
+               {
+                 GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
+                 container->resize_widgets =
+                   g_slist_prepend (container->resize_widgets, widget);
+                 gtk_container_check_resize (container);
+               }
+             break;
            case GTK_RESIZE_PARENT:
              /* Ignore */
+             break;
            }
        }
       else