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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* gtk/gtkliststore.h: add missing gtk_list_store_newv prototype.
......
......@@ -1216,14 +1216,20 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS,
g_message ("destroy notify:\twindow: %ld",
xevent->xdestroywindow.window));
event->any.type = GDK_DESTROY;
event->any.window = window;
return_val = window_private && !GDK_WINDOW_DESTROYED (window);
if (window && GDK_WINDOW_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window);
/* Ignore DestroyNotify from SubstructureNotifyMask */
if (xevent->xdestroywindow.window == xevent->xdestroywindow.event)
{
event->any.type = GDK_DESTROY;
event->any.window = 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;
case UnmapNotify:
......
......@@ -403,6 +403,26 @@ gdk_window_new (GdkWindow *parent,
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)
{
class = InputOutput;
......@@ -445,42 +465,16 @@ gdk_window_new (GdkWindow *parent,
xattributes.bit_gravity = NorthWestGravity;
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.override_redirect = True;
xattributes.cursor = None;
xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
break;
case GDK_WINDOW_ROOT:
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
break;
}
}
else
......@@ -1040,6 +1034,7 @@ gdk_window_reparent (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
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)
new_parent = gdk_parent_root;
......@@ -1055,7 +1050,37 @@ gdk_window_reparent (GdkWindow *window,
x, y);
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)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
......
......@@ -197,30 +197,32 @@ static gboolean gtk_drag_highlight_expose (GtkWidget *widget,
GdkEventExpose *event,
gpointer data);
static void gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint32 time,
gpointer data);
static void gtk_drag_find_widget (GtkWidget *widget,
GtkDragFindData *data);
static void gtk_drag_proxy_begin (GtkWidget *widget,
GtkDragDestInfo *dest_info,
guint32 time);
static void gtk_drag_dest_realized (GtkWidget *widget);
static void gtk_drag_dest_site_destroy (gpointer data);
static void gtk_drag_dest_leave (GtkWidget *widget,
GdkDragContext *context,
guint time);
static gboolean gtk_drag_dest_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static gboolean gtk_drag_dest_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static void gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint32 time,
gpointer data);
static void gtk_drag_find_widget (GtkWidget *widget,
GtkDragFindData *data);
static void gtk_drag_proxy_begin (GtkWidget *widget,
GtkDragDestInfo *dest_info,
guint32 time);
static void gtk_drag_dest_realized (GtkWidget *widget);
static void gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_drag_dest_site_destroy (gpointer data);
static void gtk_drag_dest_leave (GtkWidget *widget,
GdkDragContext *context,
guint time);
static gboolean gtk_drag_dest_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static gboolean gtk_drag_dest_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static GtkDragDestInfo * gtk_drag_get_dest_info (GdkDragContext *context,
gboolean create);
......@@ -812,6 +814,8 @@ gtk_drag_dest_set_internal (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (widget), "realize",
GTK_SIGNAL_FUNC (gtk_drag_dest_realized), site);
gtk_signal_connect (GTK_OBJECT (widget), "hierarchy_changed",
GTK_SIGNAL_FUNC (gtk_drag_dest_hierarchy_changed), site);
gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
site, gtk_drag_dest_site_destroy);
......@@ -1428,7 +1432,18 @@ static void
gtk_drag_dest_realized (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
gdk_window_register_dnd (toplevel->window);
if (GTK_WIDGET_TOPLEVEL (toplevel))
gdk_window_register_dnd (toplevel->window);
}
static void
gtk_drag_dest_hierarchy_changed (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_WIDGET_REALIZED (toplevel))
gdk_window_register_dnd (toplevel->window);
}
static void
......
......@@ -2030,7 +2030,7 @@ gtk_entry_real_activate (GtkEntry *entry)
if (entry->activates_default)
{
toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (toplevel))
if (GTK_IS_WINDOW (toplevel))
{
window = GTK_WINDOW (toplevel);
......
......@@ -492,8 +492,7 @@ gtk_label_setup_mnemonic (GtkLabel *label,
return;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (label));
if (GTK_IS_WINDOW (toplevel))
if (GTK_WIDGET_TOPLEVEL (toplevel))
{
gtk_window_add_mnemonic (GTK_WINDOW (toplevel),
label->mnemonic_keyval,
......@@ -953,7 +952,10 @@ gtk_label_set_pattern_internal (GtkLabel *label,
g_return_if_fail (GTK_IS_LABEL (label));
attrs = gtk_label_pattern_to_attrs (label, pattern);
gtk_label_set_attributes_internal (label, attrs);
if (label->effective_attrs)
pango_attr_list_unref (label->effective_attrs);
label->effective_attrs = attrs;
}
void
......@@ -1092,7 +1094,7 @@ gtk_label_finalize (GObject *object)
pango_attr_list_unref (label->attrs);
if (label->effective_attrs)
pango_attr_list_unref (label->attrs);
pango_attr_list_unref (label->effective_attrs);
g_free (label->select_info);
......
......@@ -483,10 +483,10 @@ gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
toplevel = gtk_widget_get_toplevel (widget);
if (old_toplevel && GTK_IS_WINDOW (old_toplevel))
if (old_toplevel)
remove_from_window (old_toplevel, menubar);
if (toplevel && GTK_IS_WINDOW (toplevel))
if (GTK_WIDGET_TOPLEVEL (toplevel))
add_to_window (GTK_WINDOW (toplevel), menubar);
}
......
......@@ -26,6 +26,7 @@
*/
#include "gtkmain.h"
#include "gtkmarshal.h"
#include "gtkplug.h"
#include "gtkprivate.h"
......@@ -75,6 +76,13 @@ static void xembed_set_info (GdkWindow *window,
static GtkWindowClass *parent_class = NULL;
static GtkBinClass *bin_class = NULL;
enum {
EMBEDDED,
LAST_SIGNAL
};
static guint plug_signals[LAST_SIGNAL] = { 0 };
GtkType
gtk_plug_get_type ()
{
......@@ -129,6 +137,15 @@ gtk_plug_class_init (GtkPlugClass *class)
#if 0
window_class->accel_entries_changed = gtk_plug_accel_entries_changed;
#endif
plug_signals[EMBEDDED] =
g_signal_new ("embedded",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkPlugClass, embedded),
NULL, NULL,
gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
}
static void
......@@ -146,11 +163,34 @@ static void
gtk_plug_set_is_child (GtkPlug *plug,
gboolean is_child)
{
g_assert (!GTK_WIDGET (plug)->parent);
if (is_child)
{
if (plug->modality_window)
handle_modality_off (plug);
if (plug->modality_group)
{
gtk_window_group_remove_window (plug->modality_group, GTK_WINDOW (plug));
g_object_unref (plug->modality_group);
plug->modality_group = NULL;
}