From kde-commits Thu Sep 13 09:21:03 2018 From: David Edmundson Date: Thu, 13 Sep 2018 09:21:03 +0000 To: kde-commits Subject: [kwin] /: Remove duplicated auto backend resolution Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=153683048619954 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 f= ine. 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 =3D hasPlugin(KWin::s_x11Plugin) || hasPl= ugin(KWin::s_waylandPlugin); const bool hasSizeOption =3D hasPlugin(KWin::s_x11Plugin) || hasPlugin= (KWin::s_virtualPlugin); const bool hasOutputCountOption =3D hasPlugin(KWin::s_x11Plugin); const bool hasX11Option =3D 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 socke= t to listen on. If not set \"wayland-0\" is used."), QStringLiteral("socket")); - QCommandLineOption windowedOption(QStringLiteral("windowed"), - i18n("Use a nested compositor in win= dowed 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 =3D parser.value(x11DisplayOption).toUtf8(); - } else if (!(hasWaylandOption && parser.isSet(waylandDisplayOption= ))) { - deviceIdentifier =3D qgetenv("DISPLAY"); - } - if (!deviceIdentifier.isEmpty()) { - pluginName =3D KWin::s_x11Plugin; - } else if (hasWaylandOption) { - if (parser.isSet(waylandDisplayOption)) { - deviceIdentifier =3D parser.value(waylandDisplayOption).to= Utf8(); - } else { - deviceIdentifier =3D qgetenv("WAYLAND_DISPLAY"); - } - if (!deviceIdentifier.isEmpty()) { - pluginName =3D KWin::s_waylandPlugin; - } - } + if (hasX11Option && parser.isSet(x11DisplayOption)) { + deviceIdentifier =3D parser.value(x11DisplayOption).toUtf8(); + pluginName =3D KWin::s_x11Plugin; + } else if (hasWaylandOption && parser.isSet(waylandDisplayOption)) { + deviceIdentifier =3D parser.value(waylandDisplayOption).toUtf8(); + pluginName =3D KWin::s_waylandPlugin; } + if (hasFramebufferOption && parser.isSet(framebufferOption)) { pluginName =3D KWin::s_fbdevPlugin; deviceIdentifier =3D parser.value(framebufferDeviceOption).toUtf8(= );