LibGUI: Make sure combobox list windows can't be moved

This is done by adding a new window type (Popup) and using it for the
combobox list window. Other incorrect uses of the Tooltip window type
have also been updated to use the new window type.
This commit is contained in:
Gunnar Beutner 2022-10-24 21:01:24 +02:00 committed by Gunnar Beutner
parent 419eb7ab97
commit 288c46dbdc
Notes: sideshowbarker 2024-07-17 05:05:36 +09:00
6 changed files with 10 additions and 3 deletions

View File

@ -146,8 +146,7 @@ Locator::Locator(Core::Object* parent)
};
m_popup_window = GUI::Window::construct(parent);
// FIXME: This is obviously not a tooltip window, but it's the closest thing to what we want atm.
m_popup_window->set_window_type(GUI::WindowType::Tooltip);
m_popup_window->set_window_type(GUI::WindowType::Popup);
m_popup_window->set_rect(0, 0, 500, 200);
m_suggestion_view = m_popup_window->set_main_widget<GUI::TableView>();

View File

@ -88,7 +88,7 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
: m_editor(editor)
{
m_popup_window = GUI::Window::construct(m_editor->window());
m_popup_window->set_window_type(GUI::WindowType::Tooltip);
m_popup_window->set_window_type(GUI::WindowType::Popup);
m_popup_window->set_rect(0, 0, 175, 25);
auto& main_widget = m_popup_window->set_main_widget<GUI::Widget>();

View File

@ -113,6 +113,7 @@ ComboBox::ComboBox()
};
m_list_window = add<Window>(window());
m_list_window->set_window_type(GUI::WindowType::Popup);
m_list_window->set_frameless(true);
m_list_window->set_window_mode(WindowMode::CaptureInput);
m_list_window->on_active_input_change = [this](bool is_active_input) {

View File

@ -1421,6 +1421,7 @@ Gfx::IntRect WindowManager::arena_rect_for_type(Screen& screen, WindowType type)
case WindowType::Tooltip:
case WindowType::Applet:
case WindowType::Notification:
case WindowType::Popup:
return screen.rect();
default:
VERIFY_NOT_REACHED();

View File

@ -302,6 +302,7 @@ public:
switch (window_type) {
case WindowType::Normal:
case WindowType::Tooltip:
case WindowType::Popup:
return false;
default:
return true;
@ -512,6 +513,8 @@ inline IterationDecision WindowManager::for_each_visible_window_from_back_to_fro
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Tooltip>() == IterationDecision::Break)
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Popup>() == IterationDecision::Break)
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Menu>() == IterationDecision::Break)
return IterationDecision::Break;
return for_each_window.template operator()<WindowType::WindowSwitcher>();
@ -541,6 +544,8 @@ inline IterationDecision WindowManager::for_each_visible_window_from_front_to_ba
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Tooltip>() == IterationDecision::Break)
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Popup>() == IterationDecision::Break)
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::Notification>() == IterationDecision::Break)
return IterationDecision::Break;
if (for_each_window.template operator()<WindowType::AppletArea>() == IterationDecision::Break)

View File

@ -19,6 +19,7 @@ enum class WindowType {
Notification,
Desktop,
AppletArea,
Popup,
_Count
};