themed_decorator: use Attached_rom_dataspace::xml

This simplifies the code a bit.
This commit is contained in:
Norman Feske 2019-06-17 13:00:40 +02:00 committed by Christian Helmuth
parent dec2d897c3
commit 070a24956d
1 changed files with 10 additions and 27 deletions

View File

@ -261,33 +261,18 @@ void Decorator::Main::_handle_nitpicker_sync()
auto flush_window_stack_changes = [&] () {
_window_stack.update_nitpicker_views(); };
if (_window_layout_update_needed && _window_layout.valid()) {
if (_window_layout_update_needed) {
try {
Xml_node xml(_window_layout.local_addr<char>(),
_window_layout.size());
_window_stack.update_model(_window_layout.xml(), flush_window_stack_changes);
_window_stack.update_model(xml, flush_window_stack_changes);
model_updated = true;
model_updated = true;
/*
* A decorator element might have appeared or disappeared under
* the pointer.
*/
if (_pointer.constructed() && _pointer->valid())
update_hover_report(Xml_node(_pointer->local_addr<char>()),
_window_stack, _hover, _hover_reporter);
} catch (Xml_node::Invalid_syntax) {
/*
* An error occured with processing the XML model. Flush the
* internal representation.
*/
_window_stack.update_model(Xml_node("<window_layout/>"),
flush_window_stack_changes);
}
/*
* A decorator element might have appeared or disappeared under
* the pointer.
*/
if (_pointer.constructed())
update_hover_report(_pointer->xml(), _window_stack, _hover, _hover_reporter);
_window_layout_update_needed = false;
}
@ -317,9 +302,7 @@ void Decorator::Main::_handle_pointer_update()
_pointer->update();
if (_pointer->valid())
update_hover_report(Xml_node(_pointer->local_addr<char>()),
_window_stack, _hover, _hover_reporter);
update_hover_report(_pointer->xml(), _window_stack, _hover, _hover_reporter);
}