Using GSK from GTK Widgets

I’d like to draw effects on the background of a GtkWidget (maybe a GtkDrawingArea) using GSK. What’s the best way to expose a GSK enabled surface of a GtkWidget to begin doing so.

If there is a way to do this WITHOUT subclassing another widget type, I would be most interested in learning about it.


It is not possible to hook into another widget’s render function. But you can create a container widget that draws the background, and then place your drawing area inside it.

Ok, so how then can I paint using GSK nodes?

You derive from GtkWidget, override the “snapshot” virtual function, and use the GtkSnapshot API:

You don’t “draw” with render nodes: GTK does that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.