diff --git a/applications/system-service/window.cpp b/applications/system-service/window.cpp index 2a3d23952..cc2688e0a 100644 --- a/applications/system-service/window.cpp +++ b/applications/system-service/window.cpp @@ -286,6 +286,7 @@ void Window::_raise(bool async){ default: break; } + auto oldZ = m_z; if(!m_systemWindow){ m_z = std::numeric_limits::max() - 2; } @@ -296,8 +297,10 @@ void Window::_raise(bool async){ if(m_state != oldState){ emit stateChanged(m_state); } - writeEvent(WindowEventType::Raise); - emit raised(); + if(m_z != oldZ){ + writeEvent(WindowEventType::Raise); + emit raised(); + } } void Window::_lower(bool async){ @@ -320,6 +323,7 @@ void Window::_lower(bool async){ if(wasVisible){ guiAPI->dirty(nullptr, m_geometry, EPFrameBuffer::Initialize, 0, async); } + auto oldZ = m_z; if(!m_systemWindow){ m_z = std::numeric_limits::min(); } @@ -327,8 +331,10 @@ void Window::_lower(bool async){ if(m_state != oldState){ emit stateChanged(m_state); } - writeEvent(WindowEventType::Lower); - emit lowered(); + if(m_z != oldZ){ + writeEvent(WindowEventType::Lower); + emit lowered(); + } } void Window::_close(){ diff --git a/shared/qpa/oxidescreen.cpp b/shared/qpa/oxidescreen.cpp index 9c3355a4b..aa048533b 100644 --- a/shared/qpa/oxidescreen.cpp +++ b/shared/qpa/oxidescreen.cpp @@ -46,7 +46,7 @@ void OxideScreen::addWindow(OxideWindow* window){ setDirty(window->geometry()); window->requestActivateWindow(); if(m_windows.length() == 1){ - raiseTopWindow(); + window->raise(); } } void OxideScreen::removeWindow(OxideWindow* window){ @@ -55,27 +55,6 @@ void OxideScreen::removeWindow(OxideWindow* window){ window->requestActivateWindow(); } -void OxideScreen::raiseTopWindow(){ - auto window = Oxide::Tarnish::topWindow(); - if(window != nullptr){ - window->raise(); // TODO - replace with event socket call - } -} - -void OxideScreen::lowerTopWindow(){ - auto window = Oxide::Tarnish::topWindow(); - if(window != nullptr){ - window->lower(); // TODO - replace with event socket call - } -} - -void OxideScreen::closeTopWindow(){ - auto window = Oxide::Tarnish::topWindow(); - if(window != nullptr){ - window->close(); // TODO - replace with event socket call - } -} - bool OxideScreen::event(QEvent* event){ if(event->type() == QEvent::UpdateRequest){ redraw(); diff --git a/shared/qpa/oxidescreen.h b/shared/qpa/oxidescreen.h index 248baf48e..18919e9f0 100644 --- a/shared/qpa/oxidescreen.h +++ b/shared/qpa/oxidescreen.h @@ -26,11 +26,6 @@ class Q_DECL_EXPORT OxideScreen : public QObject, public QPlatformScreen{ void addWindow(OxideWindow* window); void removeWindow(OxideWindow* window); -public slots: - void raiseTopWindow(); - void lowerTopWindow(); - void closeTopWindow(); - protected: bool event(QEvent *event) override; diff --git a/shared/qpa/oxidewindow.cpp b/shared/qpa/oxidewindow.cpp index f8d86702e..2a5fb5c3b 100644 --- a/shared/qpa/oxidewindow.cpp +++ b/shared/qpa/oxidewindow.cpp @@ -38,7 +38,8 @@ bool OxideWindow::close(){ if(platformScreen()->topPlatformWindow() == this){ auto window = Oxide::Tarnish::topWindow(); if(window != nullptr){ - window->close(); // TODO - replace with event socket call + // TODO - replace with event socket call + window->close(); } } return QPlatformWindow::close(); @@ -48,7 +49,8 @@ void OxideWindow::raise(){ if(platformScreen()->topPlatformWindow() == this){ auto window = Oxide::Tarnish::topWindow(); if(window != nullptr){ - window->raise(); // TODO - replace with event socket call + // TODO - replace with event socket call + window->raise(); } } } @@ -57,7 +59,8 @@ void OxideWindow::lower(){ if(platformScreen()->topPlatformWindow() == this){ auto window = Oxide::Tarnish::topWindow(); if(window != nullptr){ - window->lower(); // TODO - replace with event socket call + // TODO - replace with event socket call + window->lower(); } } } @@ -66,7 +69,8 @@ void OxideWindow::setGeometry(const QRect& rect){ if(platformScreen()->topPlatformWindow() == this){ auto window = Oxide::Tarnish::topWindow(); if(window != nullptr){ - window->setGeometry(rect); // TODO - replace with event socket call + // TODO - replace with event socket call + window->setGeometry(rect); } } }