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.
This commit is contained in:
Norman Feske 2015-11-11 16:16:16 +01:00 committed by Christian Helmuth
parent c26d30dffc
commit e4678a4dc1
3 changed files with 9 additions and 38 deletions

View File

@ -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;
}

View File

@ -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()

View File

@ -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);