[cairo] cairo / xlib not updating window content

Cedric Roux sed at free.fr
Sun Jul 29 19:47:31 UTC 2018

On 07/29/2018 05:01 PM, Pavel Petrovic wrote:
>> Cedric's solution... I'm not quite sure what it does. It fixes some
>> flickering that is not there? It does double buffering, too, but only
>> uses a temporary buffer that loses its content afterwards? I felt like
>> you want your windows to actually retain old content, which that
>> temporary group does not do...
> I think that is the magic of the push_group / pop_group that it does
> retain the old content. When it is pushed, then a copy is created,
> so you add new content to the previous one, and then paint it
> back to the visible surface with pop. So both solutions solved
> all issues.

I don't know the internals of this push/pop thing.
I see flickering without it, disappears with it.

With my setup (debian, fvwm) the content is not
retained if I put another window on top of this
one and then put it away.

Pavel, I think you need a very basic logic with
one paint() function that has to:
- clear window: call cairo_rectangle/cairo_fill
- draw content (cairo_rectangle, draw strings, etc)
- put content to the X window
- ensure that the X window is updated
  (this may require a XFlush for the X part
   and the push/pop or some other mechanism
   for the cairo part)

My 2 cents.

More information about the cairo mailing list