How to paint on a gtk4 window?

This states that gtk_widget_set_app_paintable is gone:

If I understand correctly now decorations are part of Gtk and if I use GdkSurface instead of GtkWindow I loose default decorations.

So I have paint it all myself, including decorations with GdkSurface?

I’m looking for a midterm where I could re-use existing/default decorations and still be able to paint into a window (or a widget that is directly descendant).

Thanks.

I think you’ve got yourself confused somewhere,

gtk_widget_set_app_paintable never really did much and doesn’t really have anything to do with decorations

GdkSurface is analogous to the old GdkWindow not GtkWindow - it’s a low-level windowing concept

If, for some reason, you decided to use a GdkSurface without a GtkWindow you would need to do a lot yourself

gtk_window_set_titlebar a drawing area? Though really I’m not sure why you can’t use GtkHeaderBar?

I thought the removal of gtk_widget_set_app_paintable made it impossible to paint to GtkWindow directly. Can I still do it?

Following this thought I had the idea of using a GdkSurface so I could draw on it, but would loose default decorations.

What I want is default decorations + ability to draw a buffer directly to the window.

Thanks.

I mean you can still connect to the draw signal, not entirely sure why you’d want to?

I’d suggest sticking a GtkDrawingArea in a GtkWindow

1 Like

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