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
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
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
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
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
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
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
gtkbutton.c \
gtkcheckbutton.c \
gtkcheckmenuitem.c \
+ gtkclist.c \
gtkcolorsel.c \
+ gtkcombobox.c \
gtkcontainer.c \
gtkcurve.c \
gtkdata.c \
gtkframe.c \
gtkgamma.c \
gtkgc.c \
- gtkhandlebox.c \
+ gtkhandlebox.c \
gtkhbbox.c \
gtkhbox.c \
gtkhpaned.c \
gtkbutton.h \
gtkcheckbutton.h \
gtkcheckmenuitem.h \
+ gtkclist.h \
gtkcolorsel.h \
+ gtkcombobox.h \
gtkcontainer.h \
gtkcurve.h \
gtkdata.h \
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
.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 \
#include "gtkhandlebox.h"
#include "gtkmain.h"
#include "gtksignal.h"
+#include "gtkwindow.h"
#define DRAG_HANDLE_SIZE 10
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;
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;
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;
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;
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
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
}
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);
}
}
-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)
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,
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,
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;
+}
{
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;
create_handle_box ()
{
static GtkWidget* window = NULL;
- GtkWidget* hbox;
-#if 0
- GtkWidget* button;
-#endif
+ GtkWidget *hbox;
+ GtkWidget *toolbar;
if (!window)
{
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))
create_handle_box ()
{
static GtkWidget* window = NULL;
- GtkWidget* hbox;
-#if 0
- GtkWidget* button;
-#endif
+ GtkWidget *hbox;
+ GtkWidget *toolbar;
if (!window)
{
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))