After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776937 - GtkExpander is incorrectly hiding content.
GtkExpander is incorrectly hiding content.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
gtk-bugs
: 776322 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-01-06 10:45 UTC by Mikkel Kruse Johnsen
Modified: 2017-08-24 20:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Expander: Actually hide child when collapsing (934 bytes, patch)
2017-08-24 10:37 UTC, Daniel Boles
none Details | Review
Expander: Actually hide child when collapsing (1.12 KB, patch)
2017-08-24 11:55 UTC, Daniel Boles
none Details | Review
Expander: Actually hide child when collapsing (2.19 KB, patch)
2017-08-24 20:09 UTC, Daniel Boles
committed Details | Review

Description Mikkel Kruse Johnsen 2017-01-06 10:45:18 UTC
When hiding the content it is hidden, but you are still able to edit the content.

Make an expander with an Entry and unexpand the Expander. You are still able to edit the Entry.

Se Expander demo in gtk3-demo. Try to unexpand the text box (The box is not editable), but you can see the cursor is changed to a text cursor, when hovering just below the expander.

Gtk+ 3.20.9 on Fedora 24
Comment 1 Mikkel Kruse Johnsen 2017-02-07 11:02:05 UTC
This also happens on Gtk+ 3.22.6 on Fedora 25
Comment 2 Vendula Poncova 2017-04-25 08:44:01 UTC
We have the same problem with GTK 3.22.12 on Fedora 26. When the expander is collapsed, its content is invisible, but still clickable and the cursor reacts to its presence.

As a workaround, we manually set the visibility of the content in a callback that is connected to the activate signal.
Comment 3 Daniel Boles 2017-08-24 10:20:29 UTC
also confirmed with 3.22.16 on Windows, of all places

see also bug 774134, which although opened for a seemingly different issue, around the middle became a discussion of this one

*** This bug has been marked as a duplicate of bug 774134 ***
Comment 4 Daniel Boles 2017-08-24 10:20:49 UTC
sorry, got my bugs/statuses mixed up
Comment 5 Daniel Boles 2017-08-24 10:37:27 UTC
Created attachment 358316 [details] [review]
Expander: Actually hide child when collapsing

    Just adding/removing it to/from the gadget is not sufficient; that
    leaves the GdkWindow hanging around, taking input, changing the
    cursor, and all sorts of other nefarious shenanigans.

--

This seems to be the simplest solution, and to work here.

Please apply and test with your own cases, and let me know whether it (A) fixes the reported problems and (B) doesn't somehow break anything else.
Comment 6 Daniel Boles 2017-08-24 10:38:28 UTC
(In reply to Vendula Poncova from comment #2)
> As a workaround, we manually set the visibility of the content in a callback
> that is connected to the activate signal.

I used notify::expanded, which worked around it, but the above should work too.
Comment 7 Daniel Boles 2017-08-24 10:41:08 UTC
*** Bug 776322 has been marked as a duplicate of this bug. ***
Comment 8 Daniel Boles 2017-08-24 11:51:51 UTC
Review of attachment 358316 [details] [review]:

::: gtk/gtkexpander.c
@@ +1268,3 @@
   if (child)
     {
+      gtk_widget_set_visible (child, priv->expanded);

This will queue_resize() on the parent expander in gtk_widget_hide(), so it should replace the call to queue_resize(expander) a few lines down.
Comment 9 Daniel Boles 2017-08-24 11:55:14 UTC
Created attachment 358323 [details] [review]
Expander: Actually hide child when collapsing
Comment 10 Daniel Boles 2017-08-24 20:09:12 UTC
Created attachment 358376 [details] [review]
Expander: Actually hide child when collapsing

Just adding/removing to/from the BoxGadget is not sufficient; that
leaves the GdkWindow hanging around, taking input, changing the cursor,
and all sorts of other nefarious shenanigans.

Resolve by ensuring the child’s GdkWindow is unmapped if collapsed.

Note: the reflexive solution is just to set_visible(child, expanded),
but it is best to avoid messing with the child’s :visible property.


--

This adds handling for add()ing a child to a currently collapsed expander.
Matthias and Timm acked this one on IRC.
Comment 11 Daniel Boles 2017-08-24 20:44:06 UTC
This should be fixed now, but please reopen if any gremlins remain.

Thanks for the reports!