mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
Taskbar: Show minimized window titles in [brackets].
Had to plumb the minimization state from WindowServer to Toolbar in order to implement this.
This commit is contained in:
parent
74142d78c1
commit
ef9fbef4c6
9 changed files with 35 additions and 7 deletions
|
@ -112,6 +112,7 @@ struct WSAPI_ServerMessage {
|
|||
int window_id;
|
||||
WSAPI_Rect rect;
|
||||
bool is_active;
|
||||
bool is_minimized;
|
||||
WSAPI_WindowType window_type;
|
||||
} wm;
|
||||
struct {
|
||||
|
|
|
@ -632,12 +632,13 @@ public:
|
|||
|
||||
class WSWMWindowStateChangedEvent : public WSWMEvent {
|
||||
public:
|
||||
WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type)
|
||||
WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type, bool is_minimized)
|
||||
: WSWMEvent(WSMessage::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
, m_active(is_active)
|
||||
, m_window_type(window_type)
|
||||
, m_minimized(is_minimized)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -645,10 +646,12 @@ public:
|
|||
Rect rect() const { return m_rect; }
|
||||
bool is_active() const { return m_active; }
|
||||
WSWindowType window_type() const { return m_window_type; }
|
||||
bool is_minimized() const { return m_minimized; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
bool m_active;
|
||||
WSWindowType m_window_type;
|
||||
bool m_minimized;
|
||||
};
|
||||
|
|
|
@ -118,6 +118,7 @@ void WSWindow::set_minimized(bool minimized)
|
|||
return;
|
||||
m_minimized = minimized;
|
||||
invalidate();
|
||||
WSWindowManager::the().notify_minimization_state_changed(*this);
|
||||
}
|
||||
|
||||
void WSWindow::on_message(const WSMessage& message)
|
||||
|
@ -180,6 +181,7 @@ void WSWindow::on_message(const WSMessage& message)
|
|||
server_message.wm.client_id = changed_event.client_id();
|
||||
server_message.wm.window_id = changed_event.window_id();
|
||||
server_message.wm.is_active = changed_event.is_active();
|
||||
server_message.wm.is_minimized = changed_event.is_minimized();
|
||||
server_message.wm.window_type = to_api(changed_event.window_type());
|
||||
ASSERT(changed_event.title().length() < sizeof(server_message.text));
|
||||
memcpy(server_message.text, changed_event.title().characters(), changed_event.title().length());
|
||||
|
|
|
@ -362,7 +362,7 @@ void WSWindowManager::remove_window(WSWindow& window)
|
|||
void WSWindowManager::tell_wm_listener_about_window(WSWindow& listener, WSWindow& window)
|
||||
{
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type(), window.is_minimized()));
|
||||
}
|
||||
|
||||
void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
|
||||
|
@ -395,6 +395,11 @@ void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect
|
|||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WSWindowManager::notify_minimization_state_changed(WSWindow& window)
|
||||
{
|
||||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event)
|
||||
{
|
||||
bool is_hover_with_any_menu_open = event.type() == WSMouseEvent::MouseMove && m_current_menu;
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
void notify_title_changed(WSWindow&);
|
||||
void notify_rect_changed(WSWindow&, const Rect& oldRect, const Rect& newRect);
|
||||
void notify_minimization_state_changed(WSWindow&);
|
||||
void notify_client_changed_app_menubar(WSClientConnection&);
|
||||
|
||||
WSWindow* active_window() { return m_active_window.ptr(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue