Skip to content

Commit

Permalink
Only emit raise/lower if z sort changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jul 22, 2023
1 parent fa22ced commit ae1eaa2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 35 deletions.
14 changes: 10 additions & 4 deletions applications/system-service/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ void Window::_raise(bool async){
default:
break;
}
auto oldZ = m_z;
if(!m_systemWindow){
m_z = std::numeric_limits<int>::max() - 2;
}
Expand All @@ -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){
Expand All @@ -320,15 +323,18 @@ 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<int>::min();
}
guiAPI->sortWindows();
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(){
Expand Down
23 changes: 1 addition & 22 deletions shared/qpa/oxidescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions shared/qpa/oxidescreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 8 additions & 4 deletions shared/qpa/oxidewindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
}
}
Expand All @@ -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();
}
}
}
Expand All @@ -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);
}
}
}

0 comments on commit ae1eaa2

Please sign in to comment.