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:
parent
c26d30dffc
commit
e4678a4dc1
|
@ -214,10 +214,9 @@ bool Decorator::Window::update(Genode::Xml_node window_node)
|
||||||
unsigned const topped_cnt = attribute(window_node, "topped", 0UL);
|
unsigned const topped_cnt = attribute(window_node, "topped", 0UL);
|
||||||
if (topped_cnt != _topped_cnt) {
|
if (topped_cnt != _topped_cnt) {
|
||||||
|
|
||||||
_global_to_front = true;
|
_topped_cnt = topped_cnt;
|
||||||
_topped_cnt = topped_cnt;
|
|
||||||
_nitpicker_stacking_up_to_date = false;
|
|
||||||
|
|
||||||
|
stack(Nitpicker::Session::View_handle());
|
||||||
updated |= true;
|
updated |= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,6 @@ class Decorator::Window : public Window_base
|
||||||
*/
|
*/
|
||||||
bool _nitpicker_views_up_to_date = false;
|
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;
|
Nitpicker::Session::View_handle _neighbor;
|
||||||
|
|
||||||
struct Nitpicker_view
|
struct Nitpicker_view
|
||||||
|
@ -101,8 +94,6 @@ class Decorator::Window : public Window_base
|
||||||
|
|
||||||
Border const _border { _init_border() };
|
Border const _border { _init_border() };
|
||||||
|
|
||||||
bool _global_to_front = false;
|
|
||||||
|
|
||||||
unsigned _topped_cnt = 0;
|
unsigned _topped_cnt = 0;
|
||||||
|
|
||||||
Window_title _title;
|
Window_title _title;
|
||||||
|
@ -409,7 +400,12 @@ class Decorator::Window : public Window_base
|
||||||
void stack(Nitpicker::Session::View_handle neighbor) override
|
void stack(Nitpicker::Session::View_handle neighbor) override
|
||||||
{
|
{
|
||||||
_neighbor = neighbor;
|
_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
|
Nitpicker::Session::View_handle frontmost_view() const override
|
||||||
|
@ -449,28 +445,6 @@ class Decorator::Window : public Window_base
|
||||||
|
|
||||||
_nitpicker_views_up_to_date = true;
|
_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()
|
void adapt_to_changed_config()
|
||||||
|
|
|
@ -259,9 +259,7 @@ void Decorator::Window_stack::update_model(Genode::Xml_node root_node)
|
||||||
* Immediately propagate the new stacking position of the new
|
* Immediately propagate the new stacking position of the new
|
||||||
* window to nitpicker ('update_nitpicker_views'). Otherwise,
|
* window to nitpicker ('update_nitpicker_views'). Otherwise,
|
||||||
*/
|
*/
|
||||||
new_window->stack(_windows.first()
|
new_window->stack(Nitpicker::Session::View_handle());
|
||||||
? _windows.first()->frontmost_view()
|
|
||||||
: Nitpicker::Session::View_handle());
|
|
||||||
|
|
||||||
_windows.insert(new_window);
|
_windows.insert(new_window);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue