From b7f5aae64a247a6ed005ff161caa9162cf0751cb Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 23 Feb 2019 20:24:16 +0100 Subject: [PATCH] sculpt: don't constrain '+' menu to avail space Sculpt used to restrict the size of leitzentrale windows to the screen area that is not obstructed by the menu and log. This is useful for the runtime view and the inspect window. However, the menu should be allowed to use the entire screen because it overlays the other content. Before this patch, the menu wouldn't be displayed completely on small resolutions (e.g., 1024x768 when using the VESA driver) because the log at the bottom of the screen imposed the size constraint on the menu. With the patch, the menu is able to overlay the log window. --- repos/gems/src/app/sculpt_manager/main.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/repos/gems/src/app/sculpt_manager/main.cc b/repos/gems/src/app/sculpt_manager/main.cc index e5a023760b..5c6220aa70 100644 --- a/repos/gems/src/app/sculpt_manager/main.cc +++ b/repos/gems/src/app/sculpt_manager/main.cc @@ -704,12 +704,17 @@ void Sculpt::Main::_handle_window_layout() }; auto win_size = [&] (Xml_node win) { + return Area(win.attribute_value("width", 0UL), + win.attribute_value("height", 0UL)); }; + + /* window size limited to space unobstructed by the menu and log */ + auto constrained_win_size = [&] (Xml_node win) { unsigned const inspect_w = inspect_p2.x() - inspect_p1.x(), inspect_h = inspect_p2.y() - inspect_p1.y(); - return Area(min(inspect_w, win.attribute_value("width", 0UL)), - min(inspect_h, win.attribute_value("height", 0UL))); + Area const size = win_size(win); + return Area(min(inspect_w, size.w()), min(inspect_h, size.h())); }; _with_window(window_list, Label("gui -> menu -> "), [&] (Xml_node win) { @@ -718,7 +723,7 @@ void Sculpt::Main::_handle_window_layout() /* calculate centered runtime view within the available main (inspect) area */ Rect runtime_view; _with_window(window_list, runtime_view_label, [&] (Xml_node win) { - Area const size = win_size(win); + Area const size = constrained_win_size(win); Point const pos = Rect(inspect_p1, inspect_p2).center(size); runtime_view = Rect(pos, size); }); @@ -747,7 +752,7 @@ void Sculpt::Main::_handle_window_layout() _with_window(window_list, runtime_view_label, [&] (Xml_node win) { /* center runtime view within the available main (inspect) area */ - Area const size = win_size(win); + Area const size = constrained_win_size(win); Point const pos = Rect(inspect_p1, inspect_p2).center(size); gen_window(win, Rect(pos, size));