1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 01:17:55 +03:00

forward LastActiveWindow to QML

This commit is contained in:
Michail Vourlakos 2019-05-31 19:12:34 +03:00
parent e07cee3862
commit 53d24fe2c6
5 changed files with 20 additions and 14 deletions

View File

@ -42,6 +42,7 @@
#include "wm/schemecolors.h"
#include "wm/waylandinterface.h"
#include "wm/xwindowinterface.h"
#include "wm/tracker/lastactivewindow.h"
#include "wm/tracker/schemes.h"
#include "wm/tracker/windows.h"
@ -1074,6 +1075,7 @@ inline void Corona::qmlRegisterTypes() const
qmlRegisterType<QScreen>();
qmlRegisterType<Latte::View>();
qmlRegisterType<Latte::WindowSystem::SchemeColors>();
qmlRegisterType<Latte::WindowSystem::Tracker::LastActiveWindow>();
}
}

View File

@ -43,6 +43,8 @@ WindowsTracker::WindowsTracker(Latte::View *parent)
init();
m_wm->windowsTracker()->addView(m_latteView);
emit lastActiveWindowChanged();
}
WindowsTracker::~WindowsTracker()
@ -147,6 +149,11 @@ 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)

View File

@ -33,6 +33,9 @@ class View;
namespace WindowSystem {
class AbstractWindowInterface;
class SchemeColors;
namespace Tracker {
class LastActiveWindow;
}
}
}
@ -50,6 +53,8 @@ class WindowsTracker : public QObject {
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 WindowsTracker(Latte::View *parent);
virtual ~WindowsTracker();
@ -66,6 +71,8 @@ public:
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::SchemeColors *touchingWindowScheme() const;
WindowSystem::Tracker::LastActiveWindow *lastActiveWindow();
void setWindowOnActivities(QWindow &window, const QStringList &activities);
signals:
@ -79,6 +86,8 @@ signals:
void activeWindowSchemeChanged();
void touchingWindowSchemeChanged();
void lastActiveWindowChanged();
public slots:
Q_INVOKABLE void requestToggleMaximizeForActiveWindow();
Q_INVOKABLE void requestMoveActiveWindow(int localX, int localY);

View File

@ -41,20 +41,6 @@ class Windows;
namespace Latte {
namespace WindowSystem {
namespace Tracker {
/*
*
* bool enabled{false};
bool activeWindowMaximized{false};
bool activeWindowTouching{false};
bool existsWindowActive{false};
bool existsWindowMaximized{false};
bool existsWindowTouching{false};
QRect availableScreenGeometry;
WindowId lastActiveWindow;
SchemeColors *activeWindowScheme{nullptr};
SchemeColors *touchingWindowScheme{nullptr};
*
*/
class TrackedInfo : public QObject {
Q_OBJECT

View File

@ -80,6 +80,8 @@ Item{
// @since: 0.9
readonly property int iconSize: root.iconSize
readonly property QtObject windowsTracker: latteView ? latteView.windowsTracker : null
property Item actions: Actions{}
Connections {