]> Pileus Git - ~andy/gtk/commitdiff
Now we use a GtkWindow of type GTK_WINDOW_DIALOG as a destination for
authorFederico Mena <federico@bananoid.nuclecu.unam.mx>
Fri, 16 Jan 1998 23:43:10 +0000 (23:43 +0000)
committerArturo Espinosa <unammx@src.gnome.org>
Fri, 16 Jan 1998 23:43:10 +0000 (23:43 +0000)
Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>

* gtk/gtkhandlebox.c: Now we use a GtkWindow of type
GTK_WINDOW_DIALOG as a destination for reparenting the child of
the handle box.  This solves the problem of having X calls in
Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
I expect mwm to work as well).  I hadn't noticed that previously
it only worked with fvwm and twm.

* gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
real_parent field, as it is never used.
(struct _GtkHandleBox): Added a float_window field.  This is a
GtkWindow to where the child is now reparented.

12 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
gtk/Makefile.in
gtk/gtkhandlebox.c
gtk/gtkhandlebox.h
gtk/testgtk.c
tests/testgtk.c

index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 05f15f2aabad874acc5fbc9c005f5546f499887e..388a3c86b1ea04f85df290890bb9f17914824560 100644 (file)
@@ -1,5 +1,17 @@
 Fri Jan 16 00:36:31 1998  Federico Mena  <federico@bananoid.nuclecu.unam.mx>
 
+       * gtk/gtkhandlebox.c: Now we use a GtkWindow of type
+       GTK_WINDOW_DIALOG as a destination for reparenting the child of
+       the handle box.  This solves the problem of having X calls in
+       Gtk.  It also makes the handle box work with KWM, OLVWM, 4Dwm (so
+       I expect mwm to work as well).  I hadn't noticed that previously
+       it only worked with fvwm and twm.
+
+       * gtk/gtkhandlebox.h (struct _GtkHandleBox): Removed the
+       real_parent field, as it is never used.
+       (struct _GtkHandleBox): Added a float_window field.  This is a
+       GtkWindow to where the child is now reparented.
+
        * gtk/gtkhandlebox.c: Lots of changes all over the place.  Now the
        widget has two windows.  The steady_window stays put in the parent
        container, and the widget->window is the one that gets
index 9a537b9ff9b605b68412ebcb1b1a0e242466439b..8c90842144421a16b143d8181101845ac0f1ebfa 100644 (file)
@@ -90,7 +90,9 @@ libgtk_la_SOURCES = \
        gtkbutton.c             \
        gtkcheckbutton.c        \
        gtkcheckmenuitem.c      \
+       gtkclist.c              \
        gtkcolorsel.c           \
+       gtkcombobox.c           \
        gtkcontainer.c          \
        gtkcurve.c              \
        gtkdata.c               \
@@ -103,7 +105,7 @@ libgtk_la_SOURCES = \
        gtkframe.c              \
        gtkgamma.c              \
        gtkgc.c                 \
-       gtkhandlebox.c          \
+       gtkhandlebox.c          \
        gtkhbbox.c              \
        gtkhbox.c               \
        gtkhpaned.c             \
@@ -177,7 +179,9 @@ gtkinclude_HEADERS = \
        gtkbutton.h             \
        gtkcheckbutton.h        \
        gtkcheckmenuitem.h      \
+       gtkclist.h              \
        gtkcolorsel.h           \
+       gtkcombobox.h           \
        gtkcontainer.h          \
        gtkcurve.h              \
        gtkdata.h               \
@@ -342,21 +346,22 @@ libgtk_la_LIBADD =
 libgtk_la_OBJECTS =  gtkaccelerator.lo gtkadjustment.lo \
 gtkaspectframe.lo gtkalignment.lo gtkarrow.lo gtkbin.lo gtkbbox.lo \
 gtkbox.lo gtkbutton.lo gtkcheckbutton.lo gtkcheckmenuitem.lo \
-gtkcolorsel.lo gtkcontainer.lo gtkcurve.lo gtkdata.lo gtkdialog.lo \
-gtkdrawingarea.lo gtkentry.lo gtkeventbox.lo gtkfilesel.lo gtkfixed.lo \
-gtkframe.lo gtkgamma.lo gtkgc.lo gtkhandlebox.lo gtkhbbox.lo gtkhbox.lo \
-gtkhpaned.lo gtkhruler.lo gtkhscale.lo gtkhscrollbar.lo \
-gtkhseparator.lo gtkimage.lo gtkinputdialog.lo gtkitem.lo gtklabel.lo \
-gtklist.lo gtklistitem.lo gtkmain.lo gtkmenu.lo gtkmenubar.lo \
-gtkmenufactory.lo gtkmenuitem.lo gtkmenushell.lo gtkmisc.lo \
-gtknotebook.lo gtkobject.lo gtkoptionmenu.lo gtkpaned.lo gtkpixmap.lo \
-gtkpreview.lo gtkprogressbar.lo gtkradiobutton.lo gtkradiomenuitem.lo \
-gtkrange.lo gtkrc.lo gtkruler.lo gtkscale.lo gtkscrollbar.lo \
-gtkscrolledwindow.lo gtkselection.lo gtkseparator.lo gtksignal.lo \
-gtkstyle.lo gtktable.lo gtktext.lo gtktogglebutton.lo gtktoolbar.lo \
-gtktooltips.lo gtktree.lo gtktreeitem.lo gtktypeutils.lo gtkvbbox.lo \
-gtkvbox.lo gtkviewport.lo gtkvpaned.lo gtkvruler.lo gtkvscale.lo \
-gtkvscrollbar.lo gtkvseparator.lo gtkwidget.lo gtkwindow.lo fnmatch.lo
+gtkclist.lo gtkcolorsel.lo gtkcombobox.lo gtkcontainer.lo gtkcurve.lo \
+gtkdata.lo gtkdialog.lo gtkdrawingarea.lo gtkentry.lo gtkeventbox.lo \
+gtkfilesel.lo gtkfixed.lo gtkframe.lo gtkgamma.lo gtkgc.lo \
+gtkhandlebox.lo gtkhbbox.lo gtkhbox.lo gtkhpaned.lo gtkhruler.lo \
+gtkhscale.lo gtkhscrollbar.lo gtkhseparator.lo gtkimage.lo \
+gtkinputdialog.lo gtkitem.lo gtklabel.lo gtklist.lo gtklistitem.lo \
+gtkmain.lo gtkmenu.lo gtkmenubar.lo gtkmenufactory.lo gtkmenuitem.lo \
+gtkmenushell.lo gtkmisc.lo gtknotebook.lo gtkobject.lo gtkoptionmenu.lo \
+gtkpaned.lo gtkpixmap.lo gtkpreview.lo gtkprogressbar.lo \
+gtkradiobutton.lo gtkradiomenuitem.lo gtkrange.lo gtkrc.lo gtkruler.lo \
+gtkscale.lo gtkscrollbar.lo gtkscrolledwindow.lo gtkselection.lo \
+gtkseparator.lo gtksignal.lo gtkstyle.lo gtktable.lo gtktext.lo \
+gtktogglebutton.lo gtktoolbar.lo gtktooltips.lo gtktree.lo \
+gtktreeitem.lo gtktypeutils.lo gtkvbbox.lo gtkvbox.lo gtkviewport.lo \
+gtkvpaned.lo gtkvruler.lo gtkvscale.lo gtkvscrollbar.lo \
+gtkvseparator.lo gtkwidget.lo gtkwindow.lo fnmatch.lo
 PROGRAMS =  $(noinst_PROGRAMS)
 
 testgtk_SOURCES = testgtk.c
@@ -391,15 +396,15 @@ DEP_FILES =  .deps/fnmatch.P .deps/gtkaccelerator.P \
 .deps/gtkadjustment.P .deps/gtkalignment.P .deps/gtkarrow.P \
 .deps/gtkaspectframe.P .deps/gtkbbox.P .deps/gtkbin.P .deps/gtkbox.P \
 .deps/gtkbutton.P .deps/gtkcheckbutton.P .deps/gtkcheckmenuitem.P \
-.deps/gtkcolorsel.P .deps/gtkcontainer.P .deps/gtkcurve.P \
-.deps/gtkdata.P .deps/gtkdialog.P .deps/gtkdrawingarea.P \
-.deps/gtkentry.P .deps/gtkeventbox.P .deps/gtkfilesel.P \
-.deps/gtkfixed.P .deps/gtkframe.P .deps/gtkgamma.P .deps/gtkgc.P \
-.deps/gtkhandlebox.P .deps/gtkhbbox.P .deps/gtkhbox.P .deps/gtkhpaned.P \
-.deps/gtkhruler.P .deps/gtkhscale.P .deps/gtkhscrollbar.P \
-.deps/gtkhseparator.P .deps/gtkimage.P .deps/gtkinputdialog.P \
-.deps/gtkitem.P .deps/gtklabel.P .deps/gtklist.P .deps/gtklistitem.P \
-.deps/gtkmain.P .deps/gtkmenu.P .deps/gtkmenubar.P \
+.deps/gtkclist.P .deps/gtkcolorsel.P .deps/gtkcombobox.P \
+.deps/gtkcontainer.P .deps/gtkcurve.P .deps/gtkdata.P .deps/gtkdialog.P \
+.deps/gtkdrawingarea.P .deps/gtkentry.P .deps/gtkeventbox.P \
+.deps/gtkfilesel.P .deps/gtkfixed.P .deps/gtkframe.P .deps/gtkgamma.P \
+.deps/gtkgc.P .deps/gtkhandlebox.P .deps/gtkhbbox.P .deps/gtkhbox.P \
+.deps/gtkhpaned.P .deps/gtkhruler.P .deps/gtkhscale.P \
+.deps/gtkhscrollbar.P .deps/gtkhseparator.P .deps/gtkimage.P \
+.deps/gtkinputdialog.P .deps/gtkitem.P .deps/gtklabel.P .deps/gtklist.P \
+.deps/gtklistitem.P .deps/gtkmain.P .deps/gtkmenu.P .deps/gtkmenubar.P \
 .deps/gtkmenufactory.P .deps/gtkmenuitem.P .deps/gtkmenushell.P \
 .deps/gtkmisc.P .deps/gtknotebook.P .deps/gtkobject.P \
 .deps/gtkoptionmenu.P .deps/gtkpaned.P .deps/gtkpixmap.P \
index 0abf39c920969f6f996420b6f7e6de6e3ad6bd92..827203f4eb418dbe363278f27cf1fec125d9602b 100644 (file)
@@ -23,6 +23,7 @@
 #include "gtkhandlebox.h"
 #include "gtkmain.h"
 #include "gtksignal.h"
+#include "gtkwindow.h"
 
 
 #define DRAG_HANDLE_SIZE 10
@@ -48,14 +49,15 @@ static void gtk_handle_box_paint          (GtkWidget         *widget,
                                           GdkRectangle      *area);
 static void gtk_handle_box_draw           (GtkWidget         *widget,
                                           GdkRectangle      *area);
-static gint gtk_handle_box_delete         (GtkWidget         *widget,
-                                          GdkEventAny       *event);
 static gint gtk_handle_box_expose         (GtkWidget         *widget,
                                           GdkEventExpose    *event);
 static gint gtk_handle_box_button_changed (GtkWidget         *widget,
                                           GdkEventButton    *event);
 static gint gtk_handle_box_motion         (GtkWidget         *widget,
                                           GdkEventMotion    *event);
+static gint gtk_handle_box_delete_float   (GtkWidget         *widget,
+                                          GdkEvent          *event,
+                                          gpointer           data);
 
 
 static GtkBinClass *parent_class;
@@ -105,7 +107,6 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
   widget_class->size_request = gtk_handle_box_size_request;
   widget_class->size_allocate = gtk_handle_box_size_allocate;
   widget_class->draw = gtk_handle_box_draw;
-  widget_class->delete_event = gtk_handle_box_delete;
   widget_class->expose_event = gtk_handle_box_expose;
   widget_class->button_press_event = gtk_handle_box_button_changed;
   widget_class->button_release_event = gtk_handle_box_button_changed;
@@ -119,9 +120,9 @@ gtk_handle_box_init (GtkHandleBox *handle_box)
   GTK_WIDGET_SET_FLAGS (handle_box, GTK_BASIC); /* FIXME: are we really a basic widget? */
 
   handle_box->steady_window = NULL;
+  handle_box->float_window = NULL;
   handle_box->is_being_dragged = FALSE;
   handle_box->is_onroot = FALSE;
-  handle_box->real_parent = NULL;
   handle_box->fleur_cursor = gdk_cursor_new (GDK_FLEUR);
   handle_box->dragoff_x = 0;
   handle_box->dragoff_y = 0;
@@ -204,6 +205,19 @@ gtk_handle_box_realize (GtkWidget *widget)
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
+  /* FIXME: we need a property that would tell the window manager not
+   * to put decoration on this window.  This is not part of the ICCCM,
+   * so we'll have to define our own (a la KWM) and hack some window
+   * managers to support it.
+   */
+
+  hb->float_window = gtk_window_new (GTK_WINDOW_DIALOG);
+  gtk_window_set_policy (GTK_WINDOW (hb->float_window), FALSE, FALSE, FALSE);
+  gtk_container_border_width (GTK_CONTAINER (hb->float_window), 0);
+  gtk_signal_connect (GTK_OBJECT (hb->float_window), "delete_event",
+                     (GtkSignalFunc) gtk_handle_box_delete_float,
+                     hb);
+  
   attributes.x = widget->allocation.x;
   attributes.y = widget->allocation.y;
   attributes.width = widget->allocation.width;
@@ -256,6 +270,11 @@ gtk_handle_box_unrealize (GtkWidget *widget)
 
   hb->steady_window = NULL;
   widget->window = NULL;
+
+  /* FIXME: do we have to unref the float_window before destroying it? */
+
+  gtk_widget_destroy (hb->float_window);
+  hb->float_window = NULL;
 }
 
 static void
@@ -286,7 +305,7 @@ gtk_handle_box_size_request (GtkWidget      *widget,
   hb->real_requisition = *requisition;
   if (hb->is_onroot)
       requisition->height = GHOST_HEIGHT;
-  /* Should also set requisition->width to a small value? */
+  /* FIXME: Should also set requisition->width to a small value? */
 }
 
 static void
@@ -325,6 +344,9 @@ gtk_handle_box_size_allocate (GtkWidget     *widget,
        }
       else
        {
+         gtk_widget_set_usize (hb->float_window,
+                               hb->real_requisition.width,
+                               hb->real_requisition.height);
          gdk_window_resize (widget->window,
                             hb->real_requisition.width,
                             hb->real_requisition.height);
@@ -461,29 +483,6 @@ gtk_handle_box_draw (GtkWidget    *widget,
     }
 }
 
-static gint
-gtk_handle_box_delete (GtkWidget   *widget,
-                      GdkEventAny *event)
-{
-  GtkHandleBox *hb;
-  
-  g_return_val_if_fail (widget != NULL, FALSE);
-  g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  hb = GTK_HANDLE_BOX (widget);
-
-  if (event->window == widget->window)
-    {
-      hb->is_onroot = FALSE;
-      
-      gdk_window_reparent (widget->window, hb->steady_window, 0, 0);
-      gtk_widget_queue_resize (widget);
-    }
-
-  return FALSE;
-}
-
 static gint
 gtk_handle_box_expose (GtkWidget      *widget,
                       GdkEventExpose *event)
@@ -578,6 +577,8 @@ gtk_handle_box_motion (GtkWidget      *widget,
 
              gdk_window_reparent (widget->window, hb->steady_window, 0, 0);
 
+             gtk_widget_hide (hb->float_window);
+
              while (gdk_pointer_grab (widget->window,
                                       FALSE,
                                       GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
@@ -591,37 +592,19 @@ gtk_handle_box_motion (GtkWidget      *widget,
       else
        {
          if (hb->is_onroot)
-           gdk_window_move (widget->window, newx, newy);
+           {
+             gtk_widget_set_uposition (hb->float_window, newx, newy);
+             gdk_window_raise (hb->float_window->window);
+           }
          else
            {
              hb->is_onroot = TRUE;
 
              gdk_pointer_ungrab (GDK_CURRENT_TIME);
-             gdk_window_reparent (widget->window, GDK_ROOT_PARENT (), newx, newy);
-
-             /* We move the window explicitly because the window manager may
-              * have set the position itself, ignoring what we asked in the
-              * reparent call.
-              */
-             gdk_window_move (widget->window, newx, newy);
-
-             /* FIXME: are X calls Gtk-kosher? */
+             gtk_widget_show (hb->float_window);
+             gtk_widget_set_uposition (hb->float_window, newx, newy);
              
-             XSetTransientForHint (GDK_DISPLAY(),
-                                   GDK_WINDOW_XWINDOW (widget->window),
-                                   GDK_WINDOW_XWINDOW (gtk_widget_get_toplevel (widget)->window));
-
-             XSetWMProtocols (GDK_DISPLAY (),
-                              GDK_WINDOW_XWINDOW (widget->window),
-                              &gdk_wm_delete_window,
-                              1);
-
-             /* FIXME: we need a property that would tell the window
-              * manager not to put decoration on this window.  This
-              * is not part of the ICCCM, so we'll have to define our
-              * own (a la KWM) and hack some window managers to
-              * support it.
-              */
+             gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
 
              while (gdk_pointer_grab (widget->window,
                                       FALSE,
@@ -637,3 +620,26 @@ gtk_handle_box_motion (GtkWidget      *widget,
 
   return TRUE;
 }
+
+static gint
+gtk_handle_box_delete_float (GtkWidget *widget,
+                            GdkEvent  *event,
+                            gpointer   data)
+{
+  GtkHandleBox *hb;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (event != NULL);
+  g_return_if_fail (data != NULL);
+  g_return_if_fail (GTK_IS_HANDLE_BOX (data));
+
+  hb = GTK_HANDLE_BOX (data);
+
+  hb->is_onroot = FALSE;
+
+  gdk_window_reparent (GTK_WIDGET (hb)->window, hb->steady_window, 0, 0);
+  gtk_widget_hide (hb->float_window);
+  gtk_widget_queue_resize (GTK_WIDGET (hb));
+
+  return FALSE;
+}
index ac20a08222c08a6c42984bd8d72de9db6bb9e369..8c3ad7593cd66d3ab085c16fa42fe8fbd50ac42f 100644 (file)
@@ -47,8 +47,8 @@ struct _GtkHandleBox
 {
   GtkBin bin;
 
-  GtkWidget      *real_parent;
   GdkWindow      *steady_window; /* the window that stays in the parent container */
+  GtkWidget      *float_window;
   GtkRequisition  real_requisition;
   gboolean        is_being_dragged;
   gboolean        is_onroot;
index 0f7cc51ef609e0e223266b7761ae2a59c0222077..4d618ac866df242376382ff497ef241b100bb6c8 100644 (file)
@@ -795,10 +795,8 @@ void
 create_handle_box ()
 {
   static GtkWidget* window = NULL;
-  GtkWidget* hbox;
-#if 0
-  GtkWidget* button;
-#endif
+  GtkWidget *hbox;
+  GtkWidget *toolbar;
        
   if (!window)
   {
@@ -816,22 +814,10 @@ create_handle_box ()
     hbox = gtk_handle_box_new ();
     gtk_container_add (GTK_CONTAINER (window), hbox);
     gtk_widget_show (hbox);
-#if 0
-#if 0
-    button = gtk_toggle_button_new_with_label ("Let's try this");
-#else
-    button = gtk_label_new ("Let's try this");
-#endif
-    gtk_container_add (GTK_CONTAINER (hbox), button);
-    gtk_widget_set_usize(button, 250, 40);
-    gtk_widget_show (button);
-#else
-    {
-      GtkWidget *toolbar = make_toolbar (window);
-      gtk_container_add (GTK_CONTAINER (hbox), toolbar);
-      gtk_widget_show (toolbar);
-    }
-#endif
+
+    toolbar = make_toolbar (window);
+    gtk_container_add (GTK_CONTAINER (hbox), toolbar);
+    gtk_widget_show (toolbar);
   }
 
   if (!GTK_WIDGET_VISIBLE (window))
index 0f7cc51ef609e0e223266b7761ae2a59c0222077..4d618ac866df242376382ff497ef241b100bb6c8 100644 (file)
@@ -795,10 +795,8 @@ void
 create_handle_box ()
 {
   static GtkWidget* window = NULL;
-  GtkWidget* hbox;
-#if 0
-  GtkWidget* button;
-#endif
+  GtkWidget *hbox;
+  GtkWidget *toolbar;
        
   if (!window)
   {
@@ -816,22 +814,10 @@ create_handle_box ()
     hbox = gtk_handle_box_new ();
     gtk_container_add (GTK_CONTAINER (window), hbox);
     gtk_widget_show (hbox);
-#if 0
-#if 0
-    button = gtk_toggle_button_new_with_label ("Let's try this");
-#else
-    button = gtk_label_new ("Let's try this");
-#endif
-    gtk_container_add (GTK_CONTAINER (hbox), button);
-    gtk_widget_set_usize(button, 250, 40);
-    gtk_widget_show (button);
-#else
-    {
-      GtkWidget *toolbar = make_toolbar (window);
-      gtk_container_add (GTK_CONTAINER (hbox), toolbar);
-      gtk_widget_show (toolbar);
-    }
-#endif
+
+    toolbar = make_toolbar (window);
+    gtk_container_add (GTK_CONTAINER (hbox), toolbar);
+    gtk_widget_show (toolbar);
   }
 
   if (!GTK_WIDGET_VISIBLE (window))