diff --git a/CMakeLists.txt b/CMakeLists.txt index 29733ccea..3d6efde1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ project(lattedock) cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) set(VERSION 0.10.75) set(AUTHOR "Michail Vourlakos, Smith Ar") set(EMAIL "mvourlakos@gmail.com, audoban@openmailbox.org") @@ -51,9 +52,6 @@ string(REGEX REPLACE "\\." "" KF5_VERSION_MINOR ${KF5_VERSION_MINOR}) message(STATUS "KF5 VERSION : ${KF5_VERSION}") message(STATUS "KF5 VERSION MINOR : ${KF5_VERSION_MINOR}") -if(${KF5_VERSION_MINOR} LESS "62") -find_package(KF5 REQUIRED COMPONENTS SysGuard) -endif() include(ECMQMLModules) ecm_find_qmlmodule(QtQuick 2.7) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7f6db9e7b..d5b87be1a 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -53,57 +53,30 @@ add_executable(latte-dock ${lattedock-app_SRCS}) include(FakeTarget.cmake) -if(${KF5_VERSION_MINOR} LESS "62") - target_link_libraries(latte-dock - Qt5::DBus - Qt5::Quick - Qt5::Qml - KF5::Activities - KF5::Archive - KF5::CoreAddons - KF5::Crash - KF5::DBusAddons - KF5::Declarative - KF5::GuiAddons - KF5::GlobalAccel - KF5::I18n - KF5::IconThemes - KF5::KIOWidgets - KF5::Notifications - KF5::NewStuff - KF5::QuickAddons - KF5::Plasma - KF5::PlasmaQuick - KF5::ProcessCore - KF5::WaylandClient - KF5::XmlGui - ) -else() - target_link_libraries(latte-dock - Qt5::DBus - Qt5::Quick - Qt5::Qml - KF5::Activities - KF5::Archive - KF5::CoreAddons - KF5::Crash - KF5::DBusAddons - KF5::Declarative - KF5::GuiAddons - KF5::GlobalAccel - KF5::I18n - KF5::IconThemes - KF5::KIOWidgets - KF5::Notifications - KF5::NewStuff - KF5::QuickAddons - KF5::Plasma - KF5::PlasmaQuick - KF5::WaylandClient - KF5::XmlGui - ) +target_link_libraries(latte-dock + Qt5::DBus + Qt5::Quick + Qt5::Qml + KF5::Activities + KF5::Archive + KF5::CoreAddons + KF5::Crash + KF5::DBusAddons + KF5::Declarative + KF5::GuiAddons + KF5::GlobalAccel + KF5::I18n + KF5::IconThemes + KF5::KIOWidgets + KF5::Notifications + KF5::NewStuff + KF5::QuickAddons + KF5::Plasma + KF5::PlasmaQuick + KF5::WaylandClient + KF5::XmlGui +) -endif() if(HAVE_X11) target_link_libraries(latte-dock @@ -122,13 +95,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.latte-dock.desktop DESTINATION install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.latte-dock.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) install(FILES dbus/org.kde.LatteDock.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) install(FILES lattedock.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) +install(FILES latte-layouts.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR}) +install(FILES latte-indicators.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR}) -if(${KF5_VERSION_MINOR} LESS "57") - install(FILES latte-layouts.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) - install(FILES latte-indicators.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) -else() - install(FILES latte-layouts.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR}) - install(FILES latte-indicators.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR}) -endif() add_subdirectory(packageplugins) diff --git a/app/infoview.cpp b/app/infoview.cpp index f173c5e2e..62beb0d3b 100644 --- a/app/infoview.cpp +++ b/app/infoview.cpp @@ -80,12 +80,8 @@ void InfoView::init() KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); -#if KF5_VERSION_MINOR >= 45 kdeclarative.setupContext(); kdeclarative.setupEngine(engine()); -#else - kdeclarative.setupBindings(); -#endif auto source = QUrl::fromLocalFile(m_corona->kPackage().filePath("infoviewui")); setSource(source); diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index babee99e4..d49ced8fd 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -328,7 +328,7 @@ void Corona::setupWaylandIntegration() } }); -#if KF5_VERSION_MINOR >= 52 + QObject::connect(registry, &KWayland::Client::Registry::plasmaVirtualDesktopManagementAnnounced, [this, registry] (quint32 name, quint32 version) { KWayland::Client::PlasmaVirtualDesktopManagement *vdm = registry->createPlasmaVirtualDesktopManagement(name, version, this); @@ -339,7 +339,7 @@ void Corona::setupWaylandIntegration() wI->initVirtualDesktopManagement(vdm); } }); -#endif + registry->setup(); connection->roundtrip(); diff --git a/app/settings/viewsdialog/viewscontroller.cpp b/app/settings/viewsdialog/viewscontroller.cpp index 42dccec1e..414389efe 100644 --- a/app/settings/viewsdialog/viewscontroller.cpp +++ b/app/settings/viewsdialog/viewscontroller.cpp @@ -31,12 +31,8 @@ // KDE #include #include - -#if KF5_VERSION_MINOR >= 71 #include -#else -#include -#endif + namespace Latte { namespace Settings { @@ -604,12 +600,8 @@ void Views::showDefaultPersistentErrorWarningInlineMessage(const QString &messag QString file = openlayoutaction->data().toString(); if (!file.isEmpty()) { -#if KF5_VERSION_MINOR >= 71 auto job = new KIO::OpenUrlJob(QUrl::fromLocalFile(file), QStringLiteral("text/plain"), this); job->start(); -#else - KRun::runUrl(QUrl::fromLocalFile(file), QStringLiteral("text/plain"), m_view); -#endif showDefaultInlineMessageValidator(); } }); diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 939da5ec9..4040e84e2 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -581,8 +581,6 @@ void Effects::updateEffects() //! adjust mask coordinates based on local coordinates int fX = m_rect.x(); int fY = m_rect.y(); - -#if KF5_VERSION_MINOR >= 65 //! Latte is now using GtkFrameExtents so Effects geometries must be adjusted //! windows that use GtkFrameExtents and apply Effects on them they take GtkFrameExtents //! as granted @@ -593,7 +591,6 @@ void Effects::updateEffects() fX = qMax(0, fX - m_view->headThicknessGap()); } } -#endif //! There are cases that mask is NULL even though it should not //! Example: SidebarOnDemand from v0.10 that BEHAVEASPLASMAPANEL in EditMode diff --git a/app/view/settings/subconfigview.cpp b/app/view/settings/subconfigview.cpp index e7860ff6f..f4a4cba8d 100644 --- a/app/view/settings/subconfigview.cpp +++ b/app/view/settings/subconfigview.cpp @@ -117,12 +117,9 @@ void SubConfigView::init() KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.setTranslationDomain(QStringLiteral("latte-dock")); -#if KF5_VERSION_MINOR >= 45 kdeclarative.setupContext(); kdeclarative.setupEngine(engine()); -#else - kdeclarative.setupBindings(); -#endif + } Qt::WindowFlags SubConfigView::wFlags() const diff --git a/app/wm/tasktools.cpp b/app/wm/tasktools.cpp index d642b9b7c..3fec756d3 100644 --- a/app/wm/tasktools.cpp +++ b/app/wm/tasktools.cpp @@ -15,13 +15,7 @@ #include #include #include - -#if KF5_VERSION_MINOR >= 62 - #include -#else - #include - #include -#endif +#include #include #include @@ -492,30 +486,21 @@ KService::List servicesFromPid(quint32 pid, KSharedConfig::Ptr rulesConfig) return KService::List(); } -#if KF5_VERSION_MINOR >= 62 - auto proc = KProcessList::processInfo(pid); - if (!proc.isValid()) { - return KService::List(); - } - const QString cmdLine = proc.command(); -#else - KSysGuard::Processes procs; - procs.updateOrAddProcess(pid); +auto proc = KProcessList::processInfo(pid); +if (!proc.isValid()) { + return KService::List(); +} + +const QString cmdLine = proc.command(); - KSysGuard::Process *proc = procs.getProcess(pid); - const QString &cmdLine = proc ? proc->command().simplified() : QString(); // proc->command has a trailing space??? -#endif if (cmdLine.isEmpty()) { return KService::List(); } -#if KF5_VERSION_MINOR >= 62 - return servicesFromCmdLine(cmdLine, proc.name(), rulesConfig); -#else - return servicesFromCmdLine(cmdLine, proc->name(), rulesConfig); -#endif +return servicesFromCmdLine(cmdLine, proc.name(), rulesConfig); + } KService::List servicesFromCmdLine(const QString &_cmdLine, const QString &processName, diff --git a/app/wm/waylandinterface.cpp b/app/wm/waylandinterface.cpp index 5888c90f8..9a4cd9fd3 100644 --- a/app/wm/waylandinterface.cpp +++ b/app/wm/waylandinterface.cpp @@ -28,9 +28,8 @@ #include #include -#if KF5_VERSION_MINOR >= 52 #include -#endif + // X11 #include @@ -150,7 +149,6 @@ void WaylandInterface::initWindowManagement(KWayland::Client::PlasmaWindowManage }, Qt::QueuedConnection); } -#if KF5_VERSION_MINOR >= 52 void WaylandInterface::initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement) { if (m_virtualDesktopManagement == virtualDesktopManagement) { @@ -204,7 +202,6 @@ void WaylandInterface::setCurrentDesktop(QString desktop) m_currentDesktop = desktop; emit currentDesktopChanged(); } -#endif KWayland::Client::PlasmaShell *WaylandInterface::waylandCoronaInterface() const { @@ -256,9 +253,7 @@ void WaylandInterface::setViewExtraFlags(QObject *view, bool isPanelWindow, Latt } surface->setSkipTaskbar(true); -#if KF5_VERSION_MINOR >= 47 surface->setSkipSwitcher(true); -#endif bool atBottom{!isPanelWindow && (mode == Latte::Types::WindowsCanCover || mode == Latte::Types::WindowsAlwaysCover)}; @@ -323,7 +318,6 @@ void WaylandInterface::setViewStruts(QWindow &view, const QRect &rect, Plasma::T void WaylandInterface::switchToNextVirtualDesktop() { -#if KF5_VERSION_MINOR >= 52 if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { return; } @@ -344,12 +338,10 @@ void WaylandInterface::switchToNextVirtualDesktop() if (desktopObj) { desktopObj->requestActivate(); } -#endif } void WaylandInterface::switchToPreviousVirtualDesktop() { -#if KF5_VERSION_MINOR >= 52 if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { return; } @@ -370,7 +362,6 @@ void WaylandInterface::switchToPreviousVirtualDesktop() if (desktopObj) { desktopObj->requestActivate(); } -#endif } void WaylandInterface::setWindowOnActivities(const WindowId &wid, const QStringList &nextactivities) @@ -547,10 +538,7 @@ WindowInfoWrap WaylandInterface::requestInfo(WindowId wid) winfoWrap.setIsKeepAbove(w->isKeepAbove()); winfoWrap.setIsKeepBelow(w->isKeepBelow()); winfoWrap.setGeometry(w->geometry()); - -#if KF5_VERSION_MINOR >= 47 winfoWrap.setHasSkipSwitcher(w->skipSwitcher()); -#endif winfoWrap.setHasSkipTaskbar(w->skipTaskbar()); //! BEGIN:Window Abilities @@ -565,9 +553,7 @@ WindowInfoWrap WaylandInterface::requestInfo(WindowId wid) //! END:Window Abilities winfoWrap.setDisplay(w->title()); -#if KF5_VERSION_MINOR >= 52 winfoWrap.setDesktops(w->plasmaVirtualDesktops()); -#endif #if KF5_VERSION_MINOR >= 81 winfoWrap.setActivities(w->plasmaActivities()); @@ -716,7 +702,6 @@ void WaylandInterface::requestMoveWindow(WindowId wid, QPoint from) void WaylandInterface::requestToggleIsOnAllDesktops(WindowId wid) { -#if KF5_VERSION_MINOR >= 52 auto w = windowFor(wid); if (w && isValidWindow(w) && m_desktops.count() > 1) { @@ -730,7 +715,6 @@ void WaylandInterface::requestToggleIsOnAllDesktops(WindowId wid) } } } -#endif } void WaylandInterface::requestToggleKeepAbove(WindowId wid) @@ -782,11 +766,9 @@ void WaylandInterface::requestToggleMinimized(WindowId wid) WindowInfoWrap wInfo = requestInfo(wid); if (w && isValidWindow(w) && inCurrentDesktopActivity(wInfo)) { -#if KF5_VERSION_MINOR >= 52 if (!m_currentDesktop.isEmpty()) { w->requestEnterVirtualDesktop(m_currentDesktop); } -#endif w->requestToggleMinimized(); } } @@ -797,11 +779,9 @@ void WaylandInterface::requestToggleMaximized(WindowId wid) WindowInfoWrap wInfo = requestInfo(wid); if (w && isValidWindow(w) && windowCanBeMaximized(wid) && inCurrentDesktopActivity(wInfo)) { -#if KF5_VERSION_MINOR >= 52 if (!m_currentDesktop.isEmpty()) { w->requestEnterVirtualDesktop(m_currentDesktop); } -#endif w->requestToggleMaximized(); } } @@ -865,11 +845,8 @@ bool WaylandInterface::isAcceptableWindow(const KWayland::Client::PlasmaWindow * //! Window Checks bool hasSkipTaskbar = w->skipTaskbar(); bool isSkipped = hasSkipTaskbar; - -#if KF5_VERSION_MINOR >= 47 bool hasSkipSwitcher = w->skipSwitcher(); isSkipped = hasSkipTaskbar && hasSkipSwitcher; -#endif if (isSkipped && ((w->appId() == QLatin1String("yakuake") @@ -929,13 +906,9 @@ void WaylandInterface::trackWindow(KWayland::Client::PlasmaWindow *w) connect(w, &PlasmaWindow::skipTaskbarChanged, this, &WaylandInterface::updateWindow); connect(w, &PlasmaWindow::onAllDesktopsChanged, this, &WaylandInterface::updateWindow); connect(w, &PlasmaWindow::parentWindowChanged, this, &WaylandInterface::updateWindow); - -#if KF5_VERSION_MINOR >= 52 connect(w, &PlasmaWindow::plasmaVirtualDesktopEntered, this, &WaylandInterface::updateWindow); connect(w, &PlasmaWindow::plasmaVirtualDesktopLeft, this, &WaylandInterface::updateWindow); -#else - connect(w, &PlasmaWindow::virtualDesktopChanged, this, &WaylandInterface::updateWindow); -#endif + #if KF5_VERSION_MINOR >= 81 connect(w, &PlasmaWindow::plasmaActivityEntered, this, &WaylandInterface::updateWindow); @@ -962,13 +935,9 @@ void WaylandInterface::untrackWindow(KWayland::Client::PlasmaWindow *w) disconnect(w, &PlasmaWindow::skipTaskbarChanged, this, &WaylandInterface::updateWindow); disconnect(w, &PlasmaWindow::onAllDesktopsChanged, this, &WaylandInterface::updateWindow); disconnect(w, &PlasmaWindow::parentWindowChanged, this, &WaylandInterface::updateWindow); - -#if KF5_VERSION_MINOR >= 52 disconnect(w, &PlasmaWindow::plasmaVirtualDesktopEntered, this, &WaylandInterface::updateWindow); disconnect(w, &PlasmaWindow::plasmaVirtualDesktopLeft, this, &WaylandInterface::updateWindow); -#else - disconnect(w, &PlasmaWindow::virtualDesktopChanged, this, &WaylandInterface::updateWindow); -#endif + #if KF5_VERSION_MINOR >= 81 disconnect(w, &PlasmaWindow::plasmaActivityEntered, this, &WaylandInterface::updateWindow); diff --git a/app/wm/waylandinterface.h b/app/wm/waylandinterface.h index 63ae02dde..e62d6ecbb 100644 --- a/app/wm/waylandinterface.h +++ b/app/wm/waylandinterface.h @@ -92,10 +92,9 @@ public: void initWindowManagement(KWayland::Client::PlasmaWindowManagement *windowManagement); -#if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport void initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement); -#endif + private slots: void updateWindow(); @@ -115,11 +114,10 @@ private: KWayland::Client::PlasmaWindow *windowFor(WindowId wid); KWayland::Client::PlasmaShell *waylandCoronaInterface() const; -#if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport void setCurrentDesktop(QString desktop); void addDesktop(const QString &id, quint32 position); -#endif + private: friend class Private::GhostWindow; @@ -127,11 +125,10 @@ private: KWayland::Client::PlasmaWindowManagement *m_windowManagement{nullptr}; -#if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport KWayland::Client::PlasmaVirtualDesktopManagement *m_virtualDesktopManagement{nullptr}; QStringList m_desktops; -#endif + Latte::Corona *m_corona{nullptr}; }; diff --git a/app/wm/xwindowinterface.cpp b/app/wm/xwindowinterface.cpp index 3aeda6817..dc7732be5 100644 --- a/app/wm/xwindowinterface.cpp +++ b/app/wm/xwindowinterface.cpp @@ -93,12 +93,7 @@ void XWindowInterface::setViewExtraFlags(QObject *view,bool isPanelWindow, Latte KWindowSystem::setType(winId, NET::Normal); } -#if KF5_VERSION_MINOR >= 45 KWindowSystem::setState(winId, NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher); -#else - KWindowSystem::setState(winId, NET::SkipTaskbar | NET::SkipPager); -#endif - KWindowSystem::setOnAllDesktops(winId, true); //! Layer to be applied @@ -323,7 +318,6 @@ void XWindowInterface::setActiveEdge(QWindow *view, bool active) xcb_change_property(c, XCB_PROP_MODE_REPLACE, window->winId(), atom->atom, XCB_ATOM_CARDINAL, 32, 1, &value); } -#if KF5_VERSION_MINOR >= 65 QRect XWindowInterface::visibleGeometry(const WindowId &wid, const QRect &frameGeometry) const { NETWinInfo ni(QX11Info::connection(), wid.toUInt(), QX11Info::appRootWindow(), 0, NET::WM2GTKFrameExtents); @@ -337,7 +331,7 @@ QRect XWindowInterface::visibleGeometry(const WindowId &wid, const QRect &frameG return visibleGeometry; } -#endif + void XWindowInterface::setFrameExtents(QWindow *view, const QMargins &margins) @@ -346,7 +340,6 @@ void XWindowInterface::setFrameExtents(QWindow *view, const QMargins &margins) return; } -#if KF5_VERSION_MINOR >= 65 NETWinInfo ni(QX11Info::connection(), view->winId(), QX11Info::appRootWindow(), 0, NET::WM2GTKFrameExtents); if (margins.isNull()) { @@ -377,7 +370,7 @@ void XWindowInterface::setFrameExtents(QWindow *view, const QMargins &margins) NETStrut applied = ni2.gtkFrameExtents(); QMargins amargins(applied.left, applied.top, applied.right, applied.bottom); qDebug() << " window gtk frame extents applied :: " << amargins;*/ -#endif + } void XWindowInterface::checkShapeExtension() @@ -471,17 +464,11 @@ WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) winfoWrap.setIsShaded(winfo.hasState(NET::Shaded)); winfoWrap.setIsOnAllDesktops(winfo.onAllDesktops()); winfoWrap.setIsOnAllActivities(winfo.activities().empty()); -#if KF5_VERSION_MINOR >= 65 winfoWrap.setGeometry(visibleGeometry(wid, winfo.frameGeometry())); -#else - winfoWrap.setGeometry(winfo.frameGeometry()); -#endif winfoWrap.setIsKeepAbove(winfo.hasState(NET::KeepAbove)); winfoWrap.setIsKeepBelow(winfo.hasState(NET::KeepBelow)); winfoWrap.setHasSkipPager(winfo.hasState(NET::SkipPager)); -#if KF5_VERSION_MINOR >= 45 winfoWrap.setHasSkipSwitcher(winfo.hasState(NET::SkipSwitcher)); -#endif winfoWrap.setHasSkipTaskbar(winfo.hasState(NET::SkipTaskbar)); //! BEGIN:Window Abilities diff --git a/app/wm/xwindowinterface.h b/app/wm/xwindowinterface.h index 801cb87be..549ff84fa 100644 --- a/app/wm/xwindowinterface.h +++ b/app/wm/xwindowinterface.h @@ -75,9 +75,7 @@ private: bool isAcceptableWindow(WindowId wid); bool isValidWindow(WindowId wid); -#if KF5_VERSION_MINOR >= 65 QRect visibleGeometry(const WindowId &wid, const QRect &frameGeometry) const; -#endif void windowAddedProxy(WId wid); void windowChangedProxy(WId wid, NET::Properties prop1, NET::Properties2 prop2);