fix Tracker::AllScreens init signaling on startup

pull/6/head
Michail Vourlakos 6 years ago
parent e25da5a668
commit ef3db56ce7

@ -44,6 +44,16 @@ AllScreensTracker::~AllScreensTracker()
void AllScreensTracker::init() 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) { connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::informationAnnouncedForLayout, this, [&](const Latte::Layout::GenericLayout *layout) {
if (m_latteView->layout() == layout) { if (m_latteView->layout() == layout) {
initSignalsForInformation(); initSignalsForInformation();
@ -77,10 +87,20 @@ void AllScreensTracker::init()
void AllScreensTracker::initSignalsForInformation() void AllScreensTracker::initSignalsForInformation()
{ {
connect(lastActiveWindow(), &WindowSystem::Tracker::LastActiveWindow::draggingStarted, if (m_currentLastActiveWindow) {
disconnect(m_currentLastActiveWindow, &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
this, &AllScreensTracker::activeWindowDraggingStarted);
}
m_currentLastActiveWindow = lastActiveWindow();
connect(m_currentLastActiveWindow, &WindowSystem::Tracker::LastActiveWindow::draggingStarted,
this, &AllScreensTracker::activeWindowDraggingStarted); this, &AllScreensTracker::activeWindowDraggingStarted);
emit lastActiveWindowChanged(); emit lastActiveWindowChanged();
emit activeWindowMaximizedChanged();
emit existsWindowActiveChanged();
emit existsWindowMaximizedChanged();
emit activeWindowSchemeChanged();
} }
bool AllScreensTracker::activeWindowMaximized() const bool AllScreensTracker::activeWindowMaximized() const

@ -85,6 +85,9 @@ private slots:
private: private:
void init(); void init();
private:
Latte::WindowSystem::Tracker::LastActiveWindow *m_currentLastActiveWindow{nullptr};
Latte::View *m_latteView{nullptr}; Latte::View *m_latteView{nullptr};
WindowSystem::AbstractWindowInterface *m_wm{nullptr}; WindowSystem::AbstractWindowInterface *m_wm{nullptr};
}; };

@ -35,8 +35,6 @@ CurrentScreenTracker::CurrentScreenTracker(WindowsTracker *parent)
m_wm(parent->wm()) m_wm(parent->wm())
{ {
init(); init();
m_wm->windowsTracker()->addView(m_latteView);
} }
CurrentScreenTracker::~CurrentScreenTracker() CurrentScreenTracker::~CurrentScreenTracker()

@ -53,6 +53,8 @@ WindowsTracker::WindowsTracker(Latte::View *parent)
connect(m_currentScreenTracker, &TrackerPart::CurrentScreenTracker::activeWindowDraggingStarted, connect(m_currentScreenTracker, &TrackerPart::CurrentScreenTracker::activeWindowDraggingStarted,
this, &WindowsTracker::activeWindowDraggingStarted); this, &WindowsTracker::activeWindowDraggingStarted);
m_wm->windowsTracker()->addView(m_latteView);
emit allScreensChanged(); emit allScreensChanged();
emit currentScreenChanged(); emit currentScreenChanged();
} }

Loading…
Cancel
Save