Commit c1a14d03 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not

Wed Jul  4 22:35:40 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
	  gtk/gtkwidget.c:
	Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
	not GTK_WIDGET_GET_ANCESTOR ... see
	http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
	Indicate the best practice in the docs for gtk_widget_get_toplevel().

	* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
	so GtkPlug can give the correct signals when transforming
	from a child to a toplevel.

	* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
	reparentation correctly.

	* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
	Propagate the previous_toplevel argument down properly.

	* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
	of wrong atr list.

	* gtk/gtkplug.[ch]: Add an "embedded" signal.

	* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
	signals.

	* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
	functions gtk_plug_get_id(), gtk_socket_get_id(),
	to avoid the user having to worry about realization,
	and gdkx.h.

	* tests/testsocket.c: Extend to try out the new signals
	and gtk_plug/socket_get_id().

	* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
	setting of underline attributes.

	* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
	DestroyNotify events from SubstructureNotifyMask

	* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
	Switch GDK_WINDOW_TYPE (window) as needed.

	* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
	allow creation of toplevel windows as children of
	foreign windows.

	* gtk/gtkplug.c: Remove hacks involving changing private
	fields of GdkWindow.

	* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
	exactly the same signals and notification
	be emitted for local embedding as for inter-process
	embedding.
parent 3da3e776
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c
gtk/gtkwidget.c:
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)),
not GTK_WIDGET_GET_ANCESTOR ... see
http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html.
Indicate the best practice in the docs for gtk_widget_get_toplevel().
* gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(),
so GtkPlug can give the correct signals when transforming
from a child to a toplevel.
* gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle
reparentation correctly.
* gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed):
Propagate the previous_toplevel argument down properly.
* gtk/gtklabel.c (gtk_label_finalize): Fix unrefing
of wrong atr list.
* gtk/gtkplug.[ch]: Add an "embedded" signal.
* gtk/gtksocket.[ch]: Add "child_added", "child_removed"
signals.
* gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add
functions gtk_plug_get_id(), gtk_socket_get_id(),
to avoid the user having to worry about realization,
and gdkx.h.
* tests/testsocket.c: Extend to try out the new signals
and gtk_plug/socket_get_id().
* gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix
setting of underline attributes.
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore
DestroyNotify events from SubstructureNotifyMask
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
Switch GDK_WINDOW_TYPE (window) as needed.
* gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up,
allow creation of toplevel windows as children of
foreign windows.
* gtk/gtkplug.c: Remove hacks involving changing private
fields of GdkWindow.
* gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make
exactly the same signals and notification
be emitted for local embedding as for inter-process
embedding.
2001-07-04 James Henstridge <james@daa.com.au> 2001-07-04 James Henstridge <james@daa.com.au>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype. * gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
...@@ -1216,14 +1216,20 @@ gdk_event_translate (GdkEvent *event, ...@@ -1216,14 +1216,20 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("destroy notify:\twindow: %ld", g_message ("destroy notify:\twindow: %ld",
xevent->xdestroywindow.window)); xevent->xdestroywindow.window));
event->any.type = GDK_DESTROY; /* Ignore DestroyNotify from SubstructureNotifyMask */
event->any.window = window; if (xevent->xdestroywindow.window == xevent->xdestroywindow.event)
{
return_val = window_private && !GDK_WINDOW_DESTROYED (window); event->any.type = GDK_DESTROY;
event->any.window = window;
if (window && GDK_WINDOW_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window); return_val = window_private && !GDK_WINDOW_DESTROYED (window);
if (window && GDK_WINDOW_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window);
}
else
return_val = FALSE;
break; break;
case UnmapNotify: case UnmapNotify:
......
...@@ -403,6 +403,26 @@ gdk_window_new (GdkWindow *parent, ...@@ -403,6 +403,26 @@ gdk_window_new (GdkWindow *parent,
xattributes_mask |= CWWinGravity; xattributes_mask |= CWWinGravity;
} }
/* Sanity checks */
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
if (GDK_WINDOW_TYPE (parent) != GDK_WINDOW_ROOT &&
GDK_WINDOW_TYPE (parent) != GDK_WINDOW_FOREIGN)
{
g_warning (G_STRLOC "Toplevel windows must be created as children of\n"
"of a window of type GDK_WINDOW_ROOT or GDK_WINDOW_FOREIGN");
xparent = gdk_root_window;
}
case GDK_WINDOW_CHILD:
break;
default:
g_warning (G_STRLOC "cannot make windows of type %d", private->window_type);
return NULL;
}
if (attributes->wclass == GDK_INPUT_OUTPUT) if (attributes->wclass == GDK_INPUT_OUTPUT)
{ {
class = InputOutput; class = InputOutput;
...@@ -445,42 +465,16 @@ gdk_window_new (GdkWindow *parent, ...@@ -445,42 +465,16 @@ gdk_window_new (GdkWindow *parent,
xattributes.bit_gravity = NorthWestGravity; xattributes.bit_gravity = NorthWestGravity;
xattributes_mask |= CWBitGravity; xattributes_mask |= CWBitGravity;
switch (private->window_type) xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
if (private->window_type == GDK_WINDOW_TEMP)
{ {
case GDK_WINDOW_TOPLEVEL:
xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
break;
case GDK_WINDOW_CHILD:
xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
break;
case GDK_WINDOW_DIALOG:
xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
break;
case GDK_WINDOW_TEMP:
xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
xattributes.save_under = True; xattributes.save_under = True;
xattributes.override_redirect = True; xattributes.override_redirect = True;
xattributes.cursor = None; xattributes.cursor = None;
xattributes_mask |= CWSaveUnder | CWOverrideRedirect; xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
break;
case GDK_WINDOW_ROOT:
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
break;
} }
} }
else else
...@@ -1040,6 +1034,7 @@ gdk_window_reparent (GdkWindow *window, ...@@ -1040,6 +1034,7 @@ gdk_window_reparent (GdkWindow *window,
g_return_if_fail (window != NULL); g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent)); g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
if (!new_parent) if (!new_parent)
new_parent = gdk_parent_root; new_parent = gdk_parent_root;
...@@ -1055,7 +1050,37 @@ gdk_window_reparent (GdkWindow *window, ...@@ -1055,7 +1050,37 @@ gdk_window_reparent (GdkWindow *window,
x, y); x, y);
window_private->parent = (GdkWindowObject *)new_parent; window_private->parent = (GdkWindowObject *)new_parent;
/* Switch the window type as appropriate */
switch (GDK_WINDOW_TYPE (new_parent))
{
case GDK_WINDOW_ROOT:
case GDK_WINDOW_FOREIGN:
/* Now a toplevel */
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
{
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
XSetWMProtocols (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
gdk_wm_window_protocols, 3);
}
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
{
/* If we were being sophisticated, we'd save the old window type
* here, and restore it if we were reparented back to the
* toplevel. However, the difference between different types
* of toplevels only really matters on creation anyways.
*/
GDK_WINDOW_TYPE (window) = GDK_WINDOW_CHILD;
}
}
if (old_parent_private) if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window); old_parent_private->children = g_list_remove (old_parent_private->children, window);
......
...@@ -197,30 +197,32 @@ static gboolean gtk_drag_highlight_expose (GtkWidget *widget, ...@@ -197,30 +197,32 @@ static gboolean gtk_drag_highlight_expose (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
gpointer data); gpointer data);
static void gtk_drag_selection_received (GtkWidget *widget, static void gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
guint32 time, guint32 time,
gpointer data); gpointer data);
static void gtk_drag_find_widget (GtkWidget *widget, static void gtk_drag_find_widget (GtkWidget *widget,
GtkDragFindData *data); GtkDragFindData *data);
static void gtk_drag_proxy_begin (GtkWidget *widget, static void gtk_drag_proxy_begin (GtkWidget *widget,
GtkDragDestInfo *dest_info, GtkDragDestInfo *dest_info,
guint32 time); guint32 time);
static void gtk_drag_dest_realized (GtkWidget *widget); static void gtk_drag_dest_realized (GtkWidget *widget);
static void gtk_drag_dest_site_destroy (gpointer data); static void gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
static void gtk_drag_dest_leave (GtkWidget *widget, GtkWidget *old_toplevel);
GdkDragContext *context, static void gtk_drag_dest_site_destroy (gpointer data);
guint time); static void gtk_drag_dest_leave (GtkWidget *widget,
static gboolean gtk_drag_dest_motion (GtkWidget *widget, GdkDragContext *context,
GdkDragContext *context, guint time);
gint x, static gboolean gtk_drag_dest_motion (GtkWidget *widget,
gint y, GdkDragContext *context,
guint time); gint x,
static gboolean gtk_drag_dest_drop (GtkWidget *widget, gint y,
GdkDragContext *context, guint time);
gint x, static gboolean gtk_drag_dest_drop (GtkWidget *widget,
gint y, GdkDragContext *context,
guint time); gint x,
gint y,
guint time);
static GtkDragDestInfo * gtk_drag_get_dest_info (GdkDragContext *context, static GtkDragDestInfo * gtk_drag_get_dest_info (GdkDragContext *context,
gboolean create); gboolean create);
...@@ -812,6 +814,8 @@ gtk_drag_dest_set_internal (GtkWidget *widget, ...@@ -812,6 +814,8 @@ gtk_drag_dest_set_internal (GtkWidget *widget,