Gdk::Toplevel or Gdk::Surface?

Hi, I’m migrating my application to gtkmm4, I used to have a ApplicationWindow as my main window, I am wondering if I should switch to using Gdk::Toplevel or Gdk::Surface. My app needs to be fullscreen and always toplevel.
Any reference to gtkmm4 examples? The book examples in gtkmm3 were very useful.

You should not use any of that.

GtkWindow has the API for being full screen. If by “top level” you mean “always on top”: window stacking order manipulations are not portable across windowing systems, so they are not available through the API. A full screen window will likely be places above all other windows by any compliant window manager.

So when should I use Gdk::Toplevel?

You shouldn’t. :slightly_smiling_face:

GdkToplevel is an API for top level surfaces managed by the window manager; it’s the result of splitting GdkSurface (formerly GdkWindow) into:

  • generic windowing system surface API
  • top level surface API
  • pop up surface API

In general, you should not be messing around with the GDK API if you already have a GtkWindow.

1 Like