You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
5.2 KiB
C++
175 lines
5.2 KiB
C++
6 years ago
|
/*
|
||
|
* 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"
|
||
|
|
||
|
// local
|
||
6 years ago
|
#include "../positioner.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"
|
||
6 years ago
|
|
||
|
namespace Latte {
|
||
|
namespace ViewPart {
|
||
|
|
||
|
WindowsTracker::WindowsTracker(Latte::View *parent)
|
||
|
: QObject(parent),
|
||
|
m_latteView(parent)
|
||
|
{
|
||
|
qDebug() << "WindowsTracker creating...";
|
||
|
|
||
|
m_corona = qobject_cast<Latte::Corona *>(m_latteView->corona());
|
||
|
m_wm = m_corona->wm();
|
||
6 years ago
|
|
||
|
init();
|
||
|
m_wm->windowsTracker()->addView(m_latteView);
|
||
6 years ago
|
|
||
6 years ago
|
|
||
|
connect(lastActiveWindow(), &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
|
||
|
this, &WindowsTracker::activeWindowDraggingStarted);
|
||
|
|
||
6 years ago
|
emit lastActiveWindowChanged();
|
||
6 years ago
|
}
|
||
|
|
||
|
WindowsTracker::~WindowsTracker()
|
||
|
{
|
||
|
qDebug() << "WindowsTracker removing...";
|
||
6 years ago
|
m_wm->windowsTracker()->removeView(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
void WindowsTracker::init()
|
||
6 years ago
|
{
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::enabledChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit enabledChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit activeWindowMaximizedChanged();
|
||
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit activeWindowTouchingChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowActiveChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit existsWindowActiveChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowMaximizedChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit existsWindowMaximizedChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::existsWindowTouchingChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit existsWindowTouchingChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit activeWindowSchemeChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
|
||
6 years ago
|
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::touchingWindowSchemeChanged, this, [&](const Latte::View *view) {
|
||
6 years ago
|
if (m_latteView == view) {
|
||
|
emit touchingWindowSchemeChanged();
|
||
6 years ago
|
}
|
||
6 years ago
|
});
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
bool WindowsTracker::activeWindowMaximized() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->activeWindowMaximized(m_latteView);
|
||
6 years ago
|
}
|
||
6 years ago
|
|
||
6 years ago
|
bool WindowsTracker::activeWindowTouching() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->activeWindowTouching(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
bool WindowsTracker::existsWindowActive() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->existsWindowActive(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
bool WindowsTracker::existsWindowMaximized() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->existsWindowMaximized(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
bool WindowsTracker::existsWindowTouching() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->existsWindowTouching(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
WindowSystem::SchemeColors *WindowsTracker::activeWindowScheme() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->activeWindowScheme(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
WindowSystem::SchemeColors *WindowsTracker::touchingWindowScheme() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->touchingWindowScheme(m_latteView);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
bool WindowsTracker::enabled() const
|
||
6 years ago
|
{
|
||
6 years ago
|
return m_wm->windowsTracker()->enabled(m_latteView);
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
void WindowsTracker::setEnabled(bool active)
|
||
|
{
|
||
|
m_wm->windowsTracker()->setEnabled(m_latteView, active);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
WindowSystem::Tracker::LastActiveWindow *WindowsTracker::lastActiveWindow()
|
||
|
{
|
||
|
return m_wm->windowsTracker()->lastActiveWindow(m_latteView);
|
||
|
}
|
||
|
|
||
6 years ago
|
|
||
6 years ago
|
//! Window Functions
|
||
|
void WindowsTracker::setWindowOnActivities(QWindow &window, const QStringList &activities)
|
||
|
{
|
||
|
m_wm->setWindowOnActivities(window, activities);
|
||
|
}
|
||
|
|
||
6 years ago
|
void WindowsTracker::requestMoveLastWindowFromCurrentScreen(int localX, int localY)
|
||
|
{
|
||
|
m_wm->windowsTracker()->lastActiveWindow(m_latteView)->requestMove(m_latteView, localX, localY);
|
||
|
}
|
||
|
|
||
6 years ago
|
}
|
||
|
}
|