Improve GTK3 client-side decorations check

This is more like GTK does it
This commit is contained in:
Paul Cornett 2022-03-14 09:46:20 -07:00
parent 7ce4e521c5
commit bae7680d52

View File

@ -44,6 +44,9 @@
#include <X11/Xatom.h> // XA_CARDINAL
#include "wx/unix/utilsx11.h"
#endif
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
// ----------------------------------------------------------------------------
// data
@ -72,19 +75,14 @@ static bool gs_decorCacheValid;
#ifdef __WXGTK3__
static bool HasClientDecor(GtkWidget* widget)
{
static bool has;
static bool once;
if (!once)
{
once = true;
GdkDisplay* display = gtk_widget_get_display(widget);
const char* name = g_type_name(G_TYPE_FROM_INSTANCE(display));
has =
wxGTKImpl::IsWayland(display) ||
strcmp(name, "GdkMirDisplay") == 0 ||
strcmp(name, "GdkBroadwayDisplay") == 0;
}
return has;
GdkDisplay* display = gtk_widget_get_display(widget);
if (wxGTKImpl::IsX11(display))
return false;
#if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,22,0)
if (wxGTKImpl::IsWayland(display) && wx_is_at_least_gtk3(22))
return !gdk_wayland_display_prefers_ssd(display);
#endif
return true;
}
#else
static inline bool HasClientDecor(GtkWidget*)