mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Taskbar: Only include "Normal" windows in the taskbar window list.
This commit is contained in:
parent
82b02ed82b
commit
64a5abf8db
10 changed files with 70 additions and 16 deletions
|
@ -23,6 +23,8 @@ struct WSAPI_Rect {
|
|||
enum WSAPI_WindowType {
|
||||
Invalid = 0,
|
||||
Normal,
|
||||
Menu,
|
||||
WindowSwitcher,
|
||||
Taskbar,
|
||||
};
|
||||
|
||||
|
@ -111,6 +113,7 @@ struct WSAPI_ServerMessage {
|
|||
int window_id;
|
||||
WSAPI_Rect rect;
|
||||
bool is_active;
|
||||
WSAPI_WindowType window_type;
|
||||
} wm;
|
||||
struct {
|
||||
WSAPI_Rect rect;
|
||||
|
|
|
@ -623,22 +623,25 @@ private:
|
|||
|
||||
class WSWMWindowAddedEvent : public WSWMEvent {
|
||||
public:
|
||||
WSWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active)
|
||||
WSWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type)
|
||||
: WSWMEvent(WSMessage::WM_WindowAdded, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
, m_active(is_active)
|
||||
, m_window_type(window_type)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
bool is_active() const { return m_active; }
|
||||
WSWindowType window_type() const { return m_window_type; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
bool m_active;
|
||||
WSWindowType m_window_type;
|
||||
};
|
||||
|
||||
class WSWMWindowRemovedEvent : public WSWMEvent {
|
||||
|
@ -651,20 +654,23 @@ public:
|
|||
|
||||
class WSWMWindowStateChangedEvent : public WSWMEvent {
|
||||
public:
|
||||
WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active)
|
||||
WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type)
|
||||
: WSWMEvent(WSMessage::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
, m_active(is_active)
|
||||
, m_window_type(window_type)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
bool is_active() const { return m_active; }
|
||||
WSWindowType window_type() const { return m_window_type; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
bool m_active;
|
||||
WSWindowType m_window_type;
|
||||
};
|
||||
|
|
|
@ -254,6 +254,10 @@ static WSWindowType from_api(WSAPI_WindowType api_type)
|
|||
switch (api_type) {
|
||||
case WSAPI_WindowType::Normal:
|
||||
return WSWindowType::Normal;
|
||||
case WSAPI_WindowType::Menu:
|
||||
return WSWindowType::Menu;
|
||||
case WSAPI_WindowType::WindowSwitcher:
|
||||
return WSWindowType::WindowSwitcher;
|
||||
case WSAPI_WindowType::Taskbar:
|
||||
return WSWindowType::Taskbar;
|
||||
default:
|
||||
|
|
|
@ -94,6 +94,22 @@ void WSWindow::handle_mouse_event(const WSMouseEvent& event)
|
|||
m_client->post_message(server_message);
|
||||
}
|
||||
|
||||
static WSAPI_WindowType to_api(WSWindowType ws_type)
|
||||
{
|
||||
switch (ws_type) {
|
||||
case WSWindowType::Normal:
|
||||
return WSAPI_WindowType::Normal;
|
||||
case WSWindowType::Menu:
|
||||
return WSAPI_WindowType::Menu;
|
||||
case WSWindowType::WindowSwitcher:
|
||||
return WSAPI_WindowType::WindowSwitcher;
|
||||
case WSWindowType::Taskbar:
|
||||
return WSAPI_WindowType::Taskbar;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void WSWindow::on_message(const WSMessage& message)
|
||||
{
|
||||
if (m_internal_owner)
|
||||
|
@ -147,6 +163,7 @@ void WSWindow::on_message(const WSMessage& message)
|
|||
server_message.wm.client_id = added_event.client_id();
|
||||
server_message.wm.window_id = added_event.window_id();
|
||||
server_message.wm.is_active = added_event.is_active();
|
||||
server_message.wm.window_type = to_api(added_event.window_type());
|
||||
ASSERT(added_event.title().length() < sizeof(server_message.text));
|
||||
memcpy(server_message.text, added_event.title().characters(), added_event.title().length());
|
||||
server_message.text_length = added_event.title().length();
|
||||
|
@ -166,6 +183,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.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());
|
||||
server_message.text_length = changed_event.title().length();
|
||||
|
|
|
@ -496,14 +496,14 @@ void WSWindowManager::add_window(WSWindow& window)
|
|||
if (window.listens_to_wm_events()) {
|
||||
for_each_window([&window] (WSWindow& other_window) {
|
||||
if (&window != &other_window && other_window.client())
|
||||
WSMessageLoop::the().post_message(window, make<WSWMWindowAddedEvent>(other_window.client()->client_id(), other_window.window_id(), other_window.title(), other_window.rect(), other_window.is_active()));
|
||||
WSMessageLoop::the().post_message(window, make<WSWMWindowAddedEvent>(other_window.client()->client_id(), other_window.window_id(), other_window.title(), other_window.rect(), other_window.is_active(), other_window.type()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowAddedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active()));
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowAddedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
|
|||
{
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active()));
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue