mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Handle NO_WINDOW widgets with windows that are children of widget->window.
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW widgets with windows that are children of widget->window. (#50279) * tests/testgtk.c: Add eventboxes to the example so that we are reparenting between different GdkWindows.
This commit is contained in:
parent
809a11fea0
commit
76cf3d95f6
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Mar 2 20:58:30 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkwidget.c (gtk_widget_reparent): Handle NO_WINDOW
|
||||||
|
widgets with windows that are children of widget->window.
|
||||||
|
(#50279)
|
||||||
|
|
||||||
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
Sat Mar 2 20:39:38 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_from_stock):
|
||||||
|
@ -196,8 +196,6 @@ static gboolean gtk_widget_real_focus_out_event (GtkWidget *widget,
|
|||||||
static gboolean gtk_widget_real_focus (GtkWidget *widget,
|
static gboolean gtk_widget_real_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
|
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
|
||||||
static void gtk_widget_reparent_container_child (GtkWidget *widget,
|
|
||||||
gpointer client_data);
|
|
||||||
static void gtk_widget_propagate_state (GtkWidget *widget,
|
static void gtk_widget_propagate_state (GtkWidget *widget,
|
||||||
GtkStateData *data);
|
GtkStateData *data);
|
||||||
static void gtk_widget_reset_rc_style (GtkWidget *widget);
|
static void gtk_widget_reset_rc_style (GtkWidget *widget);
|
||||||
@ -3146,17 +3144,36 @@ gtk_widget_set_scroll_adjustments (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************
|
static void
|
||||||
* gtk_widget_reparent_container_child:
|
gtk_widget_reparent_subwindows (GtkWidget *widget,
|
||||||
* assistent function to gtk_widget_reparent
|
GdkWindow *new_window)
|
||||||
*
|
{
|
||||||
* arguments:
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
||||||
*
|
{
|
||||||
* results:
|
GList *children = gdk_window_get_children (widget->window);
|
||||||
*****************************************/
|
GList *tmp_list;
|
||||||
|
|
||||||
|
for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
|
||||||
|
{
|
||||||
|
GtkWidget *child;
|
||||||
|
GdkWindow *window = tmp_list->data;
|
||||||
|
|
||||||
|
gdk_window_get_user_data (window, (void **)&child);
|
||||||
|
while (child && child != widget)
|
||||||
|
child = child->parent;
|
||||||
|
|
||||||
|
if (child)
|
||||||
|
gdk_window_reparent (window, new_window, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free (children);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gdk_window_reparent (widget->window, new_window, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_widget_reparent_container_child (GtkWidget *widget,
|
gtk_widget_reparent_fixup_child (GtkWidget *widget,
|
||||||
gpointer client_data)
|
gpointer client_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (client_data != NULL);
|
g_return_if_fail (client_data != NULL);
|
||||||
@ -3171,12 +3188,9 @@ gtk_widget_reparent_container_child (GtkWidget *widget,
|
|||||||
|
|
||||||
if (GTK_IS_CONTAINER (widget))
|
if (GTK_IS_CONTAINER (widget))
|
||||||
gtk_container_forall (GTK_CONTAINER (widget),
|
gtk_container_forall (GTK_CONTAINER (widget),
|
||||||
gtk_widget_reparent_container_child,
|
gtk_widget_reparent_fixup_child,
|
||||||
client_data);
|
client_data);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
gdk_window_reparent (widget->window,
|
|
||||||
(GdkWindow*) client_data, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3214,7 +3228,8 @@ gtk_widget_reparent (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GTK_PRIVATE_UNSET_FLAG (widget, GTK_IN_REPARENT);
|
GTK_PRIVATE_UNSET_FLAG (widget, GTK_IN_REPARENT);
|
||||||
|
|
||||||
gtk_widget_reparent_container_child (widget,
|
gtk_widget_reparent_subwindows (widget, gtk_widget_get_parent_window (widget));
|
||||||
|
gtk_widget_reparent_fixup_child (widget,
|
||||||
gtk_widget_get_parent_window (widget));
|
gtk_widget_get_parent_window (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2469,6 +2469,7 @@ create_reparent (void)
|
|||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *separator;
|
GtkWidget *separator;
|
||||||
|
GtkWidget *event_box;
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@ -2498,18 +2499,23 @@ create_reparent (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (frame), box3);
|
gtk_container_add (GTK_CONTAINER (frame), box3);
|
||||||
|
|
||||||
button = gtk_button_new_with_label ("switch");
|
button = gtk_button_new_with_label ("switch");
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
|
||||||
GTK_SIGNAL_FUNC(reparent_label),
|
|
||||||
box3);
|
|
||||||
gtk_object_set_user_data (GTK_OBJECT (button), label);
|
gtk_object_set_user_data (GTK_OBJECT (button), label);
|
||||||
gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (box3), label, FALSE, TRUE, 0);
|
event_box = gtk_event_box_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (box3), event_box, FALSE, TRUE, 0);
|
||||||
|
gtk_container_add (GTK_CONTAINER (event_box), label);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(reparent_label),
|
||||||
|
event_box);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (label),
|
gtk_signal_connect (GTK_OBJECT (label),
|
||||||
"parent_set",
|
"parent_set",
|
||||||
GTK_SIGNAL_FUNC (set_parent_signal),
|
GTK_SIGNAL_FUNC (set_parent_signal),
|
||||||
GINT_TO_POINTER (42));
|
GINT_TO_POINTER (42));
|
||||||
|
|
||||||
|
|
||||||
frame = gtk_frame_new ("Frame 2");
|
frame = gtk_frame_new ("Frame 2");
|
||||||
gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
@ -2518,12 +2524,16 @@ create_reparent (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (frame), box3);
|
gtk_container_add (GTK_CONTAINER (frame), box3);
|
||||||
|
|
||||||
button = gtk_button_new_with_label ("switch");
|
button = gtk_button_new_with_label ("switch");
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
|
||||||
GTK_SIGNAL_FUNC(reparent_label),
|
|
||||||
box3);
|
|
||||||
gtk_object_set_user_data (GTK_OBJECT (button), label);
|
gtk_object_set_user_data (GTK_OBJECT (button), label);
|
||||||
gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
|
||||||
|
|
||||||
|
event_box = gtk_event_box_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (box3), event_box, FALSE, TRUE, 0);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(reparent_label),
|
||||||
|
event_box);
|
||||||
|
|
||||||
separator = gtk_hseparator_new ();
|
separator = gtk_hseparator_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user