support icon for LastActiveWindow

pull/6/head
Michail Vourlakos 6 years ago
parent 25c96d0d3a
commit e07cee3862

@ -21,6 +21,7 @@
// local
#include "trackedinfo.h"
#include "../abstractwindowinterface.h"
// Qt
#include <QDebug>
@ -31,7 +32,8 @@ namespace Tracker {
LastActiveWindow::LastActiveWindow(TrackedInfo *parent)
: QObject(parent)
: QObject(parent),
m_wm(parent->wm())
{
}
@ -174,6 +176,17 @@ void LastActiveWindow::setGeometry(QRect geometry)
emit geometryChanged();
}
QIcon LastActiveWindow::icon() const
{
return m_icon;
}
void LastActiveWindow::setIcon(QIcon icon)
{
m_icon = icon;
emit iconChanged();
}
QVariant LastActiveWindow::winId() const
{
return m_winId;
@ -191,6 +204,10 @@ void LastActiveWindow::setWinId(QVariant winId)
void LastActiveWindow::setInformation(const WindowInfoWrap &info)
{
if (m_winId != info.wid()) {
setIcon(m_wm->iconFor(info.wid()));
}
setWinId(info.wid());
setActive(info.isActive());

@ -29,6 +29,7 @@
namespace Latte {
namespace WindowSystem {
class AbstractWindowInterface;
namespace Tracker {
class TrackedInfo;
}
@ -55,6 +56,8 @@ class LastActiveWindow : public QObject {
Q_PROPERTY(QString display READ display NOTIFY displayChanged)
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
Q_PROPERTY(QVariant winId READ winId NOTIFY winIdChanged)
public:
@ -71,11 +74,14 @@ public:
QString display() const;
QRect geometry() const;
QIcon icon() const;
QVariant winId() const;
void setInformation(const WindowInfoWrap &info);
signals:
void iconChanged();
void isActiveChanged();
void isMinimizedChanged();
void isMaximizedChanged();
@ -99,6 +105,9 @@ private:
void setDisplay(QString display);
void setGeometry(QRect geometry);
void setIcon(QIcon icon);
void setWinId(QVariant winId);
private:
@ -112,8 +121,12 @@ private:
QString m_display;
QRect m_geometry;
QIcon m_icon;
QVariant m_winId;
AbstractWindowInterface *m_wm{nullptr};
};
}

@ -29,7 +29,8 @@ namespace Tracker {
TrackedInfo::TrackedInfo(Tracker::Windows *parent)
: QObject(parent)
: QObject(parent),
m_wm(parent->wm())
{
m_lastActiveWindow = new LastActiveWindow(this);
@ -178,6 +179,11 @@ void TrackedInfo::setTouchingWindowScheme(SchemeColors *scheme)
m_touchingWindowScheme = scheme;
}
AbstractWindowInterface *TrackedInfo::wm()
{
return m_wm;
}
}
}
}

@ -94,6 +94,8 @@ public:
SchemeColors *touchingWindowScheme() const;
void setTouchingWindowScheme(SchemeColors *scheme);
AbstractWindowInterface *wm();
signals:
void lastActiveWindowChanged();
@ -111,6 +113,8 @@ private:
SchemeColors *m_activeWindowScheme{nullptr};
SchemeColors *m_touchingWindowScheme{nullptr};
AbstractWindowInterface *m_wm{nullptr};
};
}

@ -118,6 +118,12 @@ void Windows::initViewHints(Latte::View *view)
setTouchingWindowScheme(view, nullptr);
}
AbstractWindowInterface *Windows::wm()
{
return m_wm;
}
void Windows::addView(Latte::View *view)
{
if (m_views.contains(view)) {

@ -67,6 +67,8 @@ public:
SchemeColors *touchingWindowScheme(Latte::View *view) const;
LastActiveWindow *lastActiveWindow(Latte::View *view);
AbstractWindowInterface *wm();
signals:
void enabledChanged(const Latte::View *view);
void activeWindowMaximizedChanged(const Latte::View *view);

Loading…
Cancel
Save