window layouter: use Attached_rom_dataspace::xml

Issue #1959
This commit is contained in:
Norman Feske 2016-05-09 17:18:00 +02:00 committed by Christian Helmuth
parent 8da737acfd
commit f19b269360
1 changed files with 39 additions and 49 deletions

View File

@ -270,8 +270,7 @@ struct Floating_window_layouter::Main : Operations
/* read decorator margins from the decorator's report */
unsigned top = 0, bottom = 0, left = 0, right = 0;
try {
Xml_node const margins_xml(decorator_margins.local_addr<char>());
Xml_node const floating_xml = margins_xml.sub_node("floating");
Xml_node const floating_xml = decorator_margins.xml().sub_node("floating");
top = attribute(floating_xml, "top", 0UL);
bottom = attribute(floating_xml, "bottom", 0UL);
@ -483,7 +482,7 @@ void Floating_window_layouter::Main::handle_window_list_update(unsigned)
window_list.update();
try {
import_window_list(Xml_node(window_list.local_addr<char>())); }
import_window_list(window_list.xml()); }
catch (...) {
PERR("Error while importing window list"); }
@ -493,59 +492,53 @@ void Floating_window_layouter::Main::handle_window_list_update(unsigned)
void Floating_window_layouter::Main::_apply_focus_request()
{
try {
Xml_node node(focus_request.local_addr<char>());
Window::Label const label =
focus_request.xml().attribute_value("label", Window::Label(""));
Window::Label const label = node.attribute_value("label", Window::Label(""));
int const id = focus_request.xml().attribute_value("id", 0L);
int const id = node.attribute_value("id", 0L);
/* don't apply the same focus request twice */
if (id == handled_focus_request_id)
return;
/* don't apply the same focus request twice */
if (id == handled_focus_request_id)
return;
bool focus_redefined = false;
bool focus_redefined = false;
/*
* Move all windows that match the requested label to the front while
* maintaining their ordering.
*/
Window *at = nullptr;
for (Window *w = windows.first(); w; w = w->next()) {
if (!w->label_matches(label))
continue;
focus_redefined = true;
/*
* Move all windows that match the requested label to the front while
* maintaining their ordering.
* Move window to behind the previous window that we moved to
* front. If 'w' is the first window that matches the selector,
* move it to the front ('at' argument of 'insert' is 0).
*/
Window *at = nullptr;
for (Window *w = windows.first(); w; w = w->next()) {
windows.remove(w);
windows.insert(w, at);
if (!w->label_matches(label))
continue;
/*
* Bring top-most window to the front of nitpicker's global view
* stack and set the focus to the top-most window.
*/
if (at == nullptr) {
w->topped();
focus_redefined = true;
/*
* Move window to behind the previous window that we moved to
* front. If 'w' is the first window that matches the selector,
* move it to the front ('at' argument of 'insert' is 0).
*/
windows.remove(w);
windows.insert(w, at);
/*
* Bring top-most window to the front of nitpicker's global view
* stack and set the focus to the top-most window.
*/
if (at == nullptr) {
w->topped();
_user_state.focused_window_id(w->id());
generate_focus_model();
}
at = w;
_user_state.focused_window_id(w->id());
generate_focus_model();
}
if (focus_redefined)
handled_focus_request_id = id;
at = w;
}
catch (...) {
PERR("Error while handling focus request"); }
if (focus_redefined)
handled_focus_request_id = id;
}
@ -564,18 +557,15 @@ void Floating_window_layouter::Main::handle_hover_update(unsigned)
hover.update();
try {
Xml_node const hover_xml(hover.local_addr<char>());
Xml_node const hover_window_xml = hover_xml.sub_node("window");
Xml_node const hover_window_xml = hover.xml().sub_node("window");
_user_state.hover(attribute(hover_window_xml, "id", 0UL),
element_from_hover_model(hover_window_xml));
}
/*
* An exception may occur during the 'Xml_node' construction if the hover
* model is missing or malformed. Under this condition, we invalidate
* the hover state.
* model is malformed. Under this condition, we invalidate the hover state.
*/
catch (...) {