summarylogtreecommitdiffstats
path: root/fix_wayland.patch
blob: dbccafd31d9566d510f6896cb4b11d82dffca4d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From fe4f0a506e94544e1fa4ffcca9e457048f8c0cbe Mon Sep 17 00:00:00 2001
From: oldherl <oldherl@gmail.com>
Date: Wed, 3 Jul 2024 01:07:10 +1000
Subject: [PATCH] Don't disable wayland. From meganz/MEGAsync#566

---
 src/MEGASync/gui/InfoDialog.cpp                       |  2 +-
 src/MEGASync/main.cpp                                 | 11 -----------
 .../platform/linux/PlatformImplementation.cpp         |  5 +++++
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/MEGASync/gui/InfoDialog.cpp b/src/MEGASync/gui/InfoDialog.cpp
index ae68f6c5e..625e7bf29 100644
--- a/src/MEGASync/gui/InfoDialog.cpp
+++ b/src/MEGASync/gui/InfoDialog.cpp
@@ -149,7 +149,7 @@ InfoDialog::InfoDialog(MegaApplication *app, QWidget *parent, InfoDialog* olddia
         // To avoid issues with text input we implement a popup ourselves
         // instead of using Qt::Popup by listening to the WindowDeactivate
         // event.
-        Qt::WindowFlags flags = Qt::FramelessWindowHint;
+        Qt::WindowFlags flags = Qt::FramelessWindowHint  | Qt::WindowStaysOnTopHint;
 
         if (Platform::getInstance()->isTilingWindowManager())
         {
diff --git a/src/MEGASync/main.cpp b/src/MEGASync/main.cpp
index 99d089b78..3e75b7e6c 100644
--- a/src/MEGASync/main.cpp
+++ b/src/MEGASync/main.cpp
@@ -401,18 +401,6 @@ int main(int argc, char *argv[])
     }
 #endif
 
-#if defined(Q_OS_LINUX)
-    if (!qEnvironmentVariableIsSet("DO_NOT_UNSET_XDG_SESSION_TYPE"))
-    {
-        QString sessionType = qEnvironmentVariable("XDG_SESSION_TYPE");
-        if (!sessionType.isEmpty() && sessionType == QString::fromUtf8("wayland"))
-        {
-            std::cerr << "Avoiding wayland" << std::endl;
-            qunsetenv("XDG_SESSION_TYPE");
-        }
-    }
-#endif
-
 #ifndef Q_OS_MACX
 #if defined(WIN32)
     ScaleFactorManager scaleFactorManager(OsType::WIN);
diff --git a/src/MEGASync/platform/linux/PlatformImplementation.cpp b/src/MEGASync/platform/linux/PlatformImplementation.cpp
index 80a49f318..bc2a0e3d3 100644
--- a/src/MEGASync/platform/linux/PlatformImplementation.cpp
+++ b/src/MEGASync/platform/linux/PlatformImplementation.cpp
@@ -108,7 +108,8 @@ bool PlatformImplementation::isTilingWindowManager()
     static const QSet<QString> tiling_wms = {
         QLatin1String("i3"),
         QLatin1String("Hyprland"),
-        QLatin1String("sway")
+        QLatin1String("sway"),
+        QLatin1String("wayfire")
     };
 
     return getValue("MEGASYNC_ASSUME_TILING_WM", false)
@@ -330,6 +331,9 @@ QString PlatformImplementation::getWindowManagerName()
 {
     static QString wmName;
     static bool cached = false;
+    if (qgetenv("XDG_SESSION_TYPE") == "wayland") {
+        return QString::fromLocal8Bit(qgetenv("XDG_CURRENT_DESKTOP"));
+    }
 
     if (!cached)
     {