mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-26 18:03:42 +03:00
move WM:Trackers in its own directory
This commit is contained in:
parent
36119d3d86
commit
99ec9cb2fd
@ -20,6 +20,7 @@ add_subdirectory(shortcuts)
|
||||
add_subdirectory(view)
|
||||
add_subdirectory(view/settings)
|
||||
add_subdirectory(wm)
|
||||
add_subdirectory(wm/tracker)
|
||||
|
||||
set(latte_dbusXML dbus/org.kde.LatteDock.xml)
|
||||
qt5_add_dbus_adaptor(lattedock-app_SRCS ${latte_dbusXML} lattecorona.h Latte::Corona lattedockadaptor)
|
||||
|
@ -40,9 +40,10 @@
|
||||
#include "view/view.h"
|
||||
#include "wm/abstractwindowinterface.h"
|
||||
#include "wm/schemecolors.h"
|
||||
#include "wm/schemestracker.h"
|
||||
#include "wm/waylandinterface.h"
|
||||
#include "wm/xwindowinterface.h"
|
||||
#include "wm/tracker/schemes.h"
|
||||
#include "wm/tracker/windows.h"
|
||||
|
||||
// Qt
|
||||
#include <QAction>
|
||||
|
@ -2,4 +2,5 @@ set(lattedock-app_SRCS
|
||||
${lattedock-app_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/primaryconfigview.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/secondaryconfigview.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "../lattecorona.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../wm/schemecolors.h"
|
||||
#include "../wm/windowstracker.h"
|
||||
#include "../wm/tracker/windows.h"
|
||||
#include "../../liblatte2/types.h"
|
||||
|
||||
namespace Latte {
|
||||
@ -52,49 +52,49 @@ WindowsTracker::~WindowsTracker()
|
||||
|
||||
void WindowsTracker::init()
|
||||
{
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::enabledChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit enabledChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::activeWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit activeWindowMaximizedChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::activeWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit activeWindowTouchingChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::existsWindowActiveChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowActiveChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit existsWindowActiveChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::existsWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit existsWindowMaximizedChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::existsWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit existsWindowTouchingChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit activeWindowSchemeChanged();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::WindowsTracker::touchingWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||||
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::touchingWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||||
if (m_latteView == view) {
|
||||
emit touchingWindowSchemeChanged();
|
||||
}
|
||||
|
@ -2,10 +2,8 @@ set(lattedock-app_SRCS
|
||||
${lattedock-app_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractwindowinterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/schemecolors.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/schemestracker.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/waylandinterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/windowinfowrap.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/windowstracker.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xwindowinterface.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "abstractwindowinterface.h"
|
||||
|
||||
// local
|
||||
#include "schemestracker.h"
|
||||
#include "windowstracker.h"
|
||||
#include "tracker/schemes.h"
|
||||
#include "tracker/windows.h"
|
||||
#include "../lattecorona.h"
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ AbstractWindowInterface::AbstractWindowInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_corona = qobject_cast<Latte::Corona *>(parent);
|
||||
m_windowsTracker = new WindowsTracker(this);
|
||||
m_schemesTracker = new SchemesTracker(this);
|
||||
m_windowsTracker = new Tracker::Windows(this);
|
||||
m_schemesTracker = new Tracker::Schemes(this);
|
||||
|
||||
m_windowWaitingTimer.setInterval(150);
|
||||
m_windowWaitingTimer.setSingleShot(true);
|
||||
@ -63,12 +63,12 @@ Latte::Corona *AbstractWindowInterface::corona()
|
||||
return m_corona;
|
||||
}
|
||||
|
||||
SchemesTracker *AbstractWindowInterface::schemesTracker()
|
||||
Tracker::Schemes *AbstractWindowInterface::schemesTracker()
|
||||
{
|
||||
return m_schemesTracker;
|
||||
}
|
||||
|
||||
WindowsTracker *AbstractWindowInterface::windowsTracker()
|
||||
Tracker::Windows *AbstractWindowInterface::windowsTracker()
|
||||
{
|
||||
return m_windowsTracker;
|
||||
}
|
||||
|
@ -51,8 +51,10 @@
|
||||
namespace Latte {
|
||||
class Corona;
|
||||
namespace WindowSystem {
|
||||
class SchemesTracker;
|
||||
class WindowsTracker;
|
||||
namespace Tracker {
|
||||
class Schemes;
|
||||
class Windows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +106,8 @@ public:
|
||||
virtual WindowId winIdFor(QString appId, QRect geometry) const = 0;
|
||||
|
||||
Latte::Corona *corona();
|
||||
SchemesTracker *schemesTracker();
|
||||
WindowsTracker *windowsTracker();
|
||||
Tracker::Schemes *schemesTracker();
|
||||
Tracker::Windows *windowsTracker();
|
||||
|
||||
signals:
|
||||
void activeWindowChanged(WindowId wid);
|
||||
@ -128,9 +130,8 @@ protected:
|
||||
|
||||
private:
|
||||
Latte::Corona *m_corona;
|
||||
SchemesTracker *m_schemesTracker;
|
||||
WindowsTracker *m_windowsTracker;
|
||||
|
||||
Tracker::Schemes *m_schemesTracker;
|
||||
Tracker::Windows *m_windowsTracker;
|
||||
};
|
||||
|
||||
}
|
||||
|
6
app/wm/tracker/CMakeLists.txt
Normal file
6
app/wm/tracker/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
set(lattedock-app_SRCS
|
||||
${lattedock-app_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/windows.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/schemes.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
@ -17,12 +17,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "schemestracker.h"
|
||||
#include "schemes.h"
|
||||
|
||||
// local
|
||||
#include "abstractwindowinterface.h"
|
||||
#include "schemecolors.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../abstractwindowinterface.h"
|
||||
#include "../../lattecorona.h"
|
||||
|
||||
// Qt
|
||||
#include <QDir>
|
||||
@ -33,15 +32,16 @@
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
namespace Tracker {
|
||||
|
||||
SchemesTracker::SchemesTracker(AbstractWindowInterface *parent)
|
||||
Schemes::Schemes(AbstractWindowInterface *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_wm = parent;
|
||||
init();
|
||||
}
|
||||
|
||||
SchemesTracker::~SchemesTracker()
|
||||
Schemes::~Schemes()
|
||||
{
|
||||
m_windowScheme.clear();
|
||||
//! it is just a reference to a real scheme file
|
||||
@ -50,7 +50,7 @@ SchemesTracker::~SchemesTracker()
|
||||
m_schemes.clear();
|
||||
}
|
||||
|
||||
void SchemesTracker::init()
|
||||
void Schemes::init()
|
||||
{
|
||||
updateDefaultScheme();
|
||||
|
||||
@ -77,7 +77,7 @@ void SchemesTracker::init()
|
||||
}
|
||||
|
||||
//! Scheme support for windows
|
||||
void SchemesTracker::updateDefaultScheme()
|
||||
void Schemes::updateDefaultScheme()
|
||||
{
|
||||
QString defaultSchemePath = SchemeColors::possibleSchemeFile("kdeglobals");
|
||||
|
||||
@ -97,7 +97,7 @@ void SchemesTracker::updateDefaultScheme()
|
||||
}
|
||||
}
|
||||
|
||||
SchemeColors *SchemesTracker::schemeForWindow(WindowId wid)
|
||||
SchemeColors *Schemes::schemeForWindow(WindowId wid)
|
||||
{
|
||||
if (!m_windowScheme.contains(wid)) {
|
||||
return m_schemes["kdeglobals"];
|
||||
@ -108,7 +108,7 @@ SchemeColors *SchemesTracker::schemeForWindow(WindowId wid)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SchemesTracker::setColorSchemeForWindow(WindowId wid, QString scheme)
|
||||
void Schemes::setColorSchemeForWindow(WindowId wid, QString scheme)
|
||||
{
|
||||
if (scheme == "kdeglobals" && !m_windowScheme.contains(wid)) {
|
||||
//default scheme does not have to be set
|
||||
@ -136,3 +136,4 @@ void SchemesTracker::setColorSchemeForWindow(WindowId wid, QString scheme)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,8 @@
|
||||
#ifndef SCHEMESTRACKER_H
|
||||
#define SCHEMESTRACKER_H
|
||||
|
||||
#include "windowinfowrap.h"
|
||||
// local
|
||||
#include "../windowinfowrap.h"
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
@ -35,13 +36,14 @@ class SchemeColors;
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
namespace Tracker {
|
||||
|
||||
class SchemesTracker : public QObject {
|
||||
class Schemes : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SchemesTracker(AbstractWindowInterface *parent);
|
||||
~SchemesTracker() override;
|
||||
Schemes(AbstractWindowInterface *parent);
|
||||
~Schemes() override;
|
||||
|
||||
SchemeColors *schemeForWindow(WindowId wId);
|
||||
void setColorSchemeForWindow(WindowId wId, QString scheme);
|
||||
@ -56,12 +58,13 @@ private:
|
||||
AbstractWindowInterface *m_wm;
|
||||
|
||||
//! scheme file and its loaded colors
|
||||
QMap<QString, SchemeColors *> m_schemes;
|
||||
QMap<QString, Latte::WindowSystem::SchemeColors *> m_schemes;
|
||||
|
||||
//! window id and its corresponding scheme file
|
||||
QMap<WindowId, QString> m_windowScheme;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,22 +17,23 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "windowstracker.h"
|
||||
#include "windows.h"
|
||||
|
||||
// local
|
||||
#include "abstractwindowinterface.h"
|
||||
#include "schemecolors.h"
|
||||
#include "schemestracker.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../view/view.h"
|
||||
#include "../view/positioner.h"
|
||||
#include "../../liblatte2/types.h"
|
||||
#include "schemes.h"
|
||||
#include "../abstractwindowinterface.h"
|
||||
#include "../schemecolors.h"
|
||||
#include "../../lattecorona.h"
|
||||
#include "../../layouts/manager.h"
|
||||
#include "../../view/view.h"
|
||||
#include "../../view/positioner.h"
|
||||
#include "../../../liblatte2/types.h"
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
namespace Tracker {
|
||||
|
||||
WindowsTracker::WindowsTracker(AbstractWindowInterface *parent)
|
||||
Windows::Windows(AbstractWindowInterface *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_wm = parent;
|
||||
@ -40,13 +41,13 @@ WindowsTracker::WindowsTracker(AbstractWindowInterface *parent)
|
||||
init();
|
||||
}
|
||||
|
||||
WindowsTracker::~WindowsTracker()
|
||||
Windows::~Windows()
|
||||
{
|
||||
}
|
||||
|
||||
void WindowsTracker::init()
|
||||
void Windows::init()
|
||||
{
|
||||
connect(m_wm->corona(), &Plasma::Corona::availableScreenRectChanged, this, &WindowsTracker::updateAvailableScreenGeometries);
|
||||
connect(m_wm->corona(), &Plasma::Corona::availableScreenRectChanged, this, &Windows::updateAvailableScreenGeometries);
|
||||
|
||||
connect(m_wm, &AbstractWindowInterface::windowChanged, this, [&](WindowId wid) {
|
||||
m_windows[wid] = m_wm->requestInfo(wid);
|
||||
@ -92,7 +93,7 @@ void WindowsTracker::init()
|
||||
});
|
||||
}
|
||||
|
||||
void WindowsTracker::initViewHints(Latte::View *view)
|
||||
void Windows::initViewHints(Latte::View *view)
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return;
|
||||
@ -107,7 +108,7 @@ void WindowsTracker::initViewHints(Latte::View *view)
|
||||
setTouchingWindowScheme(view, nullptr);
|
||||
}
|
||||
|
||||
void WindowsTracker::addView(Latte::View *view)
|
||||
void Windows::addView(Latte::View *view)
|
||||
{
|
||||
if (m_views.contains(view)) {
|
||||
return;
|
||||
@ -120,7 +121,7 @@ void WindowsTracker::addView(Latte::View *view)
|
||||
updateHints(view);
|
||||
}
|
||||
|
||||
void WindowsTracker::removeView(Latte::View *view)
|
||||
void Windows::removeView(Latte::View *view)
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return;
|
||||
@ -131,7 +132,7 @@ void WindowsTracker::removeView(Latte::View *view)
|
||||
|
||||
//! Views Properties And Hints
|
||||
|
||||
bool WindowsTracker::enabled(Latte::View *view)
|
||||
bool Windows::enabled(Latte::View *view)
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -140,7 +141,7 @@ bool WindowsTracker::enabled(Latte::View *view)
|
||||
return m_views[view].enabled;
|
||||
}
|
||||
|
||||
void WindowsTracker::setEnabled(Latte::View *view, const bool enabled)
|
||||
void Windows::setEnabled(Latte::View *view, const bool enabled)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].enabled == enabled) {
|
||||
return;
|
||||
@ -157,7 +158,7 @@ void WindowsTracker::setEnabled(Latte::View *view, const bool enabled)
|
||||
emit enabledChanged(view);
|
||||
}
|
||||
|
||||
bool WindowsTracker::activeWindowMaximized(Latte::View *view) const
|
||||
bool Windows::activeWindowMaximized(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -166,7 +167,7 @@ bool WindowsTracker::activeWindowMaximized(Latte::View *view) const
|
||||
return m_views[view].activeWindowMaximized;
|
||||
}
|
||||
|
||||
void WindowsTracker::setActiveWindowMaximized(Latte::View *view, bool activeMaximized)
|
||||
void Windows::setActiveWindowMaximized(Latte::View *view, bool activeMaximized)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].activeWindowMaximized == activeMaximized) {
|
||||
return;
|
||||
@ -176,7 +177,7 @@ void WindowsTracker::setActiveWindowMaximized(Latte::View *view, bool activeMaxi
|
||||
emit activeWindowMaximizedChanged(view);
|
||||
}
|
||||
|
||||
bool WindowsTracker::activeWindowTouching(Latte::View *view) const
|
||||
bool Windows::activeWindowTouching(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -185,7 +186,7 @@ bool WindowsTracker::activeWindowTouching(Latte::View *view) const
|
||||
return m_views[view].activeWindowTouching;
|
||||
}
|
||||
|
||||
void WindowsTracker::setActiveWindowTouching(Latte::View *view, bool activeTouching)
|
||||
void Windows::setActiveWindowTouching(Latte::View *view, bool activeTouching)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].activeWindowTouching == activeTouching) {
|
||||
return;
|
||||
@ -195,7 +196,7 @@ void WindowsTracker::setActiveWindowTouching(Latte::View *view, bool activeTouch
|
||||
emit activeWindowTouchingChanged(view);
|
||||
}
|
||||
|
||||
bool WindowsTracker::existsWindowActive(Latte::View *view) const
|
||||
bool Windows::existsWindowActive(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -204,7 +205,7 @@ bool WindowsTracker::existsWindowActive(Latte::View *view) const
|
||||
return m_views[view].existsWindowActive;
|
||||
}
|
||||
|
||||
void WindowsTracker::setExistsWindowActive(Latte::View *view, bool windowActive)
|
||||
void Windows::setExistsWindowActive(Latte::View *view, bool windowActive)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].existsWindowActive == windowActive) {
|
||||
return;
|
||||
@ -214,7 +215,7 @@ void WindowsTracker::setExistsWindowActive(Latte::View *view, bool windowActive)
|
||||
emit existsWindowActiveChanged(view);
|
||||
}
|
||||
|
||||
bool WindowsTracker::existsWindowMaximized(Latte::View *view) const
|
||||
bool Windows::existsWindowMaximized(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -223,7 +224,7 @@ bool WindowsTracker::existsWindowMaximized(Latte::View *view) const
|
||||
return m_views[view].existsWindowMaximized;
|
||||
}
|
||||
|
||||
void WindowsTracker::setExistsWindowMaximized(Latte::View *view, bool windowMaximized)
|
||||
void Windows::setExistsWindowMaximized(Latte::View *view, bool windowMaximized)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].existsWindowMaximized == windowMaximized) {
|
||||
return;
|
||||
@ -233,7 +234,7 @@ void WindowsTracker::setExistsWindowMaximized(Latte::View *view, bool windowMaxi
|
||||
emit existsWindowMaximizedChanged(view);
|
||||
}
|
||||
|
||||
bool WindowsTracker::existsWindowTouching(Latte::View *view) const
|
||||
bool Windows::existsWindowTouching(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return false;
|
||||
@ -242,7 +243,7 @@ bool WindowsTracker::existsWindowTouching(Latte::View *view) const
|
||||
return m_views[view].existsWindowTouching;
|
||||
}
|
||||
|
||||
void WindowsTracker::setExistsWindowTouching(Latte::View *view, bool windowTouching)
|
||||
void Windows::setExistsWindowTouching(Latte::View *view, bool windowTouching)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].existsWindowTouching == windowTouching) {
|
||||
return;
|
||||
@ -252,7 +253,7 @@ void WindowsTracker::setExistsWindowTouching(Latte::View *view, bool windowTouch
|
||||
emit existsWindowTouchingChanged(view);
|
||||
}
|
||||
|
||||
SchemeColors *WindowsTracker::activeWindowScheme(Latte::View *view) const
|
||||
SchemeColors *Windows::activeWindowScheme(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return nullptr;
|
||||
@ -261,7 +262,7 @@ SchemeColors *WindowsTracker::activeWindowScheme(Latte::View *view) const
|
||||
return m_views[view].activeWindowScheme;
|
||||
}
|
||||
|
||||
void WindowsTracker::setActiveWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme)
|
||||
void Windows::setActiveWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].activeWindowScheme == scheme) {
|
||||
return;
|
||||
@ -271,7 +272,7 @@ void WindowsTracker::setActiveWindowScheme(Latte::View *view, WindowSystem::Sche
|
||||
emit activeWindowSchemeChanged(view);
|
||||
}
|
||||
|
||||
SchemeColors *WindowsTracker::touchingWindowScheme(Latte::View *view) const
|
||||
SchemeColors *Windows::touchingWindowScheme(Latte::View *view) const
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return nullptr;
|
||||
@ -280,7 +281,7 @@ SchemeColors *WindowsTracker::touchingWindowScheme(Latte::View *view) const
|
||||
return m_views[view].touchingWindowScheme;
|
||||
}
|
||||
|
||||
void WindowsTracker::setTouchingWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme)
|
||||
void Windows::setTouchingWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme)
|
||||
{
|
||||
if (!m_views.contains(view) || m_views[view].touchingWindowScheme == scheme) {
|
||||
return;
|
||||
@ -290,7 +291,7 @@ void WindowsTracker::setTouchingWindowScheme(Latte::View *view, WindowSystem::Sc
|
||||
emit touchingWindowSchemeChanged(view);
|
||||
}
|
||||
|
||||
WindowInfoWrap WindowsTracker::lastActiveWindowInfo(Latte::View *view)
|
||||
WindowInfoWrap Windows::lastActiveWindowInfo(Latte::View *view)
|
||||
{
|
||||
WindowInfoWrap info;
|
||||
if (!m_views.contains(view)) {
|
||||
@ -307,28 +308,28 @@ WindowInfoWrap WindowsTracker::lastActiveWindowInfo(Latte::View *view)
|
||||
|
||||
//! Windows Criteria Functions
|
||||
|
||||
bool WindowsTracker::inCurrentDesktopActivity(const WindowInfoWrap &winfo)
|
||||
bool Windows::inCurrentDesktopActivity(const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && m_wm->isOnCurrentDesktop(winfo.wid()) && m_wm->isOnCurrentActivity(winfo.wid()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::intersects(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
bool Windows::intersects(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (!winfo.isMinimized() && !winfo.isShaded() && winfo.geometry().intersects(view->absoluteGeometry()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isActive(const WindowInfoWrap &winfo)
|
||||
bool Windows::isActive(const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized());
|
||||
}
|
||||
|
||||
bool WindowsTracker::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
bool Windows::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized()
|
||||
&& m_views[view].availableScreenGeometry.contains(winfo.geometry().center()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
auto viewIntersectsMaxVert = [&]() noexcept -> bool {
|
||||
return ((winfo.isMaxVert()
|
||||
@ -349,12 +350,12 @@ bool WindowsTracker::isMaximizedInViewScreen(Latte::View *view, const WindowInfo
|
||||
&& m_views[view].availableScreenGeometry.contains(winfo.geometry().center()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo)
|
||||
bool Windows::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && intersects(view, winfo));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isTouchingViewEdge(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
bool Windows::isTouchingViewEdge(Latte::View *view, const WindowInfoWrap &winfo)
|
||||
{
|
||||
if (winfo.isValid() && !winfo.isMinimized()) {
|
||||
bool touchingViewEdge{false};
|
||||
@ -382,7 +383,7 @@ bool WindowsTracker::isTouchingViewEdge(Latte::View *view, const WindowInfoWrap
|
||||
return false;
|
||||
}
|
||||
|
||||
void WindowsTracker::cleanupFaultyWindows()
|
||||
void Windows::cleanupFaultyWindows()
|
||||
{
|
||||
for (const auto &key : m_windows.keys()) {
|
||||
auto winfo = m_windows[key];
|
||||
@ -396,7 +397,7 @@ void WindowsTracker::cleanupFaultyWindows()
|
||||
}
|
||||
|
||||
|
||||
void WindowsTracker::updateAvailableScreenGeometries()
|
||||
void Windows::updateAvailableScreenGeometries()
|
||||
{
|
||||
for (const auto view : m_views.keys()) {
|
||||
if (m_views[view].enabled) {
|
||||
@ -412,7 +413,7 @@ void WindowsTracker::updateAvailableScreenGeometries()
|
||||
}
|
||||
}
|
||||
|
||||
void WindowsTracker::updateViewsHints()
|
||||
void Windows::updateViewsHints()
|
||||
{
|
||||
for (const auto view : m_views.keys()) {
|
||||
if (m_views[view].enabled) {
|
||||
@ -421,7 +422,7 @@ void WindowsTracker::updateViewsHints()
|
||||
}
|
||||
}
|
||||
|
||||
void WindowsTracker::updateHints(Latte::View *view)
|
||||
void Windows::updateHints(Latte::View *view)
|
||||
{
|
||||
if (!m_views.contains(view)) {
|
||||
return;
|
||||
@ -527,6 +528,6 @@ void WindowsTracker::updateHints(Latte::View *view)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
#define WINDOWSYSTEMWINDOWSTRACKER_H
|
||||
|
||||
// local
|
||||
#include "windowinfowrap.h"
|
||||
#include "../windowinfowrap.h"
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
@ -39,6 +39,7 @@ class SchemeColors;
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
namespace Tracker {
|
||||
|
||||
struct ViewHints {
|
||||
bool enabled{false};
|
||||
@ -53,12 +54,12 @@ struct ViewHints {
|
||||
SchemeColors *touchingWindowScheme{nullptr};
|
||||
};
|
||||
|
||||
class WindowsTracker : public QObject {
|
||||
class Windows : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WindowsTracker(AbstractWindowInterface *parent);
|
||||
~WindowsTracker() override;
|
||||
Windows(AbstractWindowInterface *parent);
|
||||
~Windows() override;
|
||||
|
||||
void addView(Latte::View *view);
|
||||
void removeView(Latte::View *view);
|
||||
@ -119,6 +120,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user