1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:25:08 +00:00

LibGUI: Fix ComboBox desktop intersection rect

Subtracting 128 from the desktop rect's height was far to much and
and leading to weird rendering issues - now it's calculated exactly from
taskbar and menubar heights as well as a little additional offset to
make it fit perfectly.

Fixes #3115.
This commit is contained in:
Linus Groh 2020-08-13 15:37:45 +02:00 committed by Andreas Kling
parent 852770687a
commit 728d4649e4

View file

@ -186,8 +186,13 @@ void ComboBox::open()
model()->row_count() * m_list_view->item_height() + m_list_view->frame_thickness() * 2
};
auto taskbar_height = GUI::Desktop::the().taskbar_height();
auto menubar_height = GUI::Desktop::the().menubar_height();
// NOTE: This is so the combobox bottom edge exactly fits the taskbar's
// top edge - the value was found through trial and error though.
auto offset = 8;
Gfx::IntRect list_window_rect { my_screen_rect.bottom_left(), size };
list_window_rect.intersect(Desktop::the().rect().shrunken(0, 128));
list_window_rect.intersect(Desktop::the().rect().shrunken(0, taskbar_height + menubar_height + offset));
if (m_list_view->hover_highlighting())
m_list_view->set_last_valid_hovered_index({});