From abb9b0d2cda0212bc500e4e8edafe1ca621f3570 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 30 Mar 2023 19:48:15 +0300 Subject: [PATCH] Reshuffle desktop and activity related code in Window Keep virtual desktop and activity related code spatially close to improve code readability. --- src/window.cpp | 8 +++---- src/window.h | 58 ++++++++++++++++++++++---------------------------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index f675809a02..15bb417523 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -853,10 +853,6 @@ void Window::doSetDesktop() { } -void Window::doSetOnActivities(const QStringList &activityList) -{ -} - void Window::enterDesktop(VirtualDesktop *virtualDesktop) { if (m_desktops.contains(virtualDesktop)) { @@ -3229,6 +3225,10 @@ void Window::setOnActivities(const QStringList &newActivitiesList) #endif } +void Window::doSetOnActivities(const QStringList &activityList) +{ +} + /** * if @p all is true, sets on all activities. * if it's false, sets it to only be on the current activity diff --git a/src/window.h b/src/window.h index fdb18e1221..5bcb82ebb3 100644 --- a/src/window.h +++ b/src/window.h @@ -639,18 +639,35 @@ public: virtual bool isOutline() const; virtual bool isInternal() const; - QVector desktops() const; - virtual QStringList activities() const; - bool isOnDesktop(VirtualDesktop *desktop) const; - bool isOnActivity(const QString &activity) const; - bool isOnCurrentDesktop() const; - bool isOnCurrentActivity() const; - bool isOnAllDesktops() const; - bool isOnAllActivities() const; bool isLockScreenOverlay() const; - void setLockScreenOverlay(bool allowed); + QStringList desktopIds() const; + QVector desktops() const; + void setDesktops(QVector desktops); + void enterDesktop(VirtualDesktop *desktop); + void leaveDesktop(VirtualDesktop *desktop); + bool isOnDesktop(VirtualDesktop *desktop) const; + bool isOnCurrentDesktop() const; + bool isOnAllDesktops() const; + void setOnAllDesktops(bool set); + + virtual QStringList activities() const; + bool isOnActivity(const QString &activity) const; + bool isOnCurrentActivity() const; + bool isOnAllActivities() const; + void setOnActivity(const QString &activity, bool enable); + void setOnActivities(const QStringList &newActivitiesList); + void setOnAllActivities(bool all); + virtual void updateActivities(bool includeTransients); + void blockActivityUpdates(bool b = true); + + /** + * Refresh Window's cache of activites + * Called when activity daemon status changes + */ + virtual void checkActivities(){}; + virtual QString windowRole() const; QString resourceName() const; QString resourceClass() const; @@ -903,17 +920,6 @@ public: } void setShortcut(const QString &cut); bool performMouseCommand(Options::MouseCommand, const QPointF &globalPos); - void setOnAllDesktops(bool set); - void enterDesktop(VirtualDesktop *desktop); - void leaveDesktop(VirtualDesktop *desktop); - - /** - * Set the window as being on the attached list of desktops - * On X11 it will be set to the last entry - */ - void setDesktops(QVector desktops); - - QStringList desktopIds() const; void setMinimized(bool set); bool isMinimized() const @@ -969,18 +975,6 @@ public: virtual bool userCanSetNoBorder() const; virtual void checkNoBorder(); - /** - * Refresh Window's cache of activites - * Called when activity daemon status changes - */ - virtual void checkActivities(){}; - - void setOnActivity(const QString &activity, bool enable); - void setOnActivities(const QStringList &newActivitiesList); - void setOnAllActivities(bool all); - virtual void updateActivities(bool includeTransients); - void blockActivityUpdates(bool b = true); - const WindowRules *rules() const { return &m_rules;