Scrollbars disappear when scrollable widget is stored in GtkScrolledWindow inside a GtkLayout
Submitted by Aaron Levinson
Created attachment 164428 bzip'd tarball that includes source code and makefile for reproducer as described above
Please note that this bug exists in GTK+ 2.20 and older versions of GTK+ and it's likely that it exists in newer versions as well. The scenario is as follows:
- Create a GtkWindow
- Create a GtkLayout and place in the GtkWindow
- At run-time (say, after a few seconds), create a scrollable widget (for example, a GtkTextView), place it in a GtkScrolledWindow, set the size of the scrollable widget to be larger than the size of the scrolled window, and add the scrolled window to the layout using gtk_layout_put().
- Every few seconds, draw to the GtkLayout's bin_window such that it would overlap the scrolled window.
As a result of the draws, the scroll bars of the GtkScrolledWindow disappear, although they are still there and can be clicked. Hovering over the scroll bars may cause them to be displayed temporarily, at least until the next draw occurs.
I have attached a tarball with a reproducer. The makefile is currently setup to build main2.cpp, which uses a GtkTextView as the scrollable widget. However, by using main.cpp instead, it can be demonstrated with a WebKitWebView as well, which is the scrollable widget for which I discovered the original problem. The reproducer simulates an application that may draw on the GtkLayout at any time. Please note that the makefile may need to be adjusted depending on the Linux distribution on which this is tested--the makefile is known to work on both Fedora 11 and Fedora 13.
It's unclear to me if this is a bug in GTK+ or a bug in the application, although I'm not sure what I would be doing wrong it is the latter case. If it is caused by a bug in GTK+, then ideally, there would be a workaround that I could do to prevent the bug from occurring in older versions of GTK+. I would be interested in a workaround even if requires knowledge of GTK+ internals.
Attachment 164428, "bzip'd tarball that includes source code and makefile for reproducer as described above":