[cairo] delayed graphic updates under Windows

Theo Veenker theo.veenker at beexy.nl
Wed Apr 5 14:14:52 UTC 2017

Hi all,

I've question about repeatedly updating window contents on Windows with DWM running.

My application tries to update windows synchronized with vblank. It works beautifully 
under Linux and it sort-of worked OK with XP. Under recent version of Windows we have to 
live with the DWM controlling when window updates make it to the screen.

Now the problem is when I try to update a window on every frame (which happens with 
animated content) and I use cairo_clip() to restrict the area to be updated then Windows 
somehow decides it's not worth redrawing every frame and skips frames (i.e. does not 
update on every frame). When I comment out the cairo_clip() it does not exhibit this 
behaviour, so does not skip (that much).

I tend to use clipping where I can to speed up drawing where I can, but under Windows in 
this case I have to paint my entire backbuffer to the window for each frame to have it 
displayed. I don't think there's anything wrong with cairo in this respect. It's just that 
I don't know how to force the DWM to update. I tried GdiFlush() and GdmFlush() with no 
effect. Calling GDI GetPixel() on the target window forces a flush, but that approach is 
much slower than repainting the entire window.

I hope someone on the list knows how to overcome this problem.


Theo Veenker  |  Beexy - Behavioral Experiment Software
+31(0)524-541531  |  +31(0)6-42525777 mobile
theo.veenker at beexy.nl  |  www.beexy.nl

More information about the cairo mailing list