mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-12 22:42:53 -06:00
Qt: Better wayland detection to enforce xcb
In certain cases, the platform can be "wayland-egl", "wayland-xcomposite", and other values for which I haven't found a full list yet. Instead of matching only "wayland", we now look for "wayland" anywhere in the `QT_QPA_PLATFORM` string in a case-insensitive manner. Acknowledgements: `CaseInsensitiveContains`' implementation was heavily inspired by GNU's non-standard glibc `strcasestr` function, which can be found here licensed under GPLv2 or later: https://ftp.gnu.org/gnu/libc/
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/ScopeGuard.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
@ -152,8 +153,8 @@ int main(int argc, char* argv[])
|
||||
// from happening.
|
||||
// For more information: https://bugs.dolphin-emu.org/issues/11807
|
||||
const char* current_qt_platform = getenv("QT_QPA_PLATFORM");
|
||||
const bool replace_qt_platform =
|
||||
(current_qt_platform && strcasecmp(current_qt_platform, "wayland") == 0);
|
||||
const bool replace_qt_platform = current_qt_platform != nullptr &&
|
||||
Common::CaseInsensitiveContains(current_qt_platform, "wayland");
|
||||
setenv("QT_QPA_PLATFORM", "xcb", replace_qt_platform);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user