mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
LibGUI+WindowServer: Introduce WindowModes
Previously, Windows only understood blocking modality: Windows were either modal, i.e., in a blocking state, or not. Windows could also be set as Accessories or ToolWindows, attributes which technically applied modes to their parents but were implemented ad hoc. This patch redefines these modal effects as WindowModes and sets up some helpers. This will let us simplify a lot of modal logic in the upcoming patches and make it easier to build new modal effects in the future. Windows can now set 1 of 5 modes before reification: -Modeless: No modal effect; begins a new modal chain -Passive: Window joins its modal chain but has no effect -RenderAbove: Window renders above its parent -CaptureInput: Window captures the active input role from its parent -Blocking: Window blocks all interaction with its modal chain States like fullscreen and tiling are dynamic and don't alter behavior in modal chains, so they aren't included.
This commit is contained in:
parent
609391b46e
commit
589572cfa4
15 changed files with 91 additions and 63 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/FocusSource.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/WindowMode.h>
|
||||
#include <LibGUI/WindowType.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
@ -33,8 +34,8 @@ public:
|
|||
bool is_modified() const;
|
||||
void set_modified(bool);
|
||||
|
||||
bool is_modal() const { return m_modal; }
|
||||
void set_modal(bool);
|
||||
bool is_modal() const { return m_window_mode != WindowMode::Modeless; }
|
||||
bool is_blocking() const { return m_window_mode == WindowMode::Blocking; }
|
||||
|
||||
bool is_fullscreen() const { return m_fullscreen; }
|
||||
void set_fullscreen(bool);
|
||||
|
@ -71,6 +72,9 @@ public:
|
|||
WindowType window_type() const { return m_window_type; }
|
||||
void set_window_type(WindowType);
|
||||
|
||||
WindowMode window_mode() const { return m_window_mode; }
|
||||
void set_window_mode(WindowMode);
|
||||
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
void make_window_manager(unsigned event_mask);
|
||||
|
@ -284,12 +288,12 @@ private:
|
|||
Gfx::IntSize m_size_increment;
|
||||
Gfx::IntSize m_base_size;
|
||||
WindowType m_window_type { WindowType::Normal };
|
||||
WindowMode m_window_mode { WindowMode::Modeless };
|
||||
AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> m_cursor { Gfx::StandardCursor::None };
|
||||
AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> m_effective_cursor { Gfx::StandardCursor::None };
|
||||
bool m_is_active_input { false };
|
||||
bool m_has_alpha_channel { false };
|
||||
bool m_double_buffering_enabled { true };
|
||||
bool m_modal { false };
|
||||
bool m_resizable { true };
|
||||
bool m_obey_widget_min_size { true };
|
||||
Optional<Gfx::IntSize> m_resize_aspect_ratio {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue