summaryrefslogtreecommitdiff
path: root/WindowServer
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-10 02:33:43 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-10 02:33:43 +0100
commita149ad9b44b632a81d83814ddbc3fc89ede82594 (patch)
treeb574cd584c1f3aaef3a8e9b18bcb056ea71638fb /WindowServer
parent420ef4da8a12343a9e095f92c2b11d3eb20443c0 (diff)
downloadserenity-a149ad9b44b632a81d83814ddbc3fc89ede82594.zip
WindowServer: Window iteration should see the highlight window "in front".
Diffstat (limited to 'WindowServer')
-rw-r--r--WindowServer/WSWindowManager.cpp18
-rw-r--r--WindowServer/WSWindowManager.h16
2 files changed, 19 insertions, 15 deletions
diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp
index 732f6e2a8c..76b8b13961 100644
--- a/WindowServer/WSWindowManager.cpp
+++ b/WindowServer/WSWindowManager.cpp
@@ -914,12 +914,12 @@ void WSWindowManager::compose()
m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
}
- auto compose_window = [&] (WSWindow& window) {
+ for_each_visible_window_from_back_to_front([&] (WSWindow& window) {
RetainPtr<GraphicsBitmap> backing_store = window.backing_store();
if (!backing_store)
- return;
+ return IterationDecision::Continue;
if (!any_dirty_rect_intersects_window(window))
- return;
+ return IterationDecision::Continue;
PainterStateSaver saver(*m_back_painter);
m_back_painter->set_clip_rect(outer_window_rect(window));
for (auto& dirty_rect : dirty_rects.rects()) {
@@ -939,21 +939,9 @@ void WSWindowManager::compose()
else
m_back_painter->blit_with_opacity(dst, *backing_store, dirty_rect_in_window_coordinates, window.opacity());
}
- };
-
- for_each_visible_window_from_back_to_front([&] (WSWindow& window) {
- if (&window != m_highlight_window.ptr())
- compose_window(window);
- return IterationDecision::Continue;
});
- if (m_highlight_window)
- compose_window(*m_highlight_window);
-
draw_menubar();
- if (m_switcher.is_visible())
- compose_window(*m_switcher.switcher_window());
-
draw_cursor();
if (m_flash_flush) {
diff --git a/WindowServer/WSWindowManager.h b/WindowServer/WSWindowManager.h
index 2c296466dc..9fea280f8a 100644
--- a/WindowServer/WSWindowManager.h
+++ b/WindowServer/WSWindowManager.h
@@ -177,14 +177,23 @@ private:
template<typename Callback>
IterationDecision WSWindowManager::for_each_visible_window_of_type_from_back_to_front(WSWindowType type, Callback callback)
{
+ bool do_highlight_window_at_end = false;
for (auto* window = m_windows_in_order.head(); window; window = window->next()) {
if (!window->is_visible())
continue;
if (window->type() != type)
continue;
+ if (m_highlight_window.ptr() == window) {
+ do_highlight_window_at_end = true;
+ continue;
+ }
if (callback(*window) == IterationDecision::Abort)
return IterationDecision::Abort;
}
+ if (do_highlight_window_at_end) {
+ if (callback(*m_highlight_window) == IterationDecision::Abort)
+ return IterationDecision::Abort;
+ }
return IterationDecision::Continue;
}
@@ -199,11 +208,18 @@ IterationDecision WSWindowManager::for_each_visible_window_from_back_to_front(Ca
template<typename Callback>
IterationDecision WSWindowManager::for_each_visible_window_of_type_from_front_to_back(WSWindowType type, Callback callback)
{
+ if (m_highlight_window && m_highlight_window->type() == type && m_highlight_window->is_visible()) {
+ if (callback(*m_highlight_window) == IterationDecision::Abort)
+ return IterationDecision::Abort;
+ }
+
for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) {
if (!window->is_visible())
continue;
if (window->type() != type)
continue;
+ if (window == m_highlight_window.ptr())
+ continue;
if (callback(*window) == IterationDecision::Abort)
return IterationDecision::Abort;
}