GNOME Bugzilla – Bug 167259
reparenting of GtkEntry and GtkSpinButton breaks
Last modified: 2011-02-04 16:17:33 UTC
Reparenting a GtkEntry into a hidden container will still show the entry, in a wrong place. Steps to reproduce: 0) Compile & run attached testcase 1) Click "Reparent to popup" button 2) Click "Reparent from popup" button 3) Toggle "Show entry box" button off 4) Repeat 1) and 2) Expected results: After step 4, the entry is hidden since it's inside a hidden box. Actual results: After step 4, the entry shows at the upper left corner of the window. If I toggle the "Show entry box" button on again, it moves to its correct place. If I replace the GtkEntry with a GtkSpinButton (commented out in the testcase code), it will lose its spin arrows after step 2, and also show its entry after step 4. Hiding and showing it will not give me the arrows back. This may have something to do with bug 50279, but that was supposedly fixed a long time ago...
Created attachment 37429 [details] testcase.c
If I use a GtkFrame as the entry's container, it still breaks. However, if I use a GtkEventBox, it works as expected.
Created attachment 37734 [details] [review] a patch Here is a patch which fixes the problem of the spinbutton loosing its arrows. It doesn't fix the problem when reparenting into a hidden box.
2005-02-24 Matthias Clasen <mclasen@redhat.com> Fix #167259, reported by Christian Persch: * gtk/gtkwidget.c (gtk_widget_unparent): Unmap the reparented widget, even if we avoid the unrealizing. (gtk_widget_reparent_subwindows): Make reparenting work for !NO_WINDOW widgets which have other windows which are siblings of widget->window (as e.g. GtkSpinButton).