Opened 5 years ago

Closed 5 years ago

#15553 closed enhancement (fixed)

Make Wayland consider window decoration flags

Reported by: manuel.BACHMANN@… Owned by:
Priority: normal Milestone:
Component: wxGTK Version: 2.9.5
Keywords: Wayland, Decorations, GdkDecor Cc:
Blocked By: Blocking:
Patch: yes


Currently when using GTK+, wxWidgets sets window properties (presence of titlebar, buttons, etc...) via the old GdkDecor API. This API is used by X11 but not by Wayland and, after discussion with the GTK+ developers, won't be.

The result is that some windows display their title bars, etc... when they shouldn't. Workaround is to rattach GDK_DECOR flags to Wayland-specific functions. Another solution would be to rattach wx flags like wxNO_BORDER directly.

Attachments (1)

gdkdecor-wayland.patch download (900 bytes) - added by manuel.BACHMANN@… 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by manuel.BACHMANN@…


comment:1 follow-up: Changed 5 years ago by vadz

So what is the new API that it is going to replace GdkDecor in GTK+ "globally"? Shouldn't we use this instead of doing something Wayland-specific?

comment:2 in reply to: ↑ 1 Changed 5 years ago by manuel.BACHMANN@…

Replying to vadz:

So what is the new API that it is going to replace GdkDecor in GTK+ "globally"? Shouldn't we use this instead of doing something Wayland-specific?

Here's what I understood so far :

  • GdkDecor will be buried because it was related to legacy Motif WM-Hints ;
  • in the code, GDK_DECOR hints were only used to "set" things on X11, you could "get" them on other platforms but only for the sake of compatibility. For instance, Win32 returns GDK_DECOR_MAXIMIZE if you've maximized the window, but you couldn't set GDK_DECOR_MAXIMIZE yourself to really do it (see "gdkwindow-win32.c").
  • So the really cross-platform way would be to use functions :

gdk_window_maximize (window);
gdk_window_unmaximize (window);
gdk_window_fullscreen (window);

  • Wayland is more specific because it does not support everything, but has some more. Here's what I know :

Fullscreen, maximimze/unmaximize and popup should still work.

You can set a custom titlebar with :

gtk_window_set_titlebar (window, titlebar);

You can totally disable the titlebar with :

gtk_window_set_titlebar (window, NULL);

You can disable all decorations with :

gtk_window_set_decorated (window, FALSE);

Buttons can not be chosen directly, but I was told you could use a theme for that.

comment:3 Changed 5 years ago by kosenko

GTK+3 and wxGTK3 could be compiled with multiple backends and actual backend will be selected in runtime in this case. So we need to have also runtime checks such as GDK_IS_WAYLAND_WINDOW(window) to don't run the patch source code in X11 and Broadway environment if GTK+ was compiled with Wayland support.

wxGTK could be compiled with X11, Win32, Broadway, Wayland and hypothetically Mir backends. So it would be nice don't add backend specific code without strong reason.

comment:4 Changed 5 years ago by pcor

Looking at the source code for gtk_window_set_titlebar() in GTK+ 3.10.0, the titlebar widget cannot be NULL. And it also looks like the widget has to be a GtkHeaderBar. Setting an empty GtkHeaderBar might work. I can't test it, but I'll go ahead and do it.

Controlling the buttons on the titlebar would require using a GtkStyleProvider to override the "decoration-button-layout" style. Since that style specifies positioning as well as presence, doing it in a way that matches the theme could be a real PITA.

comment:5 Changed 5 years ago by PC

  • Resolution set to fixed
  • Status changed from new to closed

(In [74977]) Window decoration fixes for Wayland.
Allow setting no decorations, and an attempt to allow setting no title bar.
closes #15553

Note: See TracTickets for help on using tickets.