diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-02 12:15:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-02 12:24:23 +0200 |
commit | 3331098aee05f1e27039b60fb7eb5cda01fffac1 (patch) | |
tree | 85a80120c6185eaea8ce26dec4142404df40ae23 | |
parent | c9321b4f009a4e8a143d55e30ba5e0a4718785ff (diff) | |
download | serenity-3331098aee05f1e27039b60fb7eb5cda01fffac1.zip |
WindowServer+LibGUI+Taskbar: Don't include frameless windows in lists
Frameless windows don't need to show up in the taskbar or the switcher.
-rw-r--r-- | Applications/Taskbar/TaskbarWindow.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibGUI/Event.h | 5 | ||||
-rw-r--r-- | Libraries/LibGUI/WindowServerConnection.cpp | 2 | ||||
-rw-r--r-- | Servers/WindowServer/ClientConnection.cpp | 4 | ||||
-rw-r--r-- | Servers/WindowServer/Window.cpp | 3 | ||||
-rw-r--r-- | Servers/WindowServer/Window.h | 4 | ||||
-rw-r--r-- | Servers/WindowServer/WindowClient.ipc | 2 | ||||
-rw-r--r-- | Servers/WindowServer/WindowManager.cpp | 2 | ||||
-rw-r--r-- | Servers/WindowServer/WindowSwitcher.cpp | 2 |
9 files changed, 17 insertions, 13 deletions
diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp index f13cb80be4..424fcd1ee7 100644 --- a/Applications/Taskbar/TaskbarWindow.cpp +++ b/Applications/Taskbar/TaskbarWindow.cpp @@ -141,9 +141,9 @@ NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& return button; } -static bool should_include_window(GUI::WindowType window_type) +static bool should_include_window(GUI::WindowType window_type, bool is_frameless) { - return window_type == GUI::WindowType::Normal; + return window_type == GUI::WindowType::Normal && !is_frameless; } void TaskbarWindow::wm_event(GUI::WMEvent& event) @@ -199,7 +199,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) changed_event.is_active(), changed_event.is_minimized()); #endif - if (!should_include_window(changed_event.window_type())) + if (!should_include_window(changed_event.window_type(), changed_event.is_frameless())) break; auto& window = WindowList::the().ensure_window(identifier); window.set_title(changed_event.title()); diff --git a/Libraries/LibGUI/Event.h b/Libraries/LibGUI/Event.h index a2240a1659..6c2374ccfb 100644 --- a/Libraries/LibGUI/Event.h +++ b/Libraries/LibGUI/Event.h @@ -110,13 +110,14 @@ public: class WMWindowStateChangedEvent : public WMEvent { public: - WMWindowStateChangedEvent(int client_id, int window_id, const StringView& title, const Gfx::Rect& rect, bool is_active, WindowType window_type, bool is_minimized) + WMWindowStateChangedEvent(int client_id, int window_id, const StringView& title, const Gfx::Rect& rect, bool is_active, WindowType window_type, bool is_minimized, bool is_frameless) : WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id) , m_title(title) , m_rect(rect) , m_window_type(window_type) , m_active(is_active) , m_minimized(is_minimized) + , m_frameless(is_frameless) { } @@ -125,6 +126,7 @@ public: bool is_active() const { return m_active; } WindowType window_type() const { return m_window_type; } bool is_minimized() const { return m_minimized; } + bool is_frameless() const { return m_frameless; } private: String m_title; @@ -132,6 +134,7 @@ private: WindowType m_window_type; bool m_active; bool m_minimized; + bool m_frameless; }; class WMWindowRectChangedEvent : public WMEvent { diff --git a/Libraries/LibGUI/WindowServerConnection.cpp b/Libraries/LibGUI/WindowServerConnection.cpp index 64fc5f2534..036cf64869 100644 --- a/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Libraries/LibGUI/WindowServerConnection.cpp @@ -232,7 +232,7 @@ void WindowServerConnection::handle(const Messages::WindowClient::MenuItemActiva void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowStateChanged& message) { if (auto* window = Window::from_window_id(message.wm_id())) - Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.title(), message.rect(), message.is_active(), static_cast<WindowType>(message.window_type()), message.is_minimized())); + Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.title(), message.rect(), message.is_active(), static_cast<WindowType>(message.window_type()), message.is_minimized(), message.is_frameless())); } void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRectChanged& message) diff --git a/Servers/WindowServer/ClientConnection.cpp b/Servers/WindowServer/ClientConnection.cpp index e49143d700..b34618ec03 100644 --- a/Servers/WindowServer/ClientConnection.cpp +++ b/Servers/WindowServer/ClientConnection.cpp @@ -462,7 +462,7 @@ Window* ClientConnection::window_from_id(i32 window_id) OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(const Messages::WindowServer::CreateWindow& message) { int window_id = m_next_window_id++; - auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.resizable(), message.fullscreen()); + auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.frameless(), message.resizable(), message.fullscreen()); dbg() << "Constructing window with parent_window_id=" << message.parent_window_id(); @@ -479,8 +479,6 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co window->set_parent_window(*parent_window); } - window->set_frameless(message.frameless()); - window->set_has_alpha_channel(message.has_alpha_channel()); window->set_title(message.title()); if (!message.fullscreen()) { diff --git a/Servers/WindowServer/Window.cpp b/Servers/WindowServer/Window.cpp index cd28940dc7..4f24dfb7af 100644 --- a/Servers/WindowServer/Window.cpp +++ b/Servers/WindowServer/Window.cpp @@ -89,12 +89,13 @@ Window::Window(Core::Object& parent, WindowType type) WindowManager::the().add_window(*this); } -Window::Window(ClientConnection& client, WindowType window_type, int window_id, bool modal, bool minimizable, bool resizable, bool fullscreen) +Window::Window(ClientConnection& client, WindowType window_type, int window_id, bool modal, bool minimizable, bool frameless, bool resizable, bool fullscreen) : Core::Object(&client) , m_client(&client) , m_type(window_type) , m_modal(modal) , m_minimizable(minimizable) + , m_frameless(frameless) , m_resizable(resizable) , m_fullscreen(fullscreen) , m_window_id(window_id) diff --git a/Servers/WindowServer/Window.h b/Servers/WindowServer/Window.h index 54a884b066..09856c96dd 100644 --- a/Servers/WindowServer/Window.h +++ b/Servers/WindowServer/Window.h @@ -66,7 +66,7 @@ class Window final : public Core::Object , public InlineLinkedListNode<Window> { C_OBJECT(Window) public: - Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool resizable, bool fullscreen); + Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool frameless, bool resizable, bool fullscreen); Window(Core::Object&, WindowType); virtual ~Window() override; @@ -254,6 +254,7 @@ private: bool m_has_alpha_channel { false }; bool m_modal { false }; bool m_minimizable { false }; + bool m_frameless { false }; bool m_resizable { false }; bool m_listens_to_wm_events { false }; bool m_minimized { false }; @@ -262,7 +263,6 @@ private: WindowTileType m_tiled { WindowTileType::None }; Gfx::Rect m_untiled_rect; bool m_occluded { false }; - bool m_frameless { false }; RefPtr<Gfx::Bitmap> m_backing_store; RefPtr<Gfx::Bitmap> m_last_backing_store; int m_window_id { -1 }; diff --git a/Servers/WindowServer/WindowClient.ipc b/Servers/WindowServer/WindowClient.ipc index bd0d690b52..3c94ccf89e 100644 --- a/Servers/WindowServer/WindowClient.ipc +++ b/Servers/WindowServer/WindowClient.ipc @@ -23,7 +23,7 @@ endpoint WindowClient = 4 ClipboardContentsChanged(String content_type) =| WM_WindowRemoved(i32 wm_id, i32 client_id, i32 window_id) =| - WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, i32 window_type, String title, Gfx::Rect rect) =| + WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, bool is_frameless, i32 window_type, String title, Gfx::Rect rect) =| WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Gfx::Size icon_size) =| WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::Rect rect) =| diff --git a/Servers/WindowServer/WindowManager.cpp b/Servers/WindowServer/WindowManager.cpp index 1ef90805ad..98b9e62860 100644 --- a/Servers/WindowServer/WindowManager.cpp +++ b/Servers/WindowServer/WindowManager.cpp @@ -251,7 +251,7 @@ void WindowManager::tell_wm_listener_about_window(Window& listener, Window& wind return; if (window.is_internal()) return; - listener.client()->post_message(Messages::WindowClient::WM_WindowStateChanged(listener.window_id(), window.client_id(), window.window_id(), window.is_active(), window.is_minimized(), (i32)window.type(), window.title(), window.rect())); + listener.client()->post_message(Messages::WindowClient::WM_WindowStateChanged(listener.window_id(), window.client_id(), window.window_id(), window.is_active(), window.is_minimized(), window.is_frameless(), (i32)window.type(), window.title(), window.rect())); } void WindowManager::tell_wm_listener_about_window_rect(Window& listener, Window& window) diff --git a/Servers/WindowServer/WindowSwitcher.cpp b/Servers/WindowServer/WindowSwitcher.cpp index 24f4ab60d9..fbf53184da 100644 --- a/Servers/WindowServer/WindowSwitcher.cpp +++ b/Servers/WindowServer/WindowSwitcher.cpp @@ -223,6 +223,8 @@ void WindowSwitcher::refresh() int longest_title_width = 0; wm.for_each_window_of_type_from_front_to_back( WindowType::Normal, [&](Window& window) { + if (window.is_frameless()) + return IterationDecision::Continue; ++window_count; longest_title_width = max(longest_title_width, wm.font().width(window.title())); if (selected_window == &window) |