diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2022-10-24 21:01:24 +0200 |
---|---|---|
committer | Gunnar Beutner <gunnar@beutner.name> | 2022-10-26 17:02:00 +0200 |
commit | 288c46dbdc144868574503f857a9184cd21483b3 (patch) | |
tree | 19844b4656890b7c04299bc66c4392ae96ce1adb | |
parent | 419eb7ab97eaa85e5df4ffacad411aed631986d0 (diff) | |
download | serenity-288c46dbdc144868574503f857a9184cd21483b3.zip |
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.
-rw-r--r-- | Userland/DevTools/HackStudio/Locator.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/AutocompleteProvider.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.cpp | 1 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.cpp | 1 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.h | 5 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowType.h | 1 |
6 files changed, 10 insertions, 3 deletions
diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index 1b710e9ca3..3217874b9e 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -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>(); diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index 0d208f1598..7a6d59c694 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -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>(); diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index dc8f3041c1..7895b108ff 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -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) { diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 576194d0a5..5d52ae38e8 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -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(); diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index d8ed8fd620..2a63dd8621 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -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) diff --git a/Userland/Services/WindowServer/WindowType.h b/Userland/Services/WindowServer/WindowType.h index 4851659762..632005d037 100644 --- a/Userland/Services/WindowServer/WindowType.h +++ b/Userland/Services/WindowServer/WindowType.h @@ -19,6 +19,7 @@ enum class WindowType { Notification, Desktop, AppletArea, + Popup, _Count }; |