]> Pileus Git - ~andy/gtk/commitdiff
do not avoid to queue for a resize if the container is not visible, we
authorTim Janik <timj@gtk.org>
Wed, 24 Jun 1998 17:15:05 +0000 (17:15 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 24 Jun 1998 17:15:05 +0000 (17:15 +0000)
Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
        if the container is not visible, we might be a toplevel! this holds
        for all other base container implementations as well, that are
        candidates to derive toplevels from. in general the resizing code will
        care about visibility itself.
        * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
        * gtk/gtkbox.c (gtk_box_remove): likewise.

        * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
        gtk_window_set_hints(), since we haven't calculated the new position
        yet.

        * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
        *mask are alway initialized in a sane way, regardless of the return
        value.

14 files changed:
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
gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c
gtk/gtkbin.c
gtk/gtkbox.c
gtk/gtkmenushell.c
gtk/gtkwidget.c
gtk/gtkwindow.c

index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index c2fbbad6d2563bb50a064c2f95e1f07bdb53a79e..9438fe3c08702cad41d472ba573efebfdac7e290 100644 (file)
@@ -1,3 +1,21 @@
+Wed Jun 24 16:38:02 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbin.c (gtk_bin_remove): do not avoid to queue for a resize
+       if the container is not visible, we might be a toplevel! this holds
+       for all other base container implementations as well, that are
+       candidates to derive toplevels from. in general the resizing code will
+       care about visibility itself.
+       * gtk/gtkmenushell.c (gtk_menu_shell_remove): likewise.
+       * gtk/gtkbox.c (gtk_box_remove): likewise.
+
+       * gtk/gtkwindow.c (gtk_window_move_resize): save ->use_uposition around
+       gtk_window_set_hints(), since we haven't calculated the new position
+       yet.
+
+       * gdk/gdkwindow.c (gdk_window_get_pointer): take care that *x, *y and
+       *mask are alway initialized in a sane way, regardless of the return
+       value.
+
 Wed Jun 24 14:14:32 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
@@ -351,7 +369,6 @@ Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>
 
        * more GtkType and macro fixups.
 
->>>>>>> 1.476
 1998-06-16  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
        * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
index 46211d1142c7d91e6e9ad882817e29bea3952ffc..ad19209751c9680edad8a7c340ee34eb963f9707 100644 (file)
@@ -1285,7 +1285,8 @@ gdk_window_get_origin (GdkWindow *window,
   GdkWindowPrivate *private;
   gint return_val;
   Window child;
-  gint tx, ty;
+  gint tx = 0;
+  gint ty = 0;
 
   g_return_val_if_fail (window != NULL, 0);
 
@@ -1299,14 +1300,15 @@ gdk_window_get_origin (GdkWindow *window,
                                          0, 0, &tx, &ty,
                                          &child);
       
-      if (x)
-       *x = tx;
-      if (y)
-       *y = ty;
     }
   else
     return_val = 0;
   
+  if (x)
+    *x = tx;
+  if (y)
+    *y = ty;
+  
   return return_val;
 }
 
@@ -1321,8 +1323,9 @@ gdk_window_get_pointer (GdkWindow       *window,
   Window root;
   Window child;
   int rootx, rooty;
-  int winx, winy;
-  unsigned int xmask;
+  int winx = 0;
+  int winy = 0;
+  unsigned int xmask = 0;
 
   if (!window)
     window = (GdkWindow*) &gdk_root_parent;
@@ -1334,14 +1337,17 @@ gdk_window_get_pointer (GdkWindow       *window,
       XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
                     &rootx, &rooty, &winx, &winy, &xmask))
     {
-      if (x) *x = winx;
-      if (y) *y = winy;
-      if (mask) *mask = xmask;
-      
       if (child)
        return_val = gdk_window_lookup (child);
     }
   
+  if (x)
+    *x = winx;
+  if (y)
+    *y = winy;
+  if (mask)
+    *mask = xmask;
+  
   return return_val;
 }
 
index 46211d1142c7d91e6e9ad882817e29bea3952ffc..ad19209751c9680edad8a7c340ee34eb963f9707 100644 (file)
@@ -1285,7 +1285,8 @@ gdk_window_get_origin (GdkWindow *window,
   GdkWindowPrivate *private;
   gint return_val;
   Window child;
-  gint tx, ty;
+  gint tx = 0;
+  gint ty = 0;
 
   g_return_val_if_fail (window != NULL, 0);
 
@@ -1299,14 +1300,15 @@ gdk_window_get_origin (GdkWindow *window,
                                          0, 0, &tx, &ty,
                                          &child);
       
-      if (x)
-       *x = tx;
-      if (y)
-       *y = ty;
     }
   else
     return_val = 0;
   
+  if (x)
+    *x = tx;
+  if (y)
+    *y = ty;
+  
   return return_val;
 }
 
@@ -1321,8 +1323,9 @@ gdk_window_get_pointer (GdkWindow       *window,
   Window root;
   Window child;
   int rootx, rooty;
-  int winx, winy;
-  unsigned int xmask;
+  int winx = 0;
+  int winy = 0;
+  unsigned int xmask = 0;
 
   if (!window)
     window = (GdkWindow*) &gdk_root_parent;
@@ -1334,14 +1337,17 @@ gdk_window_get_pointer (GdkWindow       *window,
       XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
                     &rootx, &rooty, &winx, &winy, &xmask))
     {
-      if (x) *x = winx;
-      if (y) *y = winy;
-      if (mask) *mask = xmask;
-      
       if (child)
        return_val = gdk_window_lookup (child);
     }
   
+  if (x)
+    *x = winx;
+  if (y)
+    *y = winy;
+  if (mask)
+    *mask = xmask;
+  
   return return_val;
 }
 
index 6e7f397dfc54cd8bfa90c61bf0ddcbcebf9a325a..6486ad90bc5b7dc45c201704422a690af986ffe3 100644 (file)
@@ -251,7 +251,10 @@ gtk_bin_remove (GtkContainer *container,
       gtk_widget_unparent (widget);
       bin->child = NULL;
 
-      if (widget_was_visible && GTK_WIDGET_VISIBLE (container))
+      /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
+       * since that's what is needed by toplevels, which derive from GtkBin.
+       */
+      if (widget_was_visible)
         gtk_widget_queue_resize (GTK_WIDGET (container));
     }
 }
index 78e85b0e596ec2584a5baf9603104844a70247fc..0b0b0a58fc374a9169af6c1cb8fdf486a88cfd10 100644 (file)
@@ -711,16 +711,19 @@ gtk_box_remove (GtkContainer *container,
 
       if (child->widget == widget)
        {
-         gint visible;
+         gboolean was_visible;
 
-         visible = GTK_WIDGET_VISIBLE (widget);
+         was_visible = GTK_WIDGET_VISIBLE (widget);
          gtk_widget_unparent (widget);
 
          box->children = g_list_remove_link (box->children, children);
          g_list_free (children);
          g_free (child);
 
-         if (visible && GTK_WIDGET_VISIBLE (container))
+         /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
+          * since that's what is needed by toplevels.
+          */
+         if (was_visible)
            gtk_widget_queue_resize (GTK_WIDGET (container));
 
          break;
index efb3e9770ceb0bfeb617d2359a2a9ef5b290a985..e7afdfa39011c12f95d3bb547046f6c645950147 100644 (file)
@@ -553,7 +553,10 @@ gtk_menu_shell_remove (GtkContainer *container,
   
   gtk_widget_unparent (widget);
   
-  if (was_visible && GTK_WIDGET_VISIBLE (container))
+  /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
+   * since that's what is needed by toplevels.
+   */
+  if (was_visible)
     gtk_widget_queue_resize (GTK_WIDGET (container));
 }
 
index 1cdf74546dae8fe63c176d31f57174dc30d1f700..a43fbba834add9a4fc413a82d8b3ab7cb3e08244 100644 (file)
@@ -825,7 +825,8 @@ gtk_widget_set_arg (GtkWidget       *widget,
       gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
       break;
     case ARG_EVENTS:
-      gtk_widget_set_events (widget, GTK_VALUE_FLAGS (*arg));
+      if (!GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_NO_WINDOW (widget))
+       gtk_widget_set_events (widget, GTK_VALUE_FLAGS (*arg));
       break;
     case ARG_EXTENSION_EVENTS:
       gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS (*arg));
index 08c66781fbb34bbfa202e0987627e21d537939e6..b2b40e49addc1db3eea36e5542bc52efa78e45ae 100644 (file)
@@ -991,10 +991,16 @@ gtk_window_move_resize (GtkWindow *window)
   width = widget->requisition.width;
   height = widget->requisition.height;
   gtk_widget_size_request (widget, &widget->requisition);
-  
+
   if ((width != widget->requisition.width ||
        height != widget->requisition.height))
-    gtk_window_set_hints (widget, &widget->requisition);
+    {
+      gboolean saved_use_upos;
+
+      saved_use_upos = window->use_uposition;
+      gtk_window_set_hints (widget, &widget->requisition);
+      window->use_uposition = saved_use_upos;
+    }
   
   x = -1;
   y = -1;