1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*
SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "allscreenstracker.h"
// local
#include "../view.h"
#include "../../layout/genericlayout.h"
#include "../../wm/schemecolors.h"
#include "../../wm/tracker/lastactivewindow.h"
#include "../../wm/tracker/windowstracker.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()
{
if (!m_currentLastActiveWindow && lastActiveWindow()) {
initSignalsForInformation();
}
connect(m_latteView, &Latte::View::layoutChanged, this, [&]() {
if (m_latteView->layout()) {
initSignalsForInformation();
}
});
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::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()
{
m_currentLastActiveWindow = lastActiveWindow();
emit lastActiveWindowChanged();
emit activeWindowMaximizedChanged();
emit existsWindowActiveChanged();
emit existsWindowMaximizedChanged();
emit activeWindowSchemeChanged();
}
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());
}
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);
}
}
}
}
|