mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
WindowServer+LibGUI+Taskbar: Store window progress as Optional<int>
We were previously using the magical constant -1 to signify that a window had no progress state. Be more explicit an use an Optional. :^)
This commit is contained in:
parent
8af7cda17a
commit
cc6db526a6
9 changed files with 20 additions and 21 deletions
|
@ -918,7 +918,7 @@ bool Window::is_modal() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void Window::set_progress(int progress)
|
||||
void Window::set_progress(Optional<int> progress)
|
||||
{
|
||||
if (m_progress == progress)
|
||||
return;
|
||||
|
|
|
@ -72,8 +72,6 @@ class Window final : public Core::Object
|
|||
, public InlineLinkedListNode<Window> {
|
||||
C_OBJECT(Window)
|
||||
public:
|
||||
Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window = nullptr);
|
||||
Window(Core::Object&, WindowType);
|
||||
virtual ~Window() override;
|
||||
|
||||
bool is_modified() const { return m_modified; }
|
||||
|
@ -295,8 +293,8 @@ public:
|
|||
|
||||
bool should_show_menubar() const { return m_should_show_menubar; }
|
||||
|
||||
int progress() const { return m_progress; }
|
||||
void set_progress(int);
|
||||
Optional<int> progress() const { return m_progress; }
|
||||
void set_progress(Optional<int>);
|
||||
|
||||
bool is_destroyed() const { return m_destroyed; }
|
||||
void destroy();
|
||||
|
@ -324,6 +322,9 @@ public:
|
|||
void set_menubar(Menubar*);
|
||||
|
||||
private:
|
||||
Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window = nullptr);
|
||||
Window(Core::Object&, WindowType);
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
void handle_mouse_event(const MouseEvent&);
|
||||
void handle_keydown_event(const KeyEvent&);
|
||||
|
@ -398,7 +399,7 @@ private:
|
|||
MenuItem* m_window_menu_close_item { nullptr };
|
||||
MenuItem* m_window_menu_menubar_visibility_item { nullptr };
|
||||
int m_minimize_animation_step { -1 };
|
||||
int m_progress { -1 };
|
||||
Optional<int> m_progress;
|
||||
bool m_should_show_menubar { true };
|
||||
bool m_modified { false };
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
endpoint WindowManagerClient
|
||||
{
|
||||
WindowRemoved(i32 wm_id, i32 client_id, i32 window_id) =|
|
||||
WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, i32 parent_client_id, i32 parent_window_id, bool is_active, bool is_minimized, bool is_modal, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, i32 progress) =|
|
||||
WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, i32 parent_client_id, i32 parent_window_id, bool is_active, bool is_minimized, bool is_modal, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, Optional<i32> progress) =|
|
||||
WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::ShareableBitmap bitmap) =|
|
||||
WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =|
|
||||
AppletAreaSizeChanged(i32 wm_id, Gfx::IntSize size) =|
|
||||
|
|
|
@ -54,7 +54,7 @@ endpoint WindowServer
|
|||
SetWindowTitle(i32 window_id, [UTF8] String title) => ()
|
||||
GetWindowTitle(i32 window_id) => ([UTF8] String title)
|
||||
|
||||
SetWindowProgress(i32 window_id, i32 progress) =|
|
||||
SetWindowProgress(i32 window_id, Optional<i32> progress) =|
|
||||
|
||||
SetWindowModified(i32 window_id, bool modified) =|
|
||||
IsWindowModified(i32 window_id) => (bool modified)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue