REFACTOR WindowsTracker to provide more information

--View::WindowsTracker now provides all the time
information about CurrentScreen and AllScreens!
This way all consumers (Latte::Containment, Applets etc.)
can choose whatever suits them best.
pull/6/head
Michail Vourlakos 6 years ago
parent 7deef41015
commit 4cc4bfd6de

@ -270,7 +270,7 @@ void View::disconnectSensitiveSignals()
setLayout(nullptr);
if (m_windowsTracker) {
m_windowsTracker->setEnabled(false);
// m_windowsTracker->setEnabled(false);
}
}

@ -24,6 +24,7 @@
#include "positioner.h"
#include "screenedgeghostwindow.h"
#include "view.h"
#include "windowstracker/currentscreentracker.h"
#include "../lattecorona.h"
#include "../screenpool.h"
#include "../layouts/manager.h"
@ -197,7 +198,7 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
case Types::DodgeActive: {
m_connections[base] = connect(this, &VisibilityManager::containsMouseChanged
, this, &VisibilityManager::dodgeActive);
m_connections[base+1] = connect(m_latteView->windowsTracker(), &WindowsTracker::activeWindowTouchingChanged
m_connections[base+1] = connect(m_latteView->windowsTracker()->currentScreen(), &TrackerPart::CurrentScreenTracker::activeWindowTouchingChanged
, this, &VisibilityManager::dodgeActive);
dodgeActive();
@ -207,7 +208,7 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
case Types::DodgeMaximized: {
m_connections[base] = connect(this, &VisibilityManager::containsMouseChanged
, this, &VisibilityManager::dodgeMaximized);
m_connections[base+1] = connect(m_latteView->windowsTracker(), &WindowsTracker::activeWindowMaximizedChanged
m_connections[base+1] = connect(m_latteView->windowsTracker()->currentScreen(), &TrackerPart::CurrentScreenTracker::activeWindowMaximizedChanged
, this, &VisibilityManager::dodgeMaximized);
dodgeMaximized();
@ -218,7 +219,7 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
m_connections[base] = connect(this, &VisibilityManager::containsMouseChanged
, this, &VisibilityManager::dodgeAllWindows);
m_connections[base+1] = connect(m_latteView->windowsTracker(), &WindowsTracker::existsWindowTouchingChanged
m_connections[base+1] = connect(m_latteView->windowsTracker()->currentScreen(), &TrackerPart::CurrentScreenTracker::existsWindowTouchingChanged
, this, &VisibilityManager::dodgeAllWindows);
dodgeAllWindows();
@ -521,7 +522,7 @@ void VisibilityManager::dodgeActive()
return;
}
raiseView(!m_latteView->windowsTracker()->activeWindowTouching());
raiseView(!m_latteView->windowsTracker()->currentScreen()->activeWindowTouching());
}
void VisibilityManager::dodgeMaximized()
@ -535,7 +536,7 @@ void VisibilityManager::dodgeMaximized()
return;
}
raiseView(!m_latteView->windowsTracker()->activeWindowMaximized());
raiseView(!m_latteView->windowsTracker()->currentScreen()->activeWindowMaximized());
}
void VisibilityManager::dodgeAllWindows()
@ -547,7 +548,7 @@ void VisibilityManager::dodgeAllWindows()
raiseView(true);
}
bool windowIntersects{m_latteView->windowsTracker()->activeWindowTouching() || m_latteView->windowsTracker()->existsWindowTouching()};
bool windowIntersects{m_latteView->windowsTracker()->currentScreen()->activeWindowTouching() || m_latteView->windowsTracker()->currentScreen()->existsWindowTouching()};
raiseView(!windowIntersects);
}

@ -1,5 +1,7 @@
set(lattedock-app_SRCS
${lattedock-app_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/allscreenstracker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/currentscreentracker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windowstracker.cpp
PARENT_SCOPE
)

@ -0,0 +1,131 @@
/*
* 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 "allscreenstracker.h"
// local
#include "../view.h"
#include "../../layout/genericlayout.h"
#include "../../wm/schemecolors.h"
#include "../../wm/tracker/lastactivewindow.h"
#include "../../wm/tracker/trackerwindows.h"
namespace Latte {
namespace ViewPart {
namespace TrackerPart {
AllScreensTracker::AllScreensTracker(WindowsTracker *parent)
: QObject(parent),
m_latteView(parent->view()),
m_wm(parent->wm())
{
init();
}
AllScreensTracker::~AllScreensTracker()
{
}
void AllScreensTracker::init()
{
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::informationAnnouncedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
initSignalsForInformation();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
emit enabledChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
emit activeWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowActiveChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
emit existsWindowActiveChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowMaximizedChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
emit existsWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChangedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) {
emit activeWindowSchemeChanged();
}
});
}
void AllScreensTracker::initSignalsForInformation()
{
connect(lastActiveWindow(), &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
this, &AllScreensTracker::activeWindowDraggingStarted);
emit lastActiveWindowChanged();
}
bool AllScreensTracker::activeWindowMaximized() const
{
return m_wm->windowsTracker()->activeWindowMaximized(m_latteView->layout());
}
bool AllScreensTracker::existsWindowActive() const
{
return m_wm->windowsTracker()->existsWindowActive(m_latteView->layout());
}
bool AllScreensTracker::existsWindowMaximized() const
{
return m_wm->windowsTracker()->existsWindowMaximized(m_latteView->layout());
}
WindowSystem::SchemeColors *AllScreensTracker::activeWindowScheme() const
{
return m_wm->windowsTracker()->activeWindowScheme(m_latteView->layout());
}
bool AllScreensTracker::enabled() const
{
return m_wm->windowsTracker()->enabled(m_latteView->layout());
}
WindowSystem::Tracker::LastActiveWindow *AllScreensTracker::lastActiveWindow()
{
return m_wm->windowsTracker()->lastActiveWindow(m_latteView->layout());
}
//! Window Functions
void AllScreensTracker::requestMoveLastWindow(int localX, int localY)
{
m_wm->windowsTracker()->lastActiveWindow(m_latteView->layout())->requestMove(m_latteView, localX, localY);
}
}
}
}

@ -0,0 +1,99 @@
/*
* 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 WINDOWSALLSCREENSTRACKER_H
#define WINDOWSALLSCREENSTRACKER_H
// local
#include "../../wm/abstractwindowinterface.h"
// Qt
#include <QObject>
namespace Latte{
class View;
namespace ViewPart {
class WindowsTracker;
}
namespace WindowSystem {
class AbstractWindowInterface;
class SchemeColors;
namespace Tracker {
class LastActiveWindow;
}
}
}
namespace Latte {
namespace ViewPart {
namespace TrackerPart {
class AllScreensTracker : public QObject {
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged)
Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged)
Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged)
Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *lastActiveWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
public:
explicit AllScreensTracker(WindowsTracker *parent);
virtual ~AllScreensTracker();
bool enabled() const;
bool activeWindowMaximized() const;
bool existsWindowActive() const;
bool existsWindowMaximized() const;
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::Tracker::LastActiveWindow *lastActiveWindow();
public slots:
Q_INVOKABLE void requestMoveLastWindow(int localX, int localY);
signals:
void enabledChanged();
void activeWindowDraggingStarted();
void activeWindowMaximizedChanged();
void existsWindowActiveChanged();
void existsWindowMaximizedChanged();
void activeWindowSchemeChanged();
void lastActiveWindowChanged();
private slots:
void initSignalsForInformation();
private:
void init();
Latte::View *m_latteView{nullptr};
WindowSystem::AbstractWindowInterface *m_wm{nullptr};
};
}
}
}
#endif

@ -0,0 +1,171 @@
/*
* 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 "currentscreentracker.h"
// local
#include "../view.h"
#include "../../wm/schemecolors.h"
#include "../../wm/tracker/lastactivewindow.h"
#include "../../wm/tracker/trackerwindows.h"
namespace Latte {
namespace ViewPart {
namespace TrackerPart {
CurrentScreenTracker::CurrentScreenTracker(WindowsTracker *parent)
: QObject(parent),
m_latteView(parent->view()),
m_wm(parent->wm())
{
init();
m_wm->windowsTracker()->addView(m_latteView);
}
CurrentScreenTracker::~CurrentScreenTracker()
{
m_wm->windowsTracker()->removeView(m_latteView);
}
void CurrentScreenTracker::init()
{
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::informationAnnounced, this, [&](const Latte::View *view) {
if (m_latteView == view) {
initSignalsForInformation();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit enabledChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowTouchingChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowTouchingChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowActiveChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowActiveChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowMaximizedChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowTouchingChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowTouchingChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowSchemeChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::touchingWindowSchemeChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit touchingWindowSchemeChanged();
}
});
}
void CurrentScreenTracker::initSignalsForInformation()
{
connect(lastActiveWindow(), &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
this, &CurrentScreenTracker::activeWindowDraggingStarted);
emit lastActiveWindowChanged();
}
bool CurrentScreenTracker::activeWindowMaximized() const
{
return m_wm->windowsTracker()->activeWindowMaximized(m_latteView);
}
bool CurrentScreenTracker::activeWindowTouching() const
{
return m_wm->windowsTracker()->activeWindowTouching(m_latteView);
}
bool CurrentScreenTracker::existsWindowActive() const
{
return m_wm->windowsTracker()->existsWindowActive(m_latteView);
}
bool CurrentScreenTracker::existsWindowMaximized() const
{
return m_wm->windowsTracker()->existsWindowMaximized(m_latteView);
}
bool CurrentScreenTracker::existsWindowTouching() const
{
return m_wm->windowsTracker()->existsWindowTouching(m_latteView);
}
WindowSystem::SchemeColors *CurrentScreenTracker::activeWindowScheme() const
{
return m_wm->windowsTracker()->activeWindowScheme(m_latteView);
}
WindowSystem::SchemeColors *CurrentScreenTracker::touchingWindowScheme() const
{
return m_wm->windowsTracker()->touchingWindowScheme(m_latteView);
}
bool CurrentScreenTracker::enabled() const
{
return m_wm->windowsTracker()->enabled(m_latteView);
}
void CurrentScreenTracker::setEnabled(bool active)
{
m_wm->windowsTracker()->setEnabled(m_latteView, active);
}
WindowSystem::Tracker::LastActiveWindow *CurrentScreenTracker::lastActiveWindow()
{
return m_wm->windowsTracker()->lastActiveWindow(m_latteView);
}
//! Window Functions
void CurrentScreenTracker::requestMoveLastWindow(int localX, int localY)
{
m_wm->windowsTracker()->lastActiveWindow(m_latteView)->requestMove(m_latteView, localX, localY);
}
}
}
}

@ -0,0 +1,110 @@
/*
* 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 WINDOWSCURRENTSCREENTRACKER_H
#define WINDOWSCURRENTSCREENTRACKER_H
// local
#include "../../wm/abstractwindowinterface.h"
// Qt
#include <QObject>
namespace Latte{
class View;
namespace ViewPart {
class WindowsTracker;
}
namespace WindowSystem {
class AbstractWindowInterface;
class SchemeColors;
namespace Tracker {
class LastActiveWindow;
}
}
}
namespace Latte {
namespace ViewPart {
namespace TrackerPart {
class CurrentScreenTracker : public QObject {
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged)
Q_PROPERTY(bool activeWindowTouching READ activeWindowTouching NOTIFY activeWindowTouchingChanged)
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::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *lastActiveWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
public:
explicit CurrentScreenTracker(WindowsTracker *parent);
virtual ~CurrentScreenTracker();
bool enabled() const;
void setEnabled(bool active);
bool activeWindowMaximized() const;
bool activeWindowTouching() const;
bool existsWindowActive() const;
bool existsWindowMaximized() const;
bool existsWindowTouching() const;
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::SchemeColors *touchingWindowScheme() const;
WindowSystem::Tracker::LastActiveWindow *lastActiveWindow();
public slots:
Q_INVOKABLE void requestMoveLastWindow(int localX, int localY);
signals:
void enabledChanged();
void activeWindowDraggingStarted();
void activeWindowMaximizedChanged();
void activeWindowTouchingChanged();
void existsWindowActiveChanged();
void existsWindowMaximizedChanged();
void existsWindowTouchingChanged();
void activeWindowSchemeChanged();
void touchingWindowSchemeChanged();
void lastActiveWindowChanged();
private slots:
void initSignalsForInformation();
private:
void init();
Latte::View *m_latteView{nullptr};
WindowSystem::AbstractWindowInterface *m_wm{nullptr};
};
}
}
}
#endif

@ -20,14 +20,11 @@
#include "windowstracker.h"
// local
#include "../positioner.h"
#include "currentscreentracker.h"
#include "allscreenstracker.h"
#include "../view.h"
#include "../../lattecorona.h"
#include "../../layouts/manager.h"
#include "../../wm/schemecolors.h"
#include "../../wm/tracker/lastactivewindow.h"
#include "../../wm/tracker/trackerwindows.h"
#include "../../../liblatte2/types.h"
namespace Latte {
namespace ViewPart {
@ -38,137 +35,59 @@ WindowsTracker::WindowsTracker(Latte::View *parent)
{
qDebug() << "WindowsTracker creating...";
m_corona = qobject_cast<Latte::Corona *>(m_latteView->corona());
m_wm = m_corona->wm();
init();
m_wm->windowsTracker()->addView(m_latteView);
auto corona = qobject_cast<Latte::Corona *>(m_latteView->corona());
m_wm = corona->wm();
m_allScreensTracker = new TrackerPart::AllScreensTracker(this);
m_currentScreenTracker = new TrackerPart::CurrentScreenTracker(this);
connect(lastActiveWindow(), &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
connect(m_allScreensTracker, &TrackerPart::AllScreensTracker::activeWindowDraggingStarted,
this, &WindowsTracker::activeWindowDraggingStarted);
connect(m_currentScreenTracker, &TrackerPart::CurrentScreenTracker::activeWindowDraggingStarted,
this, &WindowsTracker::activeWindowDraggingStarted);
emit lastActiveWindowChanged();
emit allScreensChanged();
emit currentScreenChanged();
}
WindowsTracker::~WindowsTracker()
{
qDebug() << "WindowsTracker removing...";
m_wm->windowsTracker()->removeView(m_latteView);
}
void WindowsTracker::init()
{
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit enabledChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowTouchingChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowTouchingChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowActiveChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowActiveChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowMaximizedChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowMaximizedChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowTouchingChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit existsWindowTouchingChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowSchemeChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::touchingWindowSchemeChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit touchingWindowSchemeChanged();
}
});
}
bool WindowsTracker::activeWindowMaximized() const
{
return m_wm->windowsTracker()->activeWindowMaximized(m_latteView);
}
bool WindowsTracker::activeWindowTouching() const
{
return m_wm->windowsTracker()->activeWindowTouching(m_latteView);
}
bool WindowsTracker::existsWindowActive() const
{
return m_wm->windowsTracker()->existsWindowActive(m_latteView);
}
if (m_allScreensTracker) {
m_allScreensTracker->deleteLater();
}
bool WindowsTracker::existsWindowMaximized() const
{
return m_wm->windowsTracker()->existsWindowMaximized(m_latteView);
if (m_currentScreenTracker) {
m_currentScreenTracker->deleteLater();
}
}
bool WindowsTracker::existsWindowTouching() const
Latte::View *WindowsTracker::view() const
{
return m_wm->windowsTracker()->existsWindowTouching(m_latteView);
return m_latteView;
}
WindowSystem::SchemeColors *WindowsTracker::activeWindowScheme() const
WindowSystem::AbstractWindowInterface *WindowsTracker::wm() const
{
return m_wm->windowsTracker()->activeWindowScheme(m_latteView);
return m_wm;
}
WindowSystem::SchemeColors *WindowsTracker::touchingWindowScheme() const
TrackerPart::AllScreensTracker *WindowsTracker::allScreens() const
{
return m_wm->windowsTracker()->touchingWindowScheme(m_latteView);
return m_allScreensTracker;
}
bool WindowsTracker::enabled() const
TrackerPart::CurrentScreenTracker *WindowsTracker::currentScreen() const
{
return m_wm->windowsTracker()->enabled(m_latteView);
return m_currentScreenTracker;
}
void WindowsTracker::setEnabled(bool active)
{
m_wm->windowsTracker()->setEnabled(m_latteView, active);
}
WindowSystem::Tracker::LastActiveWindow *WindowsTracker::lastActiveWindow()
{
return m_wm->windowsTracker()->lastActiveWindow(m_latteView);
}
//! Window Functions
void WindowsTracker::setWindowOnActivities(QWindow &window, const QStringList &activities)
{
m_wm->setWindowOnActivities(window, activities);
}
void WindowsTracker::requestMoveLastWindowFromCurrentScreen(int localX, int localY)
{
m_wm->windowsTracker()->lastActiveWindow(m_latteView)->requestMove(m_latteView, localX, localY);
}
}
}

@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WINDOWSTRACKER_H
#define WINDOWSTRACKER_H
#ifndef VIEWWINDOWSTRACKER_H
#define VIEWWINDOWSTRACKER_H
// local
#include "../../wm/abstractwindowinterface.h"
@ -27,15 +27,17 @@
#include <QObject>
namespace Latte{
class Corona;
class View;
namespace ViewPart {
namespace TrackerPart {
class AllScreensTracker;
class CurrentScreenTracker;
}
}
namespace WindowSystem {
class AbstractWindowInterface;
class SchemeColors;
namespace Tracker {
class LastActiveWindow;
}
}
}
@ -44,61 +46,32 @@ namespace ViewPart {
class WindowsTracker : public QObject {
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool activeWindowMaximized READ activeWindowMaximized NOTIFY activeWindowMaximizedChanged)
Q_PROPERTY(bool activeWindowTouching READ activeWindowTouching NOTIFY activeWindowTouchingChanged)
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::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::Tracker::LastActiveWindow *lastActiveWindow READ lastActiveWindow NOTIFY lastActiveWindowChanged)
Q_PROPERTY(Latte::ViewPart::TrackerPart::CurrentScreenTracker *currentScreen READ currentScreen NOTIFY currentScreenChanged)
Q_PROPERTY(Latte::ViewPart::TrackerPart::AllScreensTracker *allScreens READ allScreens NOTIFY allScreensChanged)
public:
explicit WindowsTracker(Latte::View *parent);
virtual ~WindowsTracker();
bool enabled() const;
void setEnabled(bool active);
bool activeWindowMaximized() const;
bool activeWindowTouching() const;
bool existsWindowActive() const;
bool existsWindowMaximized() const;
bool existsWindowTouching() const;
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::SchemeColors *touchingWindowScheme() const;
WindowSystem::Tracker::LastActiveWindow *lastActiveWindow();
TrackerPart::AllScreensTracker *allScreens() const;
TrackerPart::CurrentScreenTracker *currentScreen() const;
void setWindowOnActivities(QWindow &window, const QStringList &activities);
public slots:
Q_INVOKABLE void requestMoveLastWindowFromCurrentScreen(int localX, int localY);
Latte::View *view() const;
WindowSystem::AbstractWindowInterface *wm() const;
signals:
void enabledChanged();
void activeWindowDraggingStarted();
void activeWindowMaximizedChanged();
void activeWindowTouchingChanged();
void existsWindowActiveChanged();
void existsWindowMaximizedChanged();
void existsWindowTouchingChanged();
void activeWindowSchemeChanged();
void touchingWindowSchemeChanged();
void lastActiveWindowChanged();
private:
void init();
void allScreensChanged();
void currentScreenChanged();
private:
Latte::Corona *m_corona{nullptr};
Latte::View *m_latteView{nullptr};
WindowSystem::AbstractWindowInterface *m_wm{nullptr};
WindowSystem::AbstractWindowInterface *m_wm;
TrackerPart::AllScreensTracker *m_allScreensTracker{nullptr};
TrackerPart::CurrentScreenTracker *m_currentScreenTracker{nullptr};
};
}

@ -171,6 +171,8 @@ void Windows::addView(Latte::View *view)
});
updateHints(view);
emit informationAnnounced(view);
}
void Windows::removeView(Latte::View *view)
@ -191,6 +193,8 @@ void Windows::addRelevantLayout(Latte::View *view)
m_layouts[view->layout()] = new TrackedLayoutInfo(this, view->layout());
updateRelevantLayouts();
updateHints(view->layout());
emit informationAnnouncedForLayout(view->layout());
}
}
@ -413,6 +417,15 @@ LastActiveWindow *Windows::lastActiveWindow(Latte::View *view)
}
//! Layouts
bool Windows::enabled(Latte::Layout::GenericLayout *layout)
{
if (!m_layouts.contains(layout)) {
return false;
}
return m_layouts[layout]->enabled();
}
bool Windows::activeWindowMaximized(Latte::Layout::GenericLayout *layout) const
{
if (!m_layouts.contains(layout)) {

@ -73,6 +73,7 @@ public:
LastActiveWindow *lastActiveWindow(Latte::View *view);
//! Layouts Tracking (all screens)
bool enabled(Latte::Layout::GenericLayout *layout);
bool activeWindowMaximized(Latte::Layout::GenericLayout *layout) const;
bool existsWindowActive(Latte::Layout::GenericLayout *layout) const;
bool existsWindowMaximized(Latte::Layout::GenericLayout *layout) const;
@ -99,6 +100,7 @@ signals:
void existsWindowTouchingChanged(const Latte::View *view);
void activeWindowSchemeChanged(const Latte::View *view);
void touchingWindowSchemeChanged(const Latte::View *view);
void informationAnnounced(const Latte::View *view);
//! Layouts
void enabledChangedForLayout(const Latte::Layout::GenericLayout *layout);
@ -106,6 +108,7 @@ signals:
void existsWindowActiveChangedForLayout(const Latte::Layout::GenericLayout *layout);
void existsWindowMaximizedChangedForLayout(const Latte::Layout::GenericLayout *layout);
void activeWindowSchemeChangedForLayout(const Latte::Layout::GenericLayout *layout);
void informationAnnouncedForLayout(const Latte::Layout::GenericLayout *layout);
//! overloading WM signals in order to update first m_windows and afterwards
//! inform consumers for window changes

Loading…
Cancel
Save