Commit 0a2e51db authored by David Edmundson's avatar David Edmundson

Remove duplicated auto backend resolution

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:
parent d485dfe7
......@@ -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."),
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[])
if (hasWindowedOption) {
if (hasX11Option) {
......@@ -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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment