diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(ECMGenerateHeaders) @@ -25,13 +25,19 @@ include(ECMAddQch) include(ECMPoQmTools) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") # TODO KF6: remove option(KWINDOWSYSTEM_NO_WIDGETS "Disable deprecated API including QWidget usage, so that KWindowSystem does not link to QtWidgets. Warning: this is binary and source incompatible.") if (KWINDOWSYSTEM_NO_WIDGETS) - add_compile_definitions(KWINDOWSYSTEM_NO_DEPRECATED) + # ensure EXCLUDE_DEPRECATED_BEFORE_AND_AT is at least at the version where all QWidgets API is deprecated + if (NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND + EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS "5.62.0") + set(EXCLUDE_DEPRECATED_BEFORE_AND_AT "5.62.0") + endif() endif() ecm_setup_version(PROJECT VARIABLE_PREFIX KWINDOWSYSTEM diff --git a/autotests/kstartupinfo_unittest.cpp b/autotests/kstartupinfo_unittest.cpp --- a/autotests/kstartupinfo_unittest.cpp +++ b/autotests/kstartupinfo_unittest.cpp @@ -316,7 +316,7 @@ QCOMPARE(KStartupInfo::startupId(), str); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62) { QWidget widget; const QByteArray str = "somefancyidwhichisrandom_kstartupinfo_unittest_3"; diff --git a/autotests/kwindowsystemx11test.cpp b/autotests/kwindowsystemx11test.cpp --- a/autotests/kwindowsystemx11test.cpp +++ b/autotests/kwindowsystemx11test.cpp @@ -277,7 +277,7 @@ QSignalSpy propertiesChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId,NET::Properties,NET::Properties2))); QVERIFY(propertiesChangedSpy.isValid()); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) QSignalSpy propertyChangedSpy(KWindowSystem::self(), SIGNAL(windowChanged(WId,uint))); QVERIFY(propertyChangedSpy.isValid()); #endif @@ -309,7 +309,7 @@ } QVERIFY(gotWMName); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) gotWMName = false; QCOMPARE(propertyChangedSpy.isEmpty(), false); for (auto it = propertyChangedSpy.constBegin(); it != propertyChangedSpy.constEnd(); ++it) { 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,7 @@ public: enum BroadcastType { BroadcastMessageObject, -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) BroadcastStaticDisplay, #endif BroadcastStaticConnection @@ -58,12 +58,12 @@ QTest::addColumn("receiverType"); QTest::newRow("object") << BroadcastMessageObject << ReceiverTypeDefault; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) QTest::newRow("display") << BroadcastStaticDisplay << ReceiverTypeDefault; #endif QTest::newRow("connection") << BroadcastStaticConnection << ReceiverTypeDefault; QTest::newRow("object/xcb") << BroadcastMessageObject << ReceiverTypeConnection; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) QTest::newRow("display/xcb") << BroadcastStaticDisplay << ReceiverTypeConnection; #endif QTest::newRow("connection/xcb") << BroadcastStaticConnection << ReceiverTypeConnection; @@ -97,7 +97,7 @@ case KXMessages_UnitTest::BroadcastMessageObject: m_msgs.broadcastMessage(type, message); break; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) case KXMessages_UnitTest::BroadcastStaticDisplay: QVERIFY(KXMessages::broadcastMessageX(QX11Info::display(), type.constData(), message)); break; diff --git a/autotests/netwininfotestclient.cpp b/autotests/netwininfotestclient.cpp --- a/autotests/netwininfotestclient.cpp +++ b/autotests/netwininfotestclient.cpp @@ -67,7 +67,9 @@ void testPid(); void testName(); void testIconName(); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) void testStrut(); +#endif void testExtendedStrut(); void testIconGeometry(); void testWindowType_data(); @@ -407,6 +409,7 @@ performNameTest(atom, &NETWinInfo::name, &NETWinInfo::setName, NET::WMName); } +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) void NetWinInfoTestClient::testStrut() { QVERIFY(connection()); @@ -448,6 +451,7 @@ QCOMPARE(extents.right, newExtents.right); QCOMPARE(extents.top, newExtents.top); } +#endif void NetWinInfoTestClient::testExtendedStrut() { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,9 +69,17 @@ endif () add_library(KF5WindowSystem ${kwindowsystem_SRCS}) -generate_export_header(KF5WindowSystem BASE_NAME KWindowSystem) add_library(KF5::WindowSystem ALIAS KF5WindowSystem) +ecm_generate_export_header(KF5WindowSystem + BASE_NAME KWindowSystem + # GROUP_BASE_NAME KF enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.0 5.18 5.38 5.62 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) + target_include_directories(KF5WindowSystem INTERFACE "$") target_link_libraries(KF5WindowSystem diff --git a/src/kstartupinfo.h b/src/kstartupinfo.h --- a/src/kstartupinfo.h +++ b/src/kstartupinfo.h @@ -112,6 +112,7 @@ */ static void setNewStartupId(QWindow *window, const QByteArray &startup_id); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62) /** * Use this function if the application got a request with startup * notification from outside (for example, when KUniqueApplication::newInstance() @@ -123,8 +124,8 @@ * Note: if all you have is a QWidget*, you might need to call * setAttribute(Qt::WA_NativeWindow, true); before calling window()->windowHandle(). */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static void setNewStartupId(QWidget *window, const QByteArray &startup_id); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 62, "Use KStartupInfo::setNewStartupId(QWindow*)") + static void setNewStartupId(QWidget *window, const QByteArray &startup_id); #endif /** @@ -184,6 +185,7 @@ * */ explicit KStartupInfo(int flags, QObject *parent = nullptr); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * Creates an instance that will receive the startup notifications. * @@ -195,8 +197,8 @@ * @obsolete * @deprecated since 5.0 */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED explicit KStartupInfo(bool clean_on_cantdetect, QObject *parent = nullptr); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KStartupInfo(int, QObject *)") + explicit KStartupInfo(bool clean_on_cantdetect, QObject *parent = nullptr); #endif ~KStartupInfo() override; /** @@ -213,6 +215,7 @@ */ static bool sendStartup(const KStartupInfoId &id, const KStartupInfoData &data); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18) /** * Like sendStartup , uses dpy instead of qt_x11display() for sending the info. * @param dpy the display of the application. Note that the name field @@ -222,8 +225,8 @@ * @return true if successful, false otherwise * @deprecated since 5.18 use sendStartupXcb */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static bool sendStartupX(Display *dpy, const KStartupInfoId &id, + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendStartupXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)") + static bool sendStartupX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data); #endif @@ -252,16 +255,17 @@ */ static bool sendChange(const KStartupInfoId &id, const KStartupInfoData &data); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18) /** * Like sendChange , uses dpy instead of qt_x11display() for sending the info. * @param dpy the display of the application. * @param id the id of the application * @param data the application's data * @return true if successful, false otherwise * @deprecated since 5.18 use sendChangeXcb */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static bool sendChangeX(Display *dpy, const KStartupInfoId &id, + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendChangeXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)") + static bool sendChangeX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data); #endif @@ -284,15 +288,16 @@ */ static bool sendFinish(const KStartupInfoId &id); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18) /** * Like sendFinish , uses dpy instead of qt_x11display() for sending the info. * @param dpy the display of the application. * @param id the id of the application * @return true if successful, false otherwise * @deprecated since 5.18 use sendFinishXcb */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static bool sendFinishX(Display *dpy, const KStartupInfoId &id); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendFinishXcb(xcb_connection_t *, int, const KStartupInfoId &)") + static bool sendFinishX(Display *dpy, const KStartupInfoId &id); #endif /** @@ -314,16 +319,17 @@ */ static bool sendFinish(const KStartupInfoId &id, const KStartupInfoData &data); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18) /** * Like sendFinish , uses dpy instead of qt_x11display() for sending the info. * @param dpy the display of the application. * @param id the id of the application * @param data the application's data * @return true if successful, false otherwise * @deprecated since 5.18 use sendFinishXcb */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static bool sendFinishX(Display *dpy, const KStartupInfoId &id, + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendFinishXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)") + static bool sendFinishX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data); #endif @@ -478,13 +484,14 @@ * @return true if the notification identifications are different */ bool operator!=(const KStartupInfoId &id) const; - /** + /** * Checks whether the identifier is valid. * @return true if this object doesn't represent a valid notification identification */ bool isNull() const; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED bool none() const { return isNull(); } +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KStartupInfoId::isNull()") + bool none() const { return isNull(); } #endif /** diff --git a/src/kstartupinfo.cpp b/src/kstartupinfo.cpp --- a/src/kstartupinfo.cpp +++ b/src/kstartupinfo.cpp @@ -38,7 +38,7 @@ #include "netwm_def.h" #include "kwindowsystem_debug.h" -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62) #include #endif #include @@ -219,7 +219,7 @@ d->createConnections(); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) KStartupInfo::KStartupInfo(bool clean_on_cantdetect_P, QObject *parent_P) : QObject(parent_P), d(new Private(clean_on_cantdetect_P ? CleanOnCantDetect : 0, this)) @@ -478,7 +478,7 @@ return true; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) bool KStartupInfo::sendStartupX(Display *disp_P, const KStartupInfoId &id_P, const KStartupInfoData &data_P) { @@ -554,7 +554,7 @@ return true; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) bool KStartupInfo::sendChangeX(Display *disp_P, const KStartupInfoId &id_P, const KStartupInfoData &data_P) { @@ -608,7 +608,7 @@ return true; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) bool KStartupInfo::sendFinishX(Display *disp_P, const KStartupInfoId &id_P) { if (id_P.isNull()) { @@ -658,7 +658,7 @@ return true; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) bool KStartupInfo::sendFinishX(Display *disp_P, const KStartupInfoId &id_P, const KStartupInfoData &data_P) { @@ -773,7 +773,7 @@ } } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62) void KStartupInfo::setNewStartupId(QWidget *window, const QByteArray &startup_id) { // Set the WA_NativeWindow attribute to force the creation of the QWindow. diff --git a/src/kwindoweffects.h b/src/kwindoweffects.h --- a/src/kwindoweffects.h +++ b/src/kwindoweffects.h @@ -64,7 +64,7 @@ */ KWINDOWSYSTEM_EXPORT void slideWindow(WId id, SlideFromLocation location, int offset = -1); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62) /** * Mark a window as sliding from screen edge * This is an overloaded member function provided for convenience @@ -74,7 +74,8 @@ * Desktop and Floating won't have effect. * @deprecated since 5.62, use slideWindow(widget->effectiveWinId(), location); */ -KWINDOWSYSTEM_DEPRECATED_EXPORT void slideWindow(QWidget *widget, SlideFromLocation location); +KWINDOWSYSTEM_DEPRECATED_VERSION(5, 62, "Use KWindowEffects::slideWindow(WId, SlideFromLocation, int)") +KWINDOWSYSTEM_EXPORT void slideWindow(QWidget *widget, SlideFromLocation location); #endif /** diff --git a/src/kwindoweffects.cpp b/src/kwindoweffects.cpp --- a/src/kwindoweffects.cpp +++ b/src/kwindoweffects.cpp @@ -20,7 +20,7 @@ #include "kwindoweffects_p.h" #include "pluginwrapper_p.h" #include -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62) #include #endif @@ -75,7 +75,7 @@ KWindowSystemPluginWrapper::self().effects()->slideWindow(id, location, offset); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62) void slideWindow(QWidget *widget, SlideFromLocation location) { slideWindow(widget->effectiveWinId(), location, -1); diff --git a/src/kwindowsystem.h b/src/kwindowsystem.h --- a/src/kwindowsystem.h +++ b/src/kwindowsystem.h @@ -87,7 +87,7 @@ **/ static bool hasWId(WId id); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * Returns information about window @p win. It is recommended to check * whether the returned info is valid by calling the valid() method. @@ -97,9 +97,10 @@ * in the returned data, but make this function faster when not all data is needed. * @param properties2 additional properties (see NET::Property2 enum) * @return the window information - * @deprecated use KWindowInfo directly + * @deprecated Since 5.0, use KWindowInfo directly */ - KWINDOWSYSTEM_DEPRECATED static KWindowInfo windowInfo(WId win, NET::Properties properties, NET::Properties2 properties2 = NET::Properties2()); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo(WId, NET::Properties, NET::Properties2") + static KWindowInfo windowInfo(WId win, NET::Properties properties, NET::Properties2 properties2 = NET::Properties2()); #endif /** @@ -237,7 +238,7 @@ */ static void setMainWindow(QWindow *subwindow, WId mainwindow); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62) /** * Sets the parent window of @p subwindow to be @p mainwindow. * This overrides the parent set the usual way as the QWidget parent, @@ -252,23 +253,28 @@ * you might need to call setAttribute(Qt::WA_NativeWindow, true); before calling * >window()->windowHandle(). */ - KWINDOWSYSTEM_DEPRECATED static void setMainWindow(QWidget *subwindow, WId mainwindow); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 62, "Use KWindowSystem::setMainWindow(QWindow *)") + static void setMainWindow(QWidget *subwindow, WId mainwindow); +#endif +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * Returns the WM_TRANSIENT_FOR property for the given window, i.e. the mainwindow * for this window. * * @param window the id of the window - * @deprecated Use KWindowInfo::transientFor + * @deprecated Since 5.0, use KWindowInfo::transientFor */ - KWINDOWSYSTEM_DEPRECATED static WId transientFor(WId window); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo::transientFor()") + static WId transientFor(WId window); /** * Returns the leader window for the group the given window is in, if any. * @param window the id of the window - * @deprecated Use KWindowInfo::groupLeader + * @deprecated Since 5.0, use KWindowInfo::groupLeader */ - KWINDOWSYSTEM_DEPRECATED static WId groupLeader(WId window); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowInfo::groupLeader()") + static WId groupLeader(WId window); #endif /** * Returns an icon for window @p win. @@ -401,17 +407,19 @@ **/ static void unminimizeWindow(WId win); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0 the @p animation is ignored. */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::minimizeWindow(WId)") static void minimizeWindow(WId win, bool animation); #endif +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0 the @p animation is ignored. */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::unminimizeWindow(WId)") static void unminimizeWindow(WId win, bool animation); #endif @@ -711,6 +719,7 @@ **/ void windowChanged(WId id, NET::Properties properties, NET::Properties2 properties2); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** * The window changed. * @@ -723,20 +732,21 @@ * * @deprecated since 5.0 use windowChanged(WId, NET::Properties, NET::Properties2) */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::windowChanged(WId, NET::Properties, NET::Properties2)") QT_MOC_COMPAT void windowChanged(WId id, const unsigned long *properties); #endif +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** - * @deprecated * The window changed. * * The unsigned int parameter contains the NET properties that * were modified (see netwm_def.h). * @param id the id of the window * @param properties the properties that were modified + * @deprecated Since 5.0 */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KWindowSystem::windowChanged(WId, NET::Properties, NET::Properties2)") QT_MOC_COMPAT void windowChanged(WId id, unsigned int properties); #endif diff --git a/src/kwindowsystem.cpp b/src/kwindowsystem.cpp --- a/src/kwindowsystem.cpp +++ b/src/kwindowsystem.cpp @@ -28,7 +28,7 @@ #include #include #include -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 62) #include #endif #include @@ -155,7 +155,7 @@ Q_UNUSED(activities) } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId KWindowSystemPrivateDummy::transientFor(WId window) { Q_UNUSED(window) @@ -379,7 +379,7 @@ return d->windows(); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) KWindowInfo KWindowSystem::windowInfo(WId win, NET::Properties properties, NET::Properties2 properties2) { return KWindowInfo(win, properties, properties2); @@ -457,7 +457,7 @@ d->demandAttention(win, set); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId KWindowSystem::transientFor(WId win) { Q_D(KWindowSystem); @@ -486,7 +486,7 @@ } } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId KWindowSystem::groupLeader(WId win) { Q_D(KWindowSystem); @@ -564,15 +564,15 @@ d->unminimizeWindow(win); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) void KWindowSystem::minimizeWindow(WId win, bool animation) { Q_UNUSED(animation) minimizeWindow(win); } #endif -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) void KWindowSystem::unminimizeWindow(WId win, bool animation) { Q_UNUSED(animation) diff --git a/src/kwindowsystem_dummy_p.h b/src/kwindowsystem_dummy_p.h --- a/src/kwindowsystem_dummy_p.h +++ b/src/kwindowsystem_dummy_p.h @@ -38,7 +38,7 @@ void setOnAllDesktops(WId win, bool b) override; void setOnDesktop(WId win, int desktop) override; void setOnActivities(WId win, const QStringList &activities) override; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId transientFor(WId window) override; WId groupLeader(WId window) override; #endif diff --git a/src/kwindowsystem_p.h b/src/kwindowsystem_p.h --- a/src/kwindowsystem_p.h +++ b/src/kwindowsystem_p.h @@ -44,7 +44,7 @@ virtual void setOnAllDesktops(WId win, bool b) = 0; virtual void setOnDesktop(WId win, int desktop) = 0; virtual void setOnActivities(WId win, const QStringList &activities) = 0; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) virtual WId transientFor(WId window) = 0; virtual WId groupLeader(WId window) = 0; #endif diff --git a/src/netwm_def.h b/src/netwm_def.h --- a/src/netwm_def.h +++ b/src/netwm_def.h @@ -333,6 +333,8 @@ indicates that this is a dialog window **/ Dialog = 5, + // cannot deprecate to compiler: used both by clients & manager, later needs to keep supporting it for now + // KF6: remove /** @deprecated has unclear meaning and is KDE-only **/ @@ -472,10 +474,12 @@ windows). **/ KeepAbove = 1u << 6, +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** @deprecated This is an obsolete name for KeepAbove. **/ StaysOnTop = KeepAbove, // NOT STANDARD +#endif /** indicates that a window should not be included on a pager. **/ diff --git a/src/platforms/osx/kwindowsystem.cpp b/src/platforms/osx/kwindowsystem.cpp --- a/src/platforms/osx/kwindowsystem.cpp +++ b/src/platforms/osx/kwindowsystem.cpp @@ -338,7 +338,7 @@ return d->windows.contains(id); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) KWindowInfo KWindowSystem::windowInfo(WId win, unsigned long properties, unsigned long properties2) { KWindowSystemPrivate *d = KWindowSystem::s_d_func(); diff --git a/src/platforms/wayland/kwindowsystem.cpp b/src/platforms/wayland/kwindowsystem.cpp --- a/src/platforms/wayland/kwindowsystem.cpp +++ b/src/platforms/wayland/kwindowsystem.cpp @@ -93,7 +93,7 @@ Q_UNUSED(activities) } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId KWindowSystemPrivateWayland::transientFor(WId window) { Q_UNUSED(window) diff --git a/src/platforms/wayland/kwindowsystem_p_wayland.h b/src/platforms/wayland/kwindowsystem_p_wayland.h --- a/src/platforms/wayland/kwindowsystem_p_wayland.h +++ b/src/platforms/wayland/kwindowsystem_p_wayland.h @@ -38,7 +38,7 @@ void setOnAllDesktops(WId win, bool b) override; void setOnDesktop(WId win, int desktop) override; void setOnActivities(WId win, const QStringList &activities) override; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId transientFor(WId window) override; WId groupLeader(WId window) override; #endif diff --git a/src/platforms/windows/kwindowsystem.cpp b/src/platforms/windows/kwindowsystem.cpp --- a/src/platforms/windows/kwindowsystem.cpp +++ b/src/platforms/windows/kwindowsystem.cpp @@ -710,7 +710,7 @@ qDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet implemented!"; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) KWindowInfo KWindowSystem::windowInfo(WId win, unsigned long properties, unsigned long properties2) { KWindowSystem::init(INFO_WINDOWS); diff --git a/src/platforms/xcb/kkeyserver.cpp b/src/platforms/xcb/kkeyserver.cpp --- a/src/platforms/xcb/kkeyserver.cpp +++ b/src/platforms/xcb/kkeyserver.cpp @@ -829,7 +829,7 @@ return false; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 38) bool symXToKeyQt(uint keySym, int *keyQt) { return symXModXToKeyQt(keySym, 0, keyQt) & ~Qt::KeyboardModifierMask; diff --git a/src/platforms/xcb/kkeyserver_x11.h b/src/platforms/xcb/kkeyserver_x11.h --- a/src/platforms/xcb/kkeyserver_x11.h +++ b/src/platforms/xcb/kkeyserver_x11.h @@ -140,15 +140,16 @@ */ KWINDOWSYSTEM_EXPORT bool keyQtToModX(int keyQt, uint *mod); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 38) /** * Converts the given symbol to a Qt key code. * @param sym the symbol * @param keyQt if successful, the qt key code will be written here * @return true if successful, false otherwise * @deprecated since 5.38, use symXModXToKeyQt in order to support numeric keypad keys too */ -KWINDOWSYSTEM_DEPRECATED_EXPORT bool symXToKeyQt(uint sym, int *keyQt); +KWINDOWSYSTEM_DEPRECATED_VERSION(5, 38, "Use KKeyServer::symXModXToKeyQt(uint32_t, uint16_t, int *)") +KWINDOWSYSTEM_EXPORT bool symXToKeyQt(uint sym, int *keyQt); #endif /** 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 @@ -296,7 +296,7 @@ if (dirtyProperties || dirtyProperties2) { emit s_q->windowChanged(eventWindow); emit s_q->windowChanged(eventWindow, dirtyProperties, dirtyProperties2); -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) unsigned long dirty[ 2 ] = {dirtyProperties, dirtyProperties2}; emit s_q->windowChanged(eventWindow, dirty); emit s_q->windowChanged(eventWindow, dirtyProperties); @@ -451,7 +451,7 @@ } else if (signal == QMetaMethod::fromSignal(static_cast(&KWindowSystem::windowChanged))) { what = INFO_WINDOWS; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) else if (signal == QMetaMethod::fromSignal(static_cast(&KWindowSystem::windowChanged))) { what = INFO_WINDOWS; } else if (signal == QMetaMethod::fromSignal(static_cast(&KWindowSystem::windowChanged))) { @@ -677,15 +677,13 @@ info.setState(set ? NET::DemandsAttention : NET::States(), NET::DemandsAttention); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId KWindowSystemPrivateX11::transientFor(WId win) { KWindowInfo info(win, NET::Properties(), NET::WM2TransientFor); return info.transientFor(); } -#endif -#ifndef KWINDOWSYSTEM_NO_DEPRECATED WId KWindowSystemPrivateX11::groupLeader(WId win) { KWindowInfo info(win, NET::Properties(), NET::WM2GroupLeader); diff --git a/src/platforms/xcb/kwindowsystem_p_x11.h b/src/platforms/xcb/kwindowsystem_p_x11.h --- a/src/platforms/xcb/kwindowsystem_p_x11.h +++ b/src/platforms/xcb/kwindowsystem_p_x11.h @@ -43,7 +43,7 @@ void setOnAllDesktops(WId win, bool b) override; void setOnDesktop(WId win, int desktop) override; void setOnActivities(WId win, const QStringList &activities) override; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId transientFor(WId window) override; WId groupLeader(WId window) override; #endif diff --git a/src/platforms/xcb/kxmessages.h b/src/platforms/xcb/kxmessages.h --- a/src/platforms/xcb/kxmessages.h +++ b/src/platforms/xcb/kxmessages.h @@ -82,6 +82,8 @@ * @param screen X11 screen to use, -1 for the default */ void broadcastMessage(const char *msg_type, const QString &message, int screen = -1); +// Not 5.0, as KStartupInfo::sendStartupX uses this, and is only deprecated for 5.18 +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18) /** * Broadcasts the given message with the given message type. * @@ -93,8 +95,8 @@ * @return false when an error occurred, true otherwise * @deprecated since 5.0 use xcb variant */ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED static bool broadcastMessageX(Display *disp, const char *msg_type, + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KXMessages::broadcastMessageX(xcb_connection_t *, const char *, const QString &, int)") + static bool broadcastMessageX(Display *disp, const char *msg_type, const QString &message, int screen = -1); #endif /** diff --git a/src/platforms/xcb/kxmessages.cpp b/src/platforms/xcb/kxmessages.cpp --- a/src/platforms/xcb/kxmessages.cpp +++ b/src/platforms/xcb/kxmessages.cpp @@ -179,7 +179,7 @@ } }; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P); // for broadcasting @@ -233,7 +233,7 @@ a1, a2, d->handle->winId()); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) bool KXMessages::broadcastMessageX(Display *disp, const char *msg_type_P, const QString &message_P, int screen_P) { @@ -299,7 +299,7 @@ } #endif -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 18) static void send_message_internal(WId w_P, const QString &msg_P, long mask_P, Display *disp, Atom atom1_P, Atom atom2_P, Window handle_P) { diff --git a/src/platforms/xcb/netwm.h b/src/platforms/xcb/netwm.h --- a/src/platforms/xcb/netwm.h +++ b/src/platforms/xcb/netwm.h @@ -681,6 +681,7 @@ */ void sendPing(xcb_window_t window, xcb_timestamp_t timestamp); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** This function takes the passed XEvent and returns an OR'ed list of NETRootInfo properties that have changed in the properties argument. @@ -696,8 +697,8 @@ @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*) **/ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETRootInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)") + void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size); #endif /** * This function takes the passed xcb_generic_event_t and returns the updated properties in the passed in arguments. @@ -980,13 +981,14 @@ NET::Properties properties, NET::Properties2 properties2, Role role = Client); +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** This constructor differs from the above one only in the way it accepts the list of properties the client is interested in. @deprecated since 5.0 use above ctor **/ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED NETWinInfo(xcb_connection_t *connection, xcb_window_t window, + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo(xcb_connection_t *, xcb_window_t, xcb_window_t, NET::Properties, NET::Properties2, Role") + NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, NET::Properties properties, Role role = Client); #endif @@ -1058,6 +1060,7 @@ **/ NETExtendedStrut extendedStrut() const; + // Still used internally, e.g. by KWindowSystem::strutChanged() logic /** @deprecated use strutPartial() Returns the strut specified by this client. @@ -1186,6 +1189,7 @@ **/ void setExtendedStrut(const NETExtendedStrut &extended_strut); + // Still used internally, e.g. by KWindowSystem::strutChanged() logic /** @deprecated use setExtendedStrut() Set the strut for the application window. @@ -1518,6 +1522,7 @@ **/ NETFullscreenMonitors fullscreenMonitors() const; +#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0) /** This function takes the passed XEvent and returns an OR'ed list of NETWinInfo properties that have changed in the properties argument. @@ -1532,8 +1537,8 @@ @param properties_size size of the passed properties array @deprecated since 5.0 use event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*) **/ -#ifndef KWINDOWSYSTEM_NO_DEPRECATED - KWINDOWSYSTEM_DEPRECATED void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size); + KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use NETWinInfo::event(xcb_generic_event_t*, NET::Properties*, NET::Properties2*)") + void event(xcb_generic_event_t *event, unsigned long *properties, int properties_size); #endif /** * This function takes the passed in xcb_generic_event_t and returns the updated properties diff --git a/src/platforms/xcb/netwm.cpp b/src/platforms/xcb/netwm.cpp --- a/src/platforms/xcb/netwm.cpp +++ b/src/platforms/xcb/netwm.cpp @@ -1674,7 +1674,7 @@ return props; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) void NETRootInfo::event(xcb_generic_event_t *ev, unsigned long *properties, int properties_size) { unsigned long props[ PROPERTIES_SIZE ] = { 0, 0, 0, 0, 0 }; @@ -2622,7 +2622,7 @@ update(p->properties, p->properties2); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow, NET::Properties properties, Role role) { @@ -3849,7 +3849,7 @@ } } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) void NETWinInfo::event(xcb_generic_event_t *ev, unsigned long *properties, int properties_size) { NET::Properties p;