diff --git a/autotests/kstartupinfo_unittest.cpp b/autotests/kstartupinfo_unittest.cpp --- a/autotests/kstartupinfo_unittest.cpp +++ b/autotests/kstartupinfo_unittest.cpp @@ -316,12 +316,14 @@ QCOMPARE(KStartupInfo::startupId(), str); } +#ifndef KWINDOWSYSTEM_NO_DEPRECATED { QWidget widget; const QByteArray str = "somefancyidwhichisrandom_kstartupinfo_unittest_3"; KStartupInfo::setNewStartupId(&widget, str); // deprecated QCOMPARE(KStartupInfo::startupId(), str); } +#endif } QTEST_MAIN(KStartupInfo_UnitTest) diff --git a/autotests/kwindowsystemx11test.cpp b/autotests/kwindowsystemx11test.cpp --- a/autotests/kwindowsystemx11test.cpp +++ b/autotests/kwindowsystemx11test.cpp @@ -276,11 +276,12 @@ QTest::qWait(200); QSignalSpy propertiesChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId,NET::Properties,NET::Properties2))); - QSignalSpy propertyChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId,uint))); - QSignalSpy windowChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId))); - QVERIFY(propertiesChangedSpy.isValid()); +#ifndef KWINDOWSYSTEM_NO_DEPRECATED + QSignalSpy propertyChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId,uint))); QVERIFY(propertyChangedSpy.isValid()); +#endif + QSignalSpy windowChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId))); QVERIFY(windowChangedSpy.isValid()); widget.setWindowTitle(QStringLiteral("bar")); @@ -308,6 +309,7 @@ } QVERIFY(gotWMName); +#ifndef KWINDOWSYSTEM_NO_DEPRECATED gotWMName = false; QCOMPARE(propertyChangedSpy.isEmpty(), false); for (auto it = propertyChangedSpy.constBegin(); it != propertyChangedSpy.constEnd(); ++it) { @@ -325,6 +327,7 @@ } } QVERIFY(gotWMName); +#endif QCOMPARE(windowChangedSpy.isEmpty(), false); bool gotWindow = false; diff --git a/autotests/kxmessages_unittest.cpp b/autotests/kxmessages_unittest.cpp --- a/autotests/kxmessages_unittest.cpp +++ b/autotests/kxmessages_unittest.cpp @@ -27,7 +27,9 @@ public: enum BroadcastType { BroadcastMessageObject, +#ifndef KWINDOWSYSTEM_NO_DEPRECATED BroadcastStaticDisplay, +#endif BroadcastStaticConnection }; enum ReceiverType { @@ -56,10 +58,14 @@ QTest::addColumn("receiverType"); QTest::newRow("object") << BroadcastMessageObject << ReceiverTypeDefault; +#ifndef KWINDOWSYSTEM_NO_DEPRECATED QTest::newRow("display") << BroadcastStaticDisplay << ReceiverTypeDefault; +#endif QTest::newRow("connection") << BroadcastStaticConnection << ReceiverTypeDefault; QTest::newRow("object/xcb") << BroadcastMessageObject << ReceiverTypeConnection; +#ifndef KWINDOWSYSTEM_NO_DEPRECATED QTest::newRow("display/xcb") << BroadcastStaticDisplay << ReceiverTypeConnection; +#endif QTest::newRow("connection/xcb") << BroadcastStaticConnection << ReceiverTypeConnection; } @@ -91,9 +97,11 @@ case KXMessages_UnitTest::BroadcastMessageObject: m_msgs.broadcastMessage(type, message); break; +#ifndef KWINDOWSYSTEM_NO_DEPRECATED case KXMessages_UnitTest::BroadcastStaticDisplay: QVERIFY(KXMessages::broadcastMessageX(QX11Info::display(), type.constData(), message)); break; +#endif case KXMessages_UnitTest::BroadcastStaticConnection: QVERIFY(KXMessages::broadcastMessageX(QX11Info::connection(), type.constData(), message, QX11Info::appScreen())); break; diff --git a/src/kstartupinfo.cpp b/src/kstartupinfo.cpp --- a/src/kstartupinfo.cpp +++ b/src/kstartupinfo.cpp @@ -38,7 +38,9 @@ #include "netwm_def.h" #include "kwindowsystem_debug.h" +#ifndef KWINDOWSYSTEM_NO_DEPRECATED #include +#endif #include #include // KWINDOWSYSTEM_HAVE_X11 @@ -62,7 +64,7 @@ #include #include #endif -#include +#include #include #include #include @@ -714,11 +716,7 @@ } #if KWINDOWSYSTEM_HAVE_X11 if (QX11Info::isPlatformX11() && !qEnvironmentVariableIsEmpty("DISPLAY")) { // don't rely on QX11Info::display() - Display *disp = XOpenDisplay(nullptr); - if (disp != nullptr) { - KStartupInfo::sendFinishX(disp, id); - XCloseDisplay(disp); - } + KStartupInfo::sendFinish(id); } #endif } @@ -775,13 +773,15 @@ } } +#ifndef KWINDOWSYSTEM_NO_DEPRECATED void KStartupInfo::setNewStartupId(QWidget *window, const QByteArray &startup_id) { // Set the WA_NativeWindow attribute to force the creation of the QWindow. // Without this QWidget::windowHandle() returns 0. window->setAttribute(Qt::WA_NativeWindow, true); setNewStartupId(window->window()->windowHandle(), startup_id); } +#endif void KStartupInfo::setNewStartupId(QWindow *window, const QByteArray &startup_id) { diff --git a/src/kwindowsystem.cpp b/src/kwindowsystem.cpp --- a/src/kwindowsystem.cpp +++ b/src/kwindowsystem.cpp @@ -28,7 +28,9 @@ #include #include #include +#ifndef KWINDOWSYSTEM_NO_DEPRECATED #include +#endif #include #if KWINDOWSYSTEM_HAVE_X11 #include diff --git a/src/platforms/xcb/kwindowsystem.cpp b/src/platforms/xcb/kwindowsystem.cpp --- a/src/platforms/xcb/kwindowsystem.cpp +++ b/src/platforms/xcb/kwindowsystem.cpp @@ -233,35 +233,36 @@ xcb_window_t old_active_window = activeWindow(); int old_number_of_desktops = numberOfDesktops(); bool old_showing_desktop = showingDesktop(); - unsigned long m[ 5 ]; - NETRootInfo::event(ev, m, 5); + NET::Properties props; + NET::Properties2 props2; + NETRootInfo::event(ev, &props, &props2); - if ((m[ PROTOCOLS ] & CurrentDesktop) && currentDesktop() != old_current_desktop) { + if ((props & CurrentDesktop) && currentDesktop() != old_current_desktop) { emit s_q->currentDesktopChanged(currentDesktop()); } - if ((m[ PROTOCOLS ] & DesktopViewport) && mapViewport() && currentDesktop() != old_current_desktop) { + if ((props & DesktopViewport) && mapViewport() && currentDesktop() != old_current_desktop) { emit s_q->currentDesktopChanged(currentDesktop()); } - if ((m[ PROTOCOLS ] & ActiveWindow) && activeWindow() != old_active_window) { + if ((props & ActiveWindow) && activeWindow() != old_active_window) { emit s_q->activeWindowChanged(activeWindow()); } - if (m[ PROTOCOLS ] & DesktopNames) { + if (props & DesktopNames) { emit s_q->desktopNamesChanged(); } - if ((m[ PROTOCOLS ] & NumberOfDesktops) && numberOfDesktops() != old_number_of_desktops) { + if ((props & NumberOfDesktops) && numberOfDesktops() != old_number_of_desktops) { emit s_q->numberOfDesktopsChanged(numberOfDesktops()); } - if ((m[ PROTOCOLS ] & DesktopGeometry) && mapViewport() && numberOfDesktops() != old_number_of_desktops) { + if ((props & DesktopGeometry) && mapViewport() && numberOfDesktops() != old_number_of_desktops) { emit s_q->numberOfDesktopsChanged(numberOfDesktops()); } - if (m[ PROTOCOLS ] & WorkArea) { + if (props & WorkArea) { emit s_q->workAreaChanged(); } - if (m[ PROTOCOLS ] & ClientListStacking) { + if (props & ClientListStacking) { updateStackingOrder(); emit s_q->stackingOrderChanged(); } - if ((m[ PROTOCOLS2 ] & WM2ShowingDesktop) && showingDesktop() != old_showing_desktop) { + if ((props2 & WM2ShowingDesktop) && showingDesktop() != old_showing_desktop) { emit s_q->showingDesktopChanged(showingDesktop()); } } else if (windows.contains(eventWindow)) { diff --git a/tests/setmainwindowtest.cpp b/tests/setmainwindowtest.cpp --- a/tests/setmainwindowtest.cpp +++ b/tests/setmainwindowtest.cpp @@ -67,7 +67,8 @@ layout->addWidget(new QLabel("Test Dialog.\nYou should not be able to bring the parent window on top of me.")); // Show it - KWindowSystem::setMainWindow(dialog, id); + dialog->setAttribute(Qt::WA_NativeWindow, true); + KWindowSystem::setMainWindow(dialog->windowHandle(), id); dialog->exec(); m_label->setText(QString());