mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:45:09 +00:00
WindowServer+LibGUI+Taskbar: Don't include frameless windows in lists
Frameless windows don't need to show up in the taskbar or the switcher.
This commit is contained in:
parent
c9321b4f00
commit
3331098aee
9 changed files with 17 additions and 13 deletions
|
@ -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());
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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) =|
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue