window layouter: avoid superfluous layout updates

This commit is contained in:
Norman Feske 2019-01-02 15:07:52 +01:00
parent 9efb957059
commit 49e0036471
2 changed files with 17 additions and 2 deletions

View File

@ -549,6 +549,8 @@ void Window_layouter::Main::_handle_hover()
{
_hover.update();
User_state::Hover_state const orig_hover_state = _user_state.hover_state();
try {
Xml_node const hover_window_xml = _hover.xml().sub_node("window");
@ -573,8 +575,15 @@ void Window_layouter::Main::_handle_hover()
*/
}
/* propagate changed hovering to the decorator */
_gen_window_layout();
/*
* Propagate changed hovering to the decorator
*
* Should a decorator issue a hover update with the unchanged information,
* avoid triggering a superfluous window-layout update. This can happen in
* corner cases such as the completion of a window-drag operation.
*/
if (_user_state.hover_state() != orig_hover_state)
_gen_window_layout();
}

View File

@ -34,6 +34,12 @@ class Window_layouter::User_state
:
window_id(id), element(element)
{ }
bool operator != (Hover_state const &other) const
{
return window_id != other.window_id
|| element != other.element;
}
};
private: