1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

WindowServer+Taskbar: Animate window frames on minimize/unminimize

We now show a quick window outline animation when going in/out of
minimized state. It's a simple 10 frame animation at 60fps, just to
give a visual cue of what's happening with the window.

The Taskbar sends over the corresponding button rect for each window
to the WindowServer using a new WM_SetWindowTaskbarRect message.

Note that when unminimizing, we still *show* the window right away,
and don't hold off until the animation has finished. This avoids
making the desktop feel slow/sluggish. :^)
This commit is contained in:
Andreas Kling 2019-12-03 21:34:34 +01:00
parent 51262e7e2d
commit d111b6ead4
8 changed files with 78 additions and 0 deletions

View file

@ -102,6 +102,9 @@ public:
void set_rect_from_window_manager_resize(const Rect&);
void set_taskbar_rect(const Rect& rect) { m_taskbar_rect = rect; }
const Rect& taskbar_rect() const { return m_taskbar_rect; }
void move_to(const Point& position) { set_rect({ position, size() }); }
void move_to(int x, int y) { move_to({ x, y }); }
@ -152,6 +155,13 @@ public:
void request_update(const Rect&);
DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
bool in_minimize_animation() const { return m_minimize_animation_step != -1; }
int minimize_animation_index() const { return m_minimize_animation_step; }
void step_minimize_animation() { m_minimize_animation_step += 1; }
void start_minimize_animation() { m_minimize_animation_step = 0; }
void end_minimize_animation() { m_minimize_animation_step = -1; }
// For InlineLinkedList.
// FIXME: Maybe make a ListHashSet and then WSWindowManager can just use that.
WSWindow* m_next { nullptr };
@ -164,6 +174,7 @@ private:
String m_title;
Rect m_rect;
Rect m_saved_nonfullscreen_rect;
Rect m_taskbar_rect;
WSWindowType m_type { WSWindowType::Normal };
bool m_global_cursor_tracking_enabled { false };
bool m_automatic_cursor_tracking_enabled { false };
@ -190,4 +201,5 @@ private:
DisjointRectSet m_pending_paint_rects;
Rect m_unmaximized_rect;
RefPtr<WSMenu> m_window_menu;
int m_minimize_animation_step { -1 };
};