Re: Scrolled window child contents showing on other widgets when resizing window in scrolled state



Hi,

Le 09/03/2015 08:41, Pramathesh Ambasta a écrit :
[…]

The ui consists of a main window, a grid in which are packed a File
ChooserWidget (above) and a scrolled window below. The scrolled window
has a layout or a drawing area with a viewport as a child.

In the layout or the drawing area, a cairo context is obtained by making
a call to gdk_cairo_create.

[…]

In GTK3 you should *never*¹ have to call gdk_cairo_create() to draw on
the screen.  Just use the cairo_t received as argument of the :draw signal.

All your problems most probably come from this.  I recently fixed an
application that had similar issues, and all I had to do was remove the
various gdk_cairo_create()/cairo_destroy() pairs in :draw handlers.  I
guess the author had those for GTK2 and didn't remove them when porting
to GTK3 or something.

Note that a change in GTK 3.9.2 (IIRC) changed these kind of calls from
"useless junk" to "oh my god why is my app broken", so maybe your
application worked with earlier versions.  However, it never was right
to do it with 3.x, and if it ever worked it was only a mere
implementation detail that happened to let you do it.
AFAIK, the technical reason behind this is that each widget used to have
its own surface, but now GTK tries and use only one surface² and
properly prepares the context passed to each widget's :draw signal to
have clip and everything setup for them.  If you create a new context
yourself, it won't get this clipping and friends, leading to possible
off-widget drawings.

Regards,
Colomban

¹ ok maybe there are very corner cases where it might make sense, but
that's really not the norm.
² well, that's not entirely true, there are some widgets that will use
their own, but not every ones like it used to.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]