[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] /: Remove duplicated auto backend resolution
From:       David Edmundson <null () kde ! org>
Date:       2018-09-13 9:21:03
Message-ID: E1g0No7-0007w6-Lb () code ! kde ! org
[Download RAW message or body]

Git commit 0a2e51db47f4c91490626872375d61c8fec3aa73 by David Edmundson.
Committed on 13/09/2018 at 09:20.
Pushed by davidedmundson into branch 'master'.

Remove duplicated auto backend resolution

Summary:
kwin_wayland now automatically chooses an appropriate backend, such as
DRM, nested wayland or nested X. If nested it will automatically go into
windowed mode regardless of whether --windowed is set and works fine.

Backend choosing logic existed duplicated in older code for kwin_wayland
--windowed, with the subtle unexpected difference that it preferred
running as an X client over running as a wayland cient if both are
present. This simplifies codes and syncs automatic resolution behaviour.

kwin_wayland --windowed with --x11-display  or --wayland-display will
remain the same.

Test Plan:
Ran kwin_wayland with and without --windowed inside another wayland.
Got the same backend chosen
Tested that kwin_wayland (without --windowed) on an X machine worked just fine.

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: mart, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13658

M  +7    -24   main_wayland.cpp

https://commits.kde.org/kwin/0a2e51db47f4c91490626872375d61c8fec3aa73

diff --git a/main_wayland.cpp b/main_wayland.cpp
index 4dc80f0a5..443499f34 100644
--- a/main_wayland.cpp
+++ b/main_wayland.cpp
@@ -560,7 +560,6 @@ int main(int argc, char * argv[])
             }
         );
     };
-    const bool hasWindowedOption = hasPlugin(KWin::s_x11Plugin) || \
                hasPlugin(KWin::s_waylandPlugin);
     const bool hasSizeOption = hasPlugin(KWin::s_x11Plugin) || \
hasPlugin(KWin::s_virtualPlugin);  const bool hasOutputCountOption = \
hasPlugin(KWin::s_x11Plugin);  const bool hasX11Option = \
hasPlugin(KWin::s_x11Plugin); @@ -579,8 +578,6 @@ int main(int argc, char * argv[])
     QCommandLineOption waylandSocketOption(QStringList{QStringLiteral("s"), \
                QStringLiteral("socket")},
                                            i18n("Name of the Wayland socket to \
listen on. If not set \"wayland-0\" is used."),  QStringLiteral("socket"));
-    QCommandLineOption windowedOption(QStringLiteral("windowed"),
-                                      i18n("Use a nested compositor in windowed \
mode."));  QCommandLineOption framebufferOption(QStringLiteral("framebuffer"),
                                          i18n("Render to framebuffer."));
     QCommandLineOption framebufferDeviceOption(QStringLiteral("fb-device"),
@@ -616,9 +613,6 @@ int main(int argc, char * argv[])
     a.setupCommandLine(&parser);
     parser.addOption(xwaylandOption);
     parser.addOption(waylandSocketOption);
-    if (hasWindowedOption) {
-        parser.addOption(windowedOption);
-    }
     if (hasX11Option) {
         parser.addOption(x11DisplayOption);
     }
@@ -740,25 +734,14 @@ int main(int argc, char * argv[])
         }
     }
 
-    if (hasWindowedOption && parser.isSet(windowedOption)) {
-        if (hasX11Option && parser.isSet(x11DisplayOption)) {
-            deviceIdentifier = parser.value(x11DisplayOption).toUtf8();
-        } else if (!(hasWaylandOption && parser.isSet(waylandDisplayOption))) {
-            deviceIdentifier = qgetenv("DISPLAY");
-        }
-        if (!deviceIdentifier.isEmpty()) {
-            pluginName = KWin::s_x11Plugin;
-        } else if (hasWaylandOption) {
-            if (parser.isSet(waylandDisplayOption)) {
-                deviceIdentifier = parser.value(waylandDisplayOption).toUtf8();
-            } else {
-                deviceIdentifier = qgetenv("WAYLAND_DISPLAY");
-            }
-            if (!deviceIdentifier.isEmpty()) {
-                pluginName = KWin::s_waylandPlugin;
-            }
-        }
+    if (hasX11Option && parser.isSet(x11DisplayOption)) {
+        deviceIdentifier = parser.value(x11DisplayOption).toUtf8();
+        pluginName = KWin::s_x11Plugin;
+    } else if (hasWaylandOption && parser.isSet(waylandDisplayOption)) {
+        deviceIdentifier = parser.value(waylandDisplayOption).toUtf8();
+        pluginName = KWin::s_waylandPlugin;
     }
+
     if (hasFramebufferOption && parser.isSet(framebufferOption)) {
         pluginName = KWin::s_fbdevPlugin;
         deviceIdentifier = parser.value(framebufferDeviceOption).toUtf8();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic