mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
WindowServer: Use early return to reduce nesting
This commit is contained in:
parent
14f9a29502
commit
97508844dc
1 changed files with 27 additions and 24 deletions
|
@ -125,8 +125,11 @@ void Menu::redraw()
|
||||||
|
|
||||||
Window& Menu::ensure_menu_window()
|
Window& Menu::ensure_menu_window()
|
||||||
{
|
{
|
||||||
|
if (m_menu_window)
|
||||||
|
return *m_menu_window;
|
||||||
|
|
||||||
int width = this->content_width();
|
int width = this->content_width();
|
||||||
if (!m_menu_window) {
|
|
||||||
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
|
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
|
||||||
for (auto& item : m_items) {
|
for (auto& item : m_items) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
@ -151,7 +154,7 @@ Window& Menu::ensure_menu_window()
|
||||||
window->set_rect(0, 0, width, window_height);
|
window->set_rect(0, 0, width, window_height);
|
||||||
m_menu_window = move(window);
|
m_menu_window = move(window);
|
||||||
draw();
|
draw();
|
||||||
}
|
|
||||||
return *m_menu_window;
|
return *m_menu_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue