Revert "Fix hang on startup under Wayland with the WayFire compositor"

This reverts commit 3a5389d5ab.

It seems XDG_CURRENT_DESKTOP isn't reliably set,
causing no titlebar on GNOME, see #121241.

The WAYFIRE workaround will need to be resolved another way.
This commit is contained in:
Campbell Barton
2024-04-30 13:49:31 +10:00
parent f01eb79ab9
commit 3a2fafba73

View File

@@ -191,6 +191,15 @@ static bool use_gnome_confine_hack = false;
*/
#define USE_KDE_TABLET_HIDDEN_CURSOR_HACK
/**
* When GNOME is found, require `libdecor`.
* This is a hack because it seems there is no way to check if the compositor supports
* server side decorations when initializing WAYLAND.
*/
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
# define USE_GNOME_NEEDS_LIBDECOR_HACK
#endif
/** \} */
/* -------------------------------------------------------------------- */
@@ -1353,6 +1362,7 @@ struct GWL_Display {
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
GWL_LibDecor_System *libdecor = nullptr;
bool libdecor_required = false;
#endif
GWL_XDG_Decor_System *xdg_decor = nullptr;
@@ -6970,6 +6980,16 @@ static void global_handle_add(void *data,
added = display->registry_entry != registry_entry_prev;
}
else {
/* Not found. */
#ifdef USE_GNOME_NEEDS_LIBDECOR_HACK
if (STRPREFIX(interface, "gtk_shell")) { /* `gtk_shell1` at time of writing. */
/* Only require `libdecor` when built with X11 support,
* otherwise there is nothing to fall back on. */
display->libdecor_required = true;
}
#endif
}
CLOG_INFO(LOG,
2,
@@ -7127,34 +7147,24 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
}
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
bool libdecor_required = false;
{
/* This seems to be the most reliable way to check if GNOME is running.
* Ideally it would be possible to check if the compositor supports SSD. */
const char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
if (xdg_current_desktop && STREQ(xdg_current_desktop, "GNOME")) {
libdecor_required = true;
}
}
if (libdecor_required) {
if (display_->libdecor_required) {
/* Ignore windowing requirements when running in background mode,
* as it doesn't make sense to fall back to X11 because of windowing functionality
* in background mode, also LIBDECOR is crashing in background mode `blender -b -f 1`
* for e.g. while it could be fixed, requiring the library at all makes no sense. */
if (background) {
libdecor_required = false;
display_->libdecor_required = false;
}
# ifdef WITH_GHOST_X11
else if (!has_libdecor && !ghost_wayland_is_x11_available()) {
/* Only require LIBDECOR when X11 is available, otherwise there is nothing to fall back to.
* It's better to open without window decorations than failing entirely. */
libdecor_required = false;
display_->libdecor_required = false;
}
# endif /* WITH_GHOST_X11 */
}
if (libdecor_required) {
if (display_->libdecor_required) {
gwl_xdg_decor_system_destroy(display_, display_->xdg_decor);
display_->xdg_decor = nullptr;