mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +00:00
WindowServer: Support two window switcher modes: all or current desktop
When using the Super+Tab hotkey then all windows will be displayed, and we will switch to another virtual desktop if needed. When using the Alt+Tab hotkey then only the windows on the current desktop will be displayed.
This commit is contained in:
parent
7984c2836d
commit
6472ee0eff
4 changed files with 50 additions and 9 deletions
|
@ -20,6 +20,10 @@ class Window;
|
|||
class WindowSwitcher final : public Core::Object {
|
||||
C_OBJECT(WindowSwitcher)
|
||||
public:
|
||||
enum class Mode {
|
||||
ShowAllWindows,
|
||||
ShowCurrentDesktop
|
||||
};
|
||||
static WindowSwitcher& the();
|
||||
|
||||
WindowSwitcher();
|
||||
|
@ -28,7 +32,11 @@ public:
|
|||
bool is_visible() const { return m_visible; }
|
||||
void set_visible(bool);
|
||||
|
||||
void show() { set_visible(true); }
|
||||
void show(Mode mode)
|
||||
{
|
||||
m_mode = mode;
|
||||
set_visible(true);
|
||||
}
|
||||
void hide() { set_visible(false); }
|
||||
|
||||
void on_key_event(const KeyEvent&);
|
||||
|
@ -38,6 +46,8 @@ public:
|
|||
|
||||
void select_window(Window&);
|
||||
|
||||
Mode mode() const { return m_mode; }
|
||||
|
||||
private:
|
||||
int thumbnail_width() const { return 40; }
|
||||
int thumbnail_height() const { return 40; }
|
||||
|
@ -54,6 +64,7 @@ private:
|
|||
virtual void event(Core::Event&) override;
|
||||
|
||||
RefPtr<Window> m_switcher_window;
|
||||
Mode m_mode { Mode::ShowCurrentDesktop };
|
||||
Gfx::IntRect m_rect;
|
||||
bool m_visible { false };
|
||||
Vector<WeakPtr<Window>> m_windows;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue