From 728d4649e40e4e6f2d4e38ad6c4ed684d00d080d Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 Aug 2020 15:37:45 +0200 Subject: [PATCH] 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. --- Libraries/LibGUI/ComboBox.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp index aa99594194..7e594be0e5 100644 --- a/Libraries/LibGUI/ComboBox.cpp +++ b/Libraries/LibGUI/ComboBox.cpp @@ -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({});