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

WindowServer: Add basic virtual desktop support

This creates a 2-dimensional array of WindowStack instances, one for
each virtual desktop. The main desktop 0,0 is the main desktop, which
is the desktop used for all stationary windows (e.g. taskbar, desktop).
When adding windows to a desktop, stationary windows are always added
to the main desktop.

When composing the desktop, there are usually two WindowStacks
involved. For stationary windows, the main desktop will be traversed,
and for everything else the current virtual desktop will be iterated.
Iteration is interweaved to preserve the correct order. During the
transition animation, two WindowStacks will be iterated at the same
time.
This commit is contained in:
Tom 2021-06-29 19:51:26 -06:00 committed by Andreas Kling
parent 944e5cfb35
commit 584b144953
11 changed files with 900 additions and 213 deletions

View file

@ -22,6 +22,7 @@ class Cursor;
class MultiScaleBitmaps;
class Window;
class WindowManager;
class WindowStack;
enum class WallpaperMode {
Tile,
@ -92,6 +93,27 @@ public:
return IterationDecision::Continue;
}
template<typename F>
IterationDecision for_each_rendering_window_stack(F f)
{
VERIFY(m_current_window_stack);
IterationDecision decision = f(*m_current_window_stack);
if (decision != IterationDecision::Continue)
return decision;
if (m_transitioning_to_window_stack)
decision = f(*m_transitioning_to_window_stack);
return decision;
}
[[nodiscard]] WindowStack& get_rendering_window_stacks(WindowStack*& transitioning_window_stack)
{
transitioning_window_stack = m_transitioning_to_window_stack;
return *m_current_window_stack;
}
bool is_switching_window_stacks() const { return m_transitioning_to_window_stack != nullptr; }
void switch_to_window_stack(WindowStack&);
void did_construct_window_manager(Badge<WindowManager>);
const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
@ -114,10 +136,14 @@ private:
void start_compose_async_timer();
void recompute_overlay_rects();
void recompute_occlusions();
bool any_opaque_window_above_this_one_contains_rect(const Window&, const Gfx::IntRect&);
bool any_opaque_window_above_this_one_contains_rect(Window&, const Gfx::IntRect&);
void change_cursor(const Cursor*);
void flush(Screen&);
Gfx::IntPoint window_transition_offset(Window&);
void update_animations(Screen&, Gfx::DisjointRectSet& flush_rects);
void create_window_stack_switch_overlay(WindowStack&);
void start_window_stack_switch_overlay_timer();
void finish_window_stack_switch();
RefPtr<Core::Timer> m_compose_timer;
RefPtr<Core::Timer> m_immediate_compose_timer;
@ -139,6 +165,7 @@ private:
OwnPtr<Gfx::Painter> m_cursor_back_painter;
Gfx::IntRect m_last_cursor_rect;
OwnPtr<ScreenNumberOverlay> m_screen_number_overlay;
OwnPtr<WindowStackSwitchOverlay> m_window_stack_switch_overlay;
bool m_buffers_are_flipped { false };
bool m_screen_can_set_buffer { false };
bool m_cursor_back_is_valid { false };
@ -197,6 +224,12 @@ private:
RefPtr<Core::Timer> m_display_link_notify_timer;
size_t m_display_link_count { 0 };
WindowStack* m_current_window_stack { nullptr };
WindowStack* m_transitioning_to_window_stack { nullptr };
RefPtr<Animation> m_window_stack_transition_animation;
OwnPtr<WindowStackSwitchOverlay> m_stack_switch_overlay;
RefPtr<Core::Timer> m_stack_switch_overlay_timer;
size_t m_show_screen_number_count { 0 };
Optional<Gfx::Color> m_custom_background_color;