Make spring cleaning to match our KF5_MIN_VERSION

Since we already require 5.71.0 as min version of KF , it is meaning less to keep old checks for lower versions in code, this will make code more and more cleaner

Since all plasma using cpp17 and we recently switch to cpp14 think that it may be better to keep it more up-to-date and match with plasma
work/m_edgeslide
Ömer Fadıl Usta 3 years ago
parent aa57d21515
commit 3c5b474a97

@ -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)

@ -53,32 +53,6 @@ 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
@ -103,7 +77,6 @@ else()
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})
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)

@ -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);

@ -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();

@ -31,12 +31,8 @@
// KDE
#include <KMessageWidget>
#include <KSharedConfig>
#if KF5_VERSION_MINOR >= 71
#include <KIO/OpenUrlJob>
#else
#include <KRun>
#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();
}
});

@ -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

@ -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

@ -15,13 +15,7 @@
#include <KSharedConfig>
#include <KStartupInfo>
#include <KWindowSystem>
#if KF5_VERSION_MINOR >= 62
#include <KProcessList>
#else
#include <processcore/processes.h>
#include <processcore/process.h>
#endif
#include <QDir>
#include <QGuiApplication>
@ -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);
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
}
KService::List servicesFromCmdLine(const QString &_cmdLine, const QString &processName,

@ -28,9 +28,8 @@
#include <KWindowInfo>
#include <KWayland/Client/surface.h>
#if KF5_VERSION_MINOR >= 52
#include <KWayland/Client/plasmavirtualdesktop.h>
#endif
// X11
#include <NETWM>
@ -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);

@ -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};
};

@ -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

@ -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);

Loading…
Cancel
Save