ソースを参照

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.
Linus Groh 5 年 前
コミット
728d4649e4
1 ファイル変更6 行追加1 行削除
  1. 6 1
      Libraries/LibGUI/ComboBox.cpp

+ 6 - 1
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({});