Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove QT+GNOME+Wayland 'xcb' hack on fixed Qt versions #3683

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,23 @@
// source: https://github.com/ksnip/ksnip/issues/416
void wayland_hacks()
{
// Workaround to https://github.com/ksnip/ksnip/issues/416
int suffixIndex;
DesktopInfo info;
if (info.windowManager() == DesktopInfo::GNOME) {
qputenv("QT_QPA_PLATFORM", "xcb");

const char *qt_version = qVersion();

QVersionNumber targetVersion(5, 15, 2);
QString string(qt_version);
QVersionNumber currentVersion = QVersionNumber::fromString(string, &suffixIndex);

if (currentVersion < targetVersion) {
if (info.windowManager() == DesktopInfo::GNOME) {
qWarning() << "Qt versions lower than" << targetVersion.toString() <<
"on GNOME using Wayland have a bug when accessing the clipboard." <<
"Your version is" << currentVersion.toString() << "so we're forcing QT_QPA_PLATFORM to 'xcb'." <<
"To use native Wayland, please upgrade your Qt version to" << targetVersion.toString() << "or higher";
qputenv("QT_QPA_PLATFORM", "xcb");
}
}
}
#endif
Expand Down