Add workaround for wayland session

This commit is contained in:
kd-11 2021-08-21 20:52:04 +03:00 committed by kd-11
parent 5c0bf14554
commit 4953e79588

View File

@ -76,12 +76,28 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon,
setSurfaceType(QSurface::VulkanSurface);
#endif
// NOTE: You cannot safely create a wayland window that has hidden initial status and perform any changes on the window while it is still hidden.
// Doing this will create a surface with deferred commands that require a buffer. When binding to your session, this may assert in your compositor due to protocol restrictions.
Visibility startup_visibility = Hidden;
#ifndef _WIN32
if (const char* session_type = ::getenv("XDG_SESSION_TYPE"))
{
if (!strcasecmp(session_type, "wayland"))
{
// Start windowed. This is a featureless rectangle on-screen with no window decorations.
// It does not even resemble a window until the WM attaches later on.
// Fullscreen could technically work with some fiddling, but easily breaks depending on geometry input.
startup_visibility = Windowed;
}
}
#endif
setMinimumWidth(160);
setMinimumHeight(90);
setScreen(screen);
setGeometry(geometry);
setTitle(qstr(m_window_title));
setVisibility(Hidden);
setVisibility(startup_visibility);
create();
// Change cursor when in fullscreen.