From e4678a4dc1acde2d6f9ce5e019f59aff95fec45d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 11 Nov 2015 16:16:16 +0100 Subject: [PATCH] decorator: do not defer stacking changes This patch changes the decorator to always apply stacking-order changes immediately instead of deferring the re-stacking of the nitpicker views to the next call of 'update_nitpicker_views'. The deferred application did not always work when more then one windows changed their stacking position at once because the cached '_neighbor' values interfered with each other. The eager re-stacking should not have negative effects on the user experience because, in contrast to re-positioning, re-stacking a rare operation. --- repos/gems/src/app/decorator/window.cc | 5 ++- repos/gems/src/app/decorator/window.h | 38 ++++------------------- repos/os/include/decorator/window_stack.h | 4 +-- 3 files changed, 9 insertions(+), 38 deletions(-) diff --git a/repos/gems/src/app/decorator/window.cc b/repos/gems/src/app/decorator/window.cc index 099a32ebd..8347c3ab1 100644 --- a/repos/gems/src/app/decorator/window.cc +++ b/repos/gems/src/app/decorator/window.cc @@ -214,10 +214,9 @@ bool Decorator::Window::update(Genode::Xml_node window_node) unsigned const topped_cnt = attribute(window_node, "topped", 0UL); if (topped_cnt != _topped_cnt) { - _global_to_front = true; - _topped_cnt = topped_cnt; - _nitpicker_stacking_up_to_date = false; + _topped_cnt = topped_cnt; + stack(Nitpicker::Session::View_handle()); updated |= true; } diff --git a/repos/gems/src/app/decorator/window.h b/repos/gems/src/app/decorator/window.h index 3874237cd..cfa4259e3 100644 --- a/repos/gems/src/app/decorator/window.h +++ b/repos/gems/src/app/decorator/window.h @@ -37,13 +37,6 @@ class Decorator::Window : public Window_base */ bool _nitpicker_views_up_to_date = false; - /* - * Flag indicating that the stacking position of the window within the - * window stack has changed. The new stacking position must be - * propagated to nitpicker. - */ - bool _nitpicker_stacking_up_to_date = false; - Nitpicker::Session::View_handle _neighbor; struct Nitpicker_view @@ -101,8 +94,6 @@ class Decorator::Window : public Window_base Border const _border { _init_border() }; - bool _global_to_front = false; - unsigned _topped_cnt = 0; Window_title _title; @@ -409,7 +400,12 @@ class Decorator::Window : public Window_base void stack(Nitpicker::Session::View_handle neighbor) override { _neighbor = neighbor; - _nitpicker_stacking_up_to_date = false; + + _content_view.stack(neighbor); + _top_view.stack(_content_view.handle()); + _left_view.stack(_top_view.handle()); + _right_view.stack(_left_view.handle()); + _bottom_view.stack(_right_view.handle()); } Nitpicker::Session::View_handle frontmost_view() const override @@ -449,28 +445,6 @@ class Decorator::Window : public Window_base _nitpicker_views_up_to_date = true; } - - if (!_nitpicker_stacking_up_to_date) { - - /* - * Bring the view to the global top of the view stack if the - * 'topped' counter changed. Otherwise, we refer to a - * session-local neighbor for the restacking operation. - */ - Nitpicker::Session::View_handle neighbor = _neighbor; - if (_global_to_front) { - neighbor = Nitpicker::Session::View_handle(); - _global_to_front = false; - } - - _content_view.stack(neighbor); - _top_view.stack(_content_view.handle()); - _left_view.stack(_top_view.handle()); - _right_view.stack(_left_view.handle()); - _bottom_view.stack(_right_view.handle()); - - _nitpicker_stacking_up_to_date = true; - } } void adapt_to_changed_config() diff --git a/repos/os/include/decorator/window_stack.h b/repos/os/include/decorator/window_stack.h index ff2e97610..a9f4e5ce7 100644 --- a/repos/os/include/decorator/window_stack.h +++ b/repos/os/include/decorator/window_stack.h @@ -259,9 +259,7 @@ void Decorator::Window_stack::update_model(Genode::Xml_node root_node) * Immediately propagate the new stacking position of the new * window to nitpicker ('update_nitpicker_views'). Otherwise, */ - new_window->stack(_windows.first() - ? _windows.first()->frontmost_view() - : Nitpicker::Session::View_handle()); + new_window->stack(Nitpicker::Session::View_handle()); _windows.insert(new_window);