mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +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
|
@ -126,7 +126,7 @@ public:
|
|||
|
||||
class WMWindowStateChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, const StringView& title, const Gfx::IntRect& rect, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, int progress)
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, const StringView& title, const Gfx::IntRect& rect, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress)
|
||||
: WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_parent_client_id(parent_client_id)
|
||||
, m_parent_window_id(parent_window_id)
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
WindowType window_type() const { return m_window_type; }
|
||||
bool is_minimized() const { return m_minimized; }
|
||||
bool is_frameless() const { return m_frameless; }
|
||||
int progress() const { return m_progress; }
|
||||
Optional<int> progress() const { return m_progress; }
|
||||
|
||||
private:
|
||||
int m_parent_client_id;
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
bool m_modal;
|
||||
bool m_minimized;
|
||||
bool m_frameless;
|
||||
int m_progress;
|
||||
Optional<int> m_progress;
|
||||
};
|
||||
|
||||
class WMWindowRectChangedEvent : public WMEvent {
|
||||
|
|
|
@ -1021,7 +1021,7 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget)
|
|||
m_automatic_cursor_tracking_widget = nullptr;
|
||||
}
|
||||
|
||||
void Window::set_progress(int progress)
|
||||
void Window::set_progress(Optional<int> progress)
|
||||
{
|
||||
VERIFY(m_window_id);
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress));
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
|
||||
Window* find_parent_window();
|
||||
|
||||
void set_progress(int);
|
||||
void set_progress(Optional<int>);
|
||||
|
||||
void update_cursor(Badge<Widget>) { update_cursor(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue