[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin/Plasma/5.12] /: Ensure _NET_CURRENT_DESKTOP is set on startup
From: Martin_Flöser <null () kde ! org>
Date: 2018-03-29 15:50:37
Message-ID: E1f1Zoz-0003E9-Pq () code ! kde ! org
[Download RAW message or body]
Git commit 4205496033728c82643e78340b4ddae3079c6280 by Martin Flöser.
Committed on 29/03/2018 at 15:50.
Pushed by graesslin into branch 'Plasma/5.12'.
Ensure _NET_CURRENT_DESKTOP is set on startup
Summary:
Seems to have regressed in Plasma 5.12 due to code reordering. Now the
property is explicitly updated once the NETRootInfo is created.
BUG: 391034
FIXED-IN: 5.12.5
Test Plan:
Test case exposing the problem added. Fails without the patch,
succeeds with the patch.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D10836
M +52 -0 autotests/integration/virtual_desktop_test.cpp
M +1 -0 workspace.cpp
https://commits.kde.org/kwin/4205496033728c82643e78340b4ddae3079c6280
diff --git a/autotests/integration/virtual_desktop_test.cpp \
b/autotests/integration/virtual_desktop_test.cpp index 82a7c405d..71a3ec0e7 100644
--- a/autotests/integration/virtual_desktop_test.cpp
+++ b/autotests/integration/virtual_desktop_test.cpp
@@ -40,6 +40,7 @@ private Q_SLOTS:
void init();
void cleanup();
+ void testNetCurrentDesktop();
void testLastDesktopRemoved_data();
void testLastDesktopRemoved();
};
@@ -60,6 +61,16 @@ void VirtualDesktopTest::initTestCase()
kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait());
waylandServer()->initWorkspace();
+
+ if (kwinApp()->x11Connection()) {
+ // verify the current desktop x11 property on startup, see BUG: 391034
+ Xcb::Atom currentDesktopAtom("_NET_CURRENT_DESKTOP");
+ QVERIFY(currentDesktopAtom.isValid());
+ Xcb::Property currentDesktop(0, kwinApp()->x11RootWindow(), \
currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1); + bool ok = true;
+ QCOMPARE(currentDesktop.value(0, &ok), 0);
+ QVERIFY(ok);
+ }
}
void VirtualDesktopTest::init()
@@ -74,6 +85,47 @@ void VirtualDesktopTest::cleanup()
Test::destroyWaylandConnection();
}
+void VirtualDesktopTest::testNetCurrentDesktop()
+{
+ if (!kwinApp()->x11Connection()) {
+ QSKIP("Skipped on Wayland only");
+ }
+ QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
+ VirtualDesktopManager::self()->setCount(4);
+ QCOMPARE(VirtualDesktopManager::self()->count(), 4u);
+
+ Xcb::Atom currentDesktopAtom("_NET_CURRENT_DESKTOP");
+ QVERIFY(currentDesktopAtom.isValid());
+ Xcb::Property currentDesktop(0, kwinApp()->x11RootWindow(), currentDesktopAtom, \
XCB_ATOM_CARDINAL, 0, 1); + bool ok = true;
+ QCOMPARE(currentDesktop.value(0, &ok), 0);
+ QVERIFY(ok);
+
+ // go to desktop 2
+ VirtualDesktopManager::self()->setCurrent(2);
+ currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), \
currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1); + QCOMPARE(currentDesktop.value(0, \
&ok), 1); + QVERIFY(ok);
+
+ // go to desktop 3
+ VirtualDesktopManager::self()->setCurrent(3);
+ currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), \
currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1); + QCOMPARE(currentDesktop.value(0, \
&ok), 2); + QVERIFY(ok);
+
+ // go to desktop 4
+ VirtualDesktopManager::self()->setCurrent(4);
+ currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), \
currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1); + QCOMPARE(currentDesktop.value(0, \
&ok), 3); + QVERIFY(ok);
+
+ // and back to first
+ VirtualDesktopManager::self()->setCurrent(1);
+ currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), \
currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1); + QCOMPARE(currentDesktop.value(0, \
&ok), 0); + QVERIFY(ok);
+}
+
void VirtualDesktopTest::testLastDesktopRemoved_data()
{
QTest::addColumn<Test::ShellSurfaceType>("type");
diff --git a/workspace.cpp b/workspace.cpp
index 02ccf5aaa..bb3673d18 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -393,6 +393,7 @@ void Workspace::initWithX11()
// load again to sync to RootInfo, see BUG 385260
vds->load();
vds->updateRootInfo();
+ rootInfo->setCurrentDesktop(vds->currentDesktop()->x11DesktopNumber());
// TODO: only in X11 mode
// Extra NETRootInfo instance in Client mode is needed to get the values of the \
properties
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic