Skip to content

Draft: Add enter/leave to cairo context

Richard Gill requested to merge riribreizh/pugl:cairo-context into master

OpenGL has this facility to enter and leave the backend context out of Expose events.

It can be interesting to have it also for Cairo backend, especially on immediate mode UIs where fonts need to be initialized after the context is created, but only once. For example Nuklear context needs a font to be specified on creation, and that cannot be done until the first expose event if we want to load a specific font.

This PR provides the same functionnality than for OpenGL backend (puglEnterContext and puglLeaveContext calls).

The puglX11CairoEnter() and puglX11CairoLeave() have been modified in consequence to not specifically rely on the expose event to create/destroy the context.

P.S: I am not sure about win/mac implementations. Mac seems straightforward as the expose event was not used, for Windows there is the BeginPaint() call...

Merge request reports