mirror of
https://github.com/KDE/latte-dock.git
synced 2025-02-22 13:57:44 +03:00
REFACTOR:add WindowSystem namespace
This commit is contained in:
parent
7b094d7007
commit
ad788130ab
@ -94,9 +94,9 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, int use
|
||||
//! create the window manager
|
||||
|
||||
if (KWindowSystem::isPlatformWayland()) {
|
||||
m_wm = new WaylandInterface(this);
|
||||
m_wm = new WindowSystem::WaylandInterface(this);
|
||||
} else {
|
||||
m_wm = new XWindowInterface(this);
|
||||
m_wm = new WindowSystem::XWindowInterface(this);
|
||||
}
|
||||
|
||||
setupWaylandIntegration();
|
||||
@ -291,7 +291,7 @@ void Corona::setupWaylandIntegration()
|
||||
[this, registry](quint32 name, quint32 version) {
|
||||
KWayland::Client::PlasmaWindowManagement *pwm = registry->createPlasmaWindowManagement(name, version, this);
|
||||
|
||||
WaylandInterface *wI = qobject_cast<WaylandInterface *>(m_wm);
|
||||
WindowSystem::WaylandInterface *wI = qobject_cast<WindowSystem::WaylandInterface *>(m_wm);
|
||||
|
||||
if (wI) {
|
||||
wI->initWindowManagement(pwm);
|
||||
@ -398,7 +398,7 @@ UniversalSettings *Corona::universalSettings() const
|
||||
return m_universalSettings;
|
||||
}
|
||||
|
||||
AbstractWindowInterface *Corona::wm() const
|
||||
WindowSystem::AbstractWindowInterface *Corona::wm() const
|
||||
{
|
||||
return m_wm;
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ class PlasmaShell;
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
class AbstractWindowInterface;
|
||||
class ScreenPool;
|
||||
class GlobalShortcuts;
|
||||
class UniversalSettings;
|
||||
@ -81,6 +80,9 @@ namespace PlasmaExtended{
|
||||
class ScreenPool;
|
||||
class Theme;
|
||||
}
|
||||
namespace WindowSystem{
|
||||
class AbstractWindowInterface;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -118,18 +120,19 @@ public:
|
||||
KActivities::Consumer *activityConsumer() const;
|
||||
KWayland::Client::PlasmaShell *waylandCoronaInterface() const;
|
||||
|
||||
AbstractWindowInterface *wm() const;
|
||||
KActivities::Consumer *activitiesConsumer() const;
|
||||
GlobalShortcuts *globalShortcuts() const;
|
||||
ScreenPool *screenPool() const;
|
||||
UniversalSettings *universalSettings() const;
|
||||
Layouts::Manager *layoutsManager() const;
|
||||
Layouts::Manager *layoutsManager() const;
|
||||
|
||||
Indicator::Factory *indicatorFactory() const;
|
||||
|
||||
PlasmaExtended::ScreenPool *plasmaScreenPool() const;
|
||||
PlasmaExtended::Theme *themeExtended() const;
|
||||
|
||||
WindowSystem::AbstractWindowInterface *wm() const;
|
||||
|
||||
//! these functions are used from context menu through containmentactions
|
||||
void switchToLayout(QString layout);
|
||||
void showSettingsWindow(int page);
|
||||
@ -200,7 +203,6 @@ private:
|
||||
KActivities::Consumer *m_activityConsumer;
|
||||
QPointer<KAboutApplicationDialog> aboutDialog;
|
||||
|
||||
AbstractWindowInterface *m_wm{nullptr};
|
||||
ScreenPool *m_screenPool{nullptr};
|
||||
UniversalSettings *m_universalSettings{nullptr};
|
||||
GlobalShortcuts *m_globalShortcuts{nullptr};
|
||||
@ -211,6 +213,8 @@ private:
|
||||
PlasmaExtended::ScreenPool *m_plasmaScreenPool{nullptr};
|
||||
PlasmaExtended::Theme *m_themeExtended{nullptr};
|
||||
|
||||
WindowSystem::AbstractWindowInterface *m_wm{nullptr};
|
||||
|
||||
KWayland::Client::PlasmaShell *m_waylandCorona{nullptr};
|
||||
|
||||
friend class GlobalShortcuts;
|
||||
|
@ -149,17 +149,17 @@ float Theme::backgroundMaxOpacity() const
|
||||
return m_backgroundMaxOpacity;
|
||||
}
|
||||
|
||||
Latte::SchemeColors *Theme::defaultTheme() const
|
||||
WindowSystem::SchemeColors *Theme::defaultTheme() const
|
||||
{
|
||||
return m_defaultScheme;
|
||||
}
|
||||
|
||||
Latte::SchemeColors *Theme::lightTheme() const
|
||||
WindowSystem::SchemeColors *Theme::lightTheme() const
|
||||
{
|
||||
return m_isLightTheme ? m_defaultScheme : m_reversedScheme;
|
||||
}
|
||||
|
||||
Latte::SchemeColors *Theme::darkTheme() const
|
||||
WindowSystem::SchemeColors *Theme::darkTheme() const
|
||||
{
|
||||
return !m_isLightTheme ? m_defaultScheme : m_reversedScheme;
|
||||
}
|
||||
@ -200,12 +200,12 @@ void Theme::updateDefaultScheme()
|
||||
updateDefaultSchemeValues();
|
||||
|
||||
if (m_defaultScheme) {
|
||||
disconnect(m_defaultScheme, &Latte::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness);
|
||||
disconnect(m_defaultScheme, &WindowSystem::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness);
|
||||
m_defaultScheme->deleteLater();
|
||||
}
|
||||
|
||||
m_defaultScheme = new Latte::SchemeColors(this, m_defaultSchemePath, true);
|
||||
connect(m_defaultScheme, &Latte::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness);
|
||||
m_defaultScheme = new WindowSystem::SchemeColors(this, m_defaultSchemePath, true);
|
||||
connect(m_defaultScheme, &WindowSystem::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness);
|
||||
|
||||
qDebug() << "plasma theme default colors ::: " << m_defaultSchemePath;
|
||||
}
|
||||
@ -244,7 +244,7 @@ void Theme::updateReversedScheme()
|
||||
m_reversedScheme->deleteLater();
|
||||
}
|
||||
|
||||
m_reversedScheme = new Latte::SchemeColors(this, m_reversedSchemePath, true);
|
||||
m_reversedScheme = new WindowSystem::SchemeColors(this, m_reversedSchemePath, true);
|
||||
|
||||
qDebug() << "plasma theme reversed colors ::: " << m_reversedSchemePath;
|
||||
}
|
||||
@ -299,7 +299,7 @@ void Theme::updateReversedSchemeValues()
|
||||
}
|
||||
|
||||
//! update scheme name
|
||||
QString originalSchemeName = Latte::SchemeColors::schemeName(m_originalSchemePath);
|
||||
QString originalSchemeName = WindowSystem::SchemeColors::schemeName(m_originalSchemePath);
|
||||
KConfigGroup generalGroup(reversedPtr, "General");
|
||||
generalGroup.writeEntry("Name", originalSchemeName + "_reversed");
|
||||
generalGroup.sync();
|
||||
@ -426,17 +426,17 @@ void Theme::loadThemePaths()
|
||||
|
||||
m_kdeConnections[0] = connect(KDirWatch::self(), &KDirWatch::dirty, this, [ &, kdeSettingsFile](const QString & path) {
|
||||
if (path == kdeSettingsFile) {
|
||||
this->setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
this->setOriginalSchemeFile(WindowSystem::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
}
|
||||
});
|
||||
|
||||
m_kdeConnections[1] = connect(KDirWatch::self(), &KDirWatch::created, this, [ &, kdeSettingsFile](const QString & path) {
|
||||
if (path == kdeSettingsFile) {
|
||||
this->setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
this->setOriginalSchemeFile(WindowSystem::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
}
|
||||
});
|
||||
|
||||
setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
setOriginalSchemeFile(WindowSystem::SchemeColors::possibleSchemeFile("kdeglobals"));
|
||||
}
|
||||
|
||||
//! this is probably not needed at all in order to provide full transparency for all
|
||||
|
@ -38,8 +38,10 @@
|
||||
|
||||
namespace Latte {
|
||||
class Corona;
|
||||
namespace WindowSystem {
|
||||
class SchemeColors;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
namespace PlasmaExtended {
|
||||
@ -60,9 +62,9 @@ class Theme: public QObject
|
||||
|
||||
Q_PROPERTY(float backgroundMaxOpacity READ backgroundMaxOpacity NOTIFY backgroundMaxOpacityChanged)
|
||||
|
||||
Q_PROPERTY(Latte::SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(Latte::SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(Latte::SchemeColors *darkTheme READ darkTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *darkTheme READ darkTheme NOTIFY themeChanged)
|
||||
|
||||
public:
|
||||
Theme(KSharedConfig::Ptr config, QObject *parent);
|
||||
@ -82,9 +84,9 @@ public:
|
||||
|
||||
float backgroundMaxOpacity() const;
|
||||
|
||||
Latte::SchemeColors *defaultTheme() const;
|
||||
Latte::SchemeColors *lightTheme() const;
|
||||
Latte::SchemeColors *darkTheme() const;
|
||||
WindowSystem::SchemeColors *defaultTheme() const;
|
||||
WindowSystem::SchemeColors *lightTheme() const;
|
||||
WindowSystem::SchemeColors *darkTheme() const;
|
||||
|
||||
void load();
|
||||
|
||||
@ -140,8 +142,8 @@ private:
|
||||
Plasma::Theme m_theme;
|
||||
|
||||
Latte::Corona *m_corona{nullptr};
|
||||
Latte::SchemeColors *m_defaultScheme{nullptr};
|
||||
Latte::SchemeColors *m_reversedScheme{nullptr};
|
||||
WindowSystem::SchemeColors *m_defaultScheme{nullptr};
|
||||
WindowSystem::SchemeColors *m_reversedScheme{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ QRect PrimaryConfigView::geometryWhenVisible() const
|
||||
void PrimaryConfigView::requestActivate()
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland() && m_shellSurface) {
|
||||
WindowId wid = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
WindowSystem::WindowId wid = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->requestActivate(wid);
|
||||
} else {
|
||||
QQuickView::requestActivate();
|
||||
@ -318,23 +318,23 @@ void PrimaryConfigView::syncSlideEffect()
|
||||
return;
|
||||
}
|
||||
|
||||
auto slideLocation = WindowSystem::Slide::None;
|
||||
auto slideLocation = WindowSystem::AbstractWindowInterface::Slide::None;
|
||||
|
||||
switch (m_latteView->containment()->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
slideLocation = WindowSystem::Slide::Top;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Top;
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
slideLocation = WindowSystem::Slide::Right;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Right;
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
slideLocation = WindowSystem::Slide::Bottom;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Bottom;
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
slideLocation = WindowSystem::Slide::Left;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Left;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -157,7 +157,7 @@ QRect SecondaryConfigView::geometryWhenVisible() const
|
||||
void SecondaryConfigView::requestActivate()
|
||||
{
|
||||
if (KWindowSystem::isPlatformWayland() && m_shellSurface) {
|
||||
WindowId wid = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
WindowSystem::WindowId wid = m_corona->wm()->winIdFor("latte-dock", geometry());
|
||||
m_corona->wm()->requestActivate(wid);
|
||||
} else {
|
||||
QQuickView::requestActivate();
|
||||
@ -245,23 +245,23 @@ void SecondaryConfigView::syncSlideEffect()
|
||||
return;
|
||||
}
|
||||
|
||||
auto slideLocation = WindowSystem::Slide::None;
|
||||
auto slideLocation = WindowSystem::AbstractWindowInterface::Slide::None;
|
||||
|
||||
switch (m_latteView->containment()->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
slideLocation = WindowSystem::Slide::Top;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Top;
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
slideLocation = WindowSystem::Slide::Right;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Right;
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
slideLocation = WindowSystem::Slide::Bottom;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Bottom;
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
slideLocation = WindowSystem::Slide::Left;
|
||||
slideLocation = WindowSystem::AbstractWindowInterface::Slide::Left;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "../lattecorona.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../wm/windowinfowrap.h"
|
||||
#include "../wm/abstractwindowinterface.h"
|
||||
#include "../../liblatte2/extras.h"
|
||||
|
||||
// Qt
|
||||
@ -145,12 +145,12 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
|
||||
}
|
||||
|
||||
m_connections[0] = connect(m_wm, &WindowSystem::currentDesktopChanged, this, [&] {
|
||||
m_connections[0] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentDesktopChanged, this, [&] {
|
||||
if (m_raiseOnDesktopChange) {
|
||||
raiseViewTemporarily();
|
||||
}
|
||||
});
|
||||
m_connections[1] = connect(m_wm, &WindowSystem::currentActivityChanged, this, [&]() {
|
||||
m_connections[1] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentActivityChanged, this, [&]() {
|
||||
if (m_raiseOnActivityChange) {
|
||||
raiseViewTemporarily();
|
||||
} else {
|
||||
@ -717,7 +717,7 @@ void VisibilityManager::createEdgeGhostWindow()
|
||||
}
|
||||
});
|
||||
|
||||
m_connectionsKWinEdges[0] = connect(m_wm, &WindowSystem::currentActivityChanged,
|
||||
m_connectionsKWinEdges[0] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentActivityChanged,
|
||||
this, [&]() {
|
||||
bool inCurrentLayout = (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout ||
|
||||
(m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
// local
|
||||
#include "../plasma/quick/containmentview.h"
|
||||
#include "../wm/abstractwindowinterface.h"
|
||||
#include "../wm/windowinfowrap.h"
|
||||
#include "../../liblatte2/types.h"
|
||||
|
||||
// Qt
|
||||
@ -40,6 +38,9 @@ class View;
|
||||
namespace ViewPart {
|
||||
class ScreenEdgeGhostWindow;
|
||||
}
|
||||
namespace WindowSystem {
|
||||
class AbstractWindowInterface;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -141,7 +142,6 @@ private:
|
||||
void updateKWinEdgesSupport();
|
||||
void updateGhostWindowState();
|
||||
|
||||
void windowAdded(WindowId id);
|
||||
void updateStrutsBasedOnLayoutsAndActivities();
|
||||
void viewEventManager(QEvent *ev);
|
||||
|
||||
@ -154,7 +154,7 @@ private slots:
|
||||
void updateHiddenState();
|
||||
|
||||
private:
|
||||
AbstractWindowInterface *m_wm;
|
||||
WindowSystem::AbstractWindowInterface *m_wm;
|
||||
Types::Visibility m_mode{Types::None};
|
||||
std::array<QMetaObject::Connection, 5> m_connections;
|
||||
|
||||
|
@ -120,12 +120,12 @@ void WindowsTracker::setExistsWindowTouching(bool windowTouching)
|
||||
emit existsWindowTouchingChanged();
|
||||
}
|
||||
|
||||
Latte::SchemeColors *WindowsTracker::activeWindowScheme() const
|
||||
WindowSystem::SchemeColors *WindowsTracker::activeWindowScheme() const
|
||||
{
|
||||
return m_activeScheme;
|
||||
}
|
||||
|
||||
void WindowsTracker::setActiveWindowScheme(Latte::SchemeColors *scheme)
|
||||
void WindowsTracker::setActiveWindowScheme(WindowSystem::SchemeColors *scheme)
|
||||
{
|
||||
if (m_activeScheme == scheme) {
|
||||
return;
|
||||
@ -136,12 +136,12 @@ void WindowsTracker::setActiveWindowScheme(Latte::SchemeColors *scheme)
|
||||
emit activeWindowSchemeChanged();
|
||||
}
|
||||
|
||||
Latte::SchemeColors *WindowsTracker::touchingWindowScheme() const
|
||||
WindowSystem::SchemeColors *WindowsTracker::touchingWindowScheme() const
|
||||
{
|
||||
return m_touchingScheme;
|
||||
}
|
||||
|
||||
void WindowsTracker::setTouchingWindowScheme(Latte::SchemeColors *scheme)
|
||||
void WindowsTracker::setTouchingWindowScheme(WindowSystem::SchemeColors *scheme)
|
||||
{
|
||||
if (m_touchingScheme == scheme) {
|
||||
return;
|
||||
@ -175,21 +175,21 @@ void WindowsTracker::setEnabled(bool active)
|
||||
m_connections[0] = connect(m_corona, &Plasma::Corona::availableScreenRectChanged,
|
||||
this, &WindowsTracker::updateAvailableScreenGeometry);
|
||||
|
||||
m_connections[1] = connect(m_wm, &WindowSystem::windowChanged, this, [&](WindowId wid) {
|
||||
m_connections[1] = connect(m_wm, &WindowSystem::AbstractWindowInterface::windowChanged, this, [&](WindowSystem::WindowId wid) {
|
||||
m_windows[wid] = m_wm->requestInfo(wid);
|
||||
updateFlags();
|
||||
});
|
||||
|
||||
m_connections[2] = connect(m_wm, &WindowSystem::windowRemoved, this, [&](WindowId wid) {
|
||||
m_connections[2] = connect(m_wm, &WindowSystem::AbstractWindowInterface::windowRemoved, this, [&](WindowSystem::WindowId wid) {
|
||||
m_windows.remove(wid);
|
||||
});
|
||||
|
||||
m_connections[3] = connect(m_wm, &WindowSystem::windowAdded, this, [&](WindowId wid) {
|
||||
m_connections[3] = connect(m_wm, &WindowSystem::AbstractWindowInterface::windowAdded, this, [&](WindowSystem::WindowId wid) {
|
||||
m_windows.insert(wid, m_wm->requestInfo(wid));
|
||||
updateFlags();
|
||||
});
|
||||
|
||||
m_connections[4] = connect(m_wm, &WindowSystem::activeWindowChanged, this, [&](WindowId wid) {
|
||||
m_connections[4] = connect(m_wm, &WindowSystem::AbstractWindowInterface::activeWindowChanged, this, [&](WindowSystem::WindowId wid) {
|
||||
if (m_windows.contains(m_lastActiveWindowWid)) {
|
||||
m_windows[m_lastActiveWindowWid] = m_wm->requestInfo(m_lastActiveWindowWid);
|
||||
}
|
||||
@ -199,11 +199,11 @@ void WindowsTracker::setEnabled(bool active)
|
||||
updateFlags();
|
||||
});
|
||||
|
||||
m_connections[5] = connect(m_wm, &WindowSystem::currentDesktopChanged, this, [&] {
|
||||
m_connections[5] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentDesktopChanged, this, [&] {
|
||||
updateFlags();
|
||||
});
|
||||
|
||||
m_connections[6] = connect(m_wm, &WindowSystem::currentActivityChanged, this, [&] {
|
||||
m_connections[6] = connect(m_wm, &WindowSystem::AbstractWindowInterface::currentActivityChanged, this, [&] {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
//! this is needed in MultipleLayouts because there is a chance that multiple
|
||||
//! layouts are providing different available screen geometries in different Activities
|
||||
@ -259,10 +259,10 @@ void WindowsTracker::updateFlags()
|
||||
//! maybe a garbage collector here is a good idea!!!
|
||||
bool existsFaultyWindow{false};
|
||||
|
||||
WindowId maxWinId;
|
||||
WindowId activeWinId;
|
||||
WindowId touchWinId;
|
||||
WindowId activeTouchWinId;
|
||||
WindowSystem::WindowId maxWinId;
|
||||
WindowSystem::WindowId activeWinId;
|
||||
WindowSystem::WindowId touchWinId;
|
||||
WindowSystem::WindowId activeTouchWinId;
|
||||
|
||||
for (const auto &winfo : m_windows) {
|
||||
if (winfo.isPlasmaDesktop() || !inCurrentDesktopActivity(winfo)) {
|
||||
@ -342,28 +342,28 @@ void WindowsTracker::updateFlags()
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowsTracker::inCurrentDesktopActivity(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::inCurrentDesktopActivity(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && m_wm->isOnCurrentDesktop(winfo.wid()) && m_wm->isOnCurrentActivity(winfo.wid()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::intersects(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::intersects(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (!winfo.isMinimized() && !winfo.isShaded() && winfo.geometry().intersects(m_latteView->absoluteGeometry()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isActive(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::isActive(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized());
|
||||
}
|
||||
|
||||
bool WindowsTracker::isActiveInCurrentScreen(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::isActiveInCurrentScreen(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized()
|
||||
&& m_availableScreenGeometry.contains(winfo.geometry().center()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isMaximizedInCurrentScreen(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::isMaximizedInCurrentScreen(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
auto viewIntersectsMaxVert = [&]() noexcept -> bool {
|
||||
return ((winfo.isMaxVert()
|
||||
@ -384,12 +384,12 @@ bool WindowsTracker::isMaximizedInCurrentScreen(const WindowInfoWrap &winfo)
|
||||
&& m_availableScreenGeometry.contains(winfo.geometry().center()));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isTouchingView(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::isTouchingView(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
return (winfo.isValid() && intersects(winfo));
|
||||
}
|
||||
|
||||
bool WindowsTracker::isTouchingViewEdge(const WindowInfoWrap &winfo)
|
||||
bool WindowsTracker::isTouchingViewEdge(const WindowSystem::WindowInfoWrap &winfo)
|
||||
{
|
||||
if (winfo.isValid() && !winfo.isMinimized()) {
|
||||
bool touchingViewEdge{false};
|
||||
@ -436,7 +436,7 @@ void WindowsTracker::setWindowOnActivities(QWindow &window, const QStringList &a
|
||||
|
||||
void WindowsTracker::requestToggleMaximizeForActiveWindow()
|
||||
{
|
||||
WindowInfoWrap actInfo;
|
||||
WindowSystem::WindowInfoWrap actInfo;
|
||||
|
||||
if (m_windows.contains(m_lastActiveWindowWid)) {
|
||||
actInfo = m_windows[m_lastActiveWindowWid];
|
||||
@ -452,7 +452,7 @@ void WindowsTracker::requestToggleMaximizeForActiveWindow()
|
||||
|
||||
void WindowsTracker::requestMoveActiveWindow(int localX, int localY)
|
||||
{
|
||||
WindowInfoWrap actInfo;
|
||||
WindowSystem::WindowInfoWrap actInfo;
|
||||
|
||||
if (m_windows.contains(m_lastActiveWindowWid)) {
|
||||
actInfo = m_windows[m_lastActiveWindowWid];
|
||||
@ -478,7 +478,7 @@ void WindowsTracker::requestMoveActiveWindow(int localX, int localY)
|
||||
|
||||
bool WindowsTracker::activeWindowCanBeDragged()
|
||||
{
|
||||
WindowInfoWrap actInfo;
|
||||
WindowSystem::WindowInfoWrap actInfo;
|
||||
|
||||
if (m_windows.contains(m_lastActiveWindowWid)) {
|
||||
actInfo = m_windows[m_lastActiveWindowWid];
|
||||
|
@ -28,10 +28,13 @@
|
||||
#include <QObject>
|
||||
|
||||
namespace Latte{
|
||||
class AbstractWindowInterface;
|
||||
class Corona;
|
||||
class SchemeColors;
|
||||
class View;
|
||||
|
||||
namespace WindowSystem {
|
||||
class AbstractWindowInterface;
|
||||
class SchemeColors;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -45,8 +48,8 @@ class WindowsTracker : public QObject {
|
||||
Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged)
|
||||
Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
|
||||
Q_PROPERTY(bool existsWindowTouching READ existsWindowTouching NOTIFY existsWindowTouchingChanged)
|
||||
Q_PROPERTY(Latte::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
|
||||
Q_PROPERTY(Latte::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
|
||||
|
||||
public:
|
||||
explicit WindowsTracker(Latte::View *parent);
|
||||
@ -61,8 +64,8 @@ public:
|
||||
bool existsWindowMaximized() const;
|
||||
bool existsWindowTouching() const;
|
||||
|
||||
Latte::SchemeColors *activeWindowScheme() const;
|
||||
Latte::SchemeColors *touchingWindowScheme() const;
|
||||
WindowSystem::SchemeColors *activeWindowScheme() const;
|
||||
WindowSystem::SchemeColors *touchingWindowScheme() const;
|
||||
|
||||
void setWindowOnActivities(QWindow &window, const QStringList &activities);
|
||||
|
||||
@ -88,8 +91,8 @@ private:
|
||||
void setExistsWindowActive(bool windowActive);
|
||||
void setExistsWindowMaximized(bool windowMaximized);
|
||||
void setExistsWindowTouching(bool windowTouching);
|
||||
void setActiveWindowScheme(Latte::SchemeColors *scheme);
|
||||
void setTouchingWindowScheme(Latte::SchemeColors *scheme);
|
||||
void setActiveWindowScheme(WindowSystem::SchemeColors *scheme);
|
||||
void setTouchingWindowScheme(WindowSystem::SchemeColors *scheme);
|
||||
void updateAvailableScreenGeometry();
|
||||
void updateFlags();
|
||||
|
||||
@ -97,13 +100,13 @@ private:
|
||||
//! this is a garbage collector to collect such windows in order to not break the windows array validity.
|
||||
void cleanupFaultyWindows();
|
||||
|
||||
bool intersects(const WindowInfoWrap &winfo);
|
||||
bool inCurrentDesktopActivity(const WindowInfoWrap &winfo);
|
||||
bool isActive(const WindowInfoWrap &winfo);
|
||||
bool isActiveInCurrentScreen(const WindowInfoWrap &winfo);
|
||||
bool isMaximizedInCurrentScreen(const WindowInfoWrap &winfo);
|
||||
bool isTouchingViewEdge(const WindowInfoWrap &winfo);
|
||||
bool isTouchingView(const WindowInfoWrap &winfo);
|
||||
bool intersects(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool inCurrentDesktopActivity(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool isActive(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool isActiveInCurrentScreen(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool isMaximizedInCurrentScreen(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool isTouchingViewEdge(const WindowSystem::WindowInfoWrap &winfo);
|
||||
bool isTouchingView(const WindowSystem::WindowInfoWrap &winfo);
|
||||
|
||||
private:
|
||||
bool m_enabled{false};
|
||||
@ -115,17 +118,18 @@ private:
|
||||
|
||||
QRect m_availableScreenGeometry;
|
||||
|
||||
WindowId m_lastActiveWindowWid;
|
||||
WindowSystem::WindowId m_lastActiveWindowWid;
|
||||
|
||||
std::array<QMetaObject::Connection, 7> m_connections;
|
||||
QMap<WindowId, WindowInfoWrap> m_windows;
|
||||
QMap<WindowSystem::WindowId, WindowSystem::WindowInfoWrap> m_windows;
|
||||
|
||||
Latte::SchemeColors *m_activeScheme{nullptr};
|
||||
Latte::SchemeColors *m_touchingScheme{nullptr};
|
||||
|
||||
Latte::AbstractWindowInterface *m_wm;
|
||||
Latte::Corona *m_corona{nullptr};
|
||||
Latte::View *m_latteView{nullptr};
|
||||
|
||||
WindowSystem::AbstractWindowInterface *m_wm;
|
||||
|
||||
WindowSystem::SchemeColors *m_activeScheme{nullptr};
|
||||
WindowSystem::SchemeColors *m_touchingScheme{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include "abstractwindowinterface.h"
|
||||
|
||||
// local
|
||||
#include "xwindowinterface.h"
|
||||
#include "waylandinterface.h"
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
@ -34,6 +30,7 @@
|
||||
#include <KWindowSystem>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
AbstractWindowInterface::AbstractWindowInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
@ -144,4 +141,5 @@ void AbstractWindowInterface::setColorSchemeForWindow(WindowId wid, QString sche
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,7 @@
|
||||
#include <Plasma>
|
||||
|
||||
namespace Latte {
|
||||
|
||||
class XWindowInterface;
|
||||
class WaylandInterface;
|
||||
namespace WindowSystem {
|
||||
|
||||
class AbstractWindowInterface : public QObject
|
||||
{
|
||||
@ -124,11 +122,9 @@ private:
|
||||
|
||||
//! window id and its corresponding scheme file
|
||||
QMap<WindowId, QString> m_windowScheme;
|
||||
|
||||
};
|
||||
|
||||
// namespace alias
|
||||
using WindowSystem = AbstractWindowInterface;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ABSTRACTWINDOWINTERFACE_H
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <KSharedConfig>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
SchemeColors::SchemeColors(QObject *parent, QString scheme, bool plasmaTheme) :
|
||||
QObject(parent),
|
||||
@ -247,3 +248,4 @@ void SchemeColors::updateScheme()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QColor>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
class SchemeColors: public QObject
|
||||
{
|
||||
@ -106,6 +107,7 @@ private:
|
||||
QColor m_buttonFocusColor;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -51,7 +51,7 @@ class Private::GhostWindow : public QRasterWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GhostWindow(WaylandInterface *waylandInterface)
|
||||
GhostWindow(WindowSystem::WaylandInterface *waylandInterface)
|
||||
: m_waylandInterface(waylandInterface) {
|
||||
setFlags(Qt::FramelessWindowHint
|
||||
| Qt::WindowStaysOnTopHint
|
||||
@ -93,9 +93,11 @@ public:
|
||||
}
|
||||
|
||||
KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};
|
||||
WaylandInterface *m_waylandInterface{nullptr};
|
||||
WindowSystem::WaylandInterface *m_waylandInterface{nullptr};
|
||||
};
|
||||
|
||||
namespace WindowSystem {
|
||||
|
||||
WaylandInterface::WaylandInterface(QObject *parent)
|
||||
: AbstractWindowInterface(parent)
|
||||
{
|
||||
@ -489,6 +491,7 @@ void WaylandInterface::windowCreatedProxy(KWayland::Client::PlasmaWindow *w)
|
||||
emit windowAdded(w->internalId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#include "waylandinterface.moc"
|
||||
|
@ -39,16 +39,17 @@
|
||||
#include <KWindowInfo>
|
||||
#include <KWindowEffects>
|
||||
|
||||
|
||||
namespace Latte {
|
||||
|
||||
class Corona;
|
||||
|
||||
namespace Private {
|
||||
/**
|
||||
* @brief this class is use for create the struts inside wayland
|
||||
*/
|
||||
//! this class is used to create the struts inside wayland
|
||||
class GhostWindow;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
class WaylandInterface : public AbstractWindowInterface
|
||||
{
|
||||
@ -106,7 +107,7 @@ private:
|
||||
Latte::Corona *m_corona{nullptr};
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WAYLANDINTERFACE_H
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QVariant>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
using WindowId = QVariant;
|
||||
|
||||
@ -314,5 +315,6 @@ inline void WindowInfoWrap::setWid(WindowId wid) noexcept
|
||||
|
||||
// END: definitions
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WINDOWINFOWRAP_H
|
||||
|
20
app/wm/windowstracker.cpp
Normal file
20
app/wm/windowstracker.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "windowstracker.h"
|
35
app/wm/windowstracker.h
Normal file
35
app/wm/windowstracker.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WINDOWSYSTEMWINDOWSTRACKER_H
|
||||
#define WINDOWSYSTEMWINDOWSTRACKER_H
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
class WindowsTracker : public QObject {
|
||||
Q_OBJECT
|
||||
};
|
||||
|
||||
}
|
||||
}
|
@ -39,6 +39,7 @@
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
XWindowInterface::XWindowInterface(QObject *parent)
|
||||
: AbstractWindowInterface(parent)
|
||||
@ -488,3 +489,4 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <KWindowEffects>
|
||||
|
||||
namespace Latte {
|
||||
namespace WindowSystem {
|
||||
|
||||
class XWindowInterface : public AbstractWindowInterface
|
||||
{
|
||||
@ -77,6 +78,7 @@ private:
|
||||
WindowId m_desktopId;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XWINDOWINTERFACE_H
|
||||
|
@ -224,6 +224,14 @@ public:
|
||||
};
|
||||
Q_ENUM(SettingsComplexity);
|
||||
|
||||
enum WindowsTracking
|
||||
{
|
||||
NoTracking = 0,
|
||||
TrackActiveWindow,
|
||||
TrackAllWindows
|
||||
};
|
||||
Q_ENUM(WindowsTracking);
|
||||
|
||||
enum ImportExportState
|
||||
{
|
||||
Failed = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user