mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +00:00
WindowServer: Generate a separate WM event for window icon changes.
This commit is contained in:
parent
c4c7f224d5
commit
c931eaa22c
12 changed files with 95 additions and 23 deletions
|
@ -31,6 +31,7 @@ public:
|
|||
WindowCloseRequest,
|
||||
WM_WindowRemoved,
|
||||
WM_WindowStateChanged,
|
||||
WM_WindowIconChanged,
|
||||
};
|
||||
|
||||
GEvent() { }
|
||||
|
@ -69,10 +70,9 @@ public:
|
|||
|
||||
class GWMWindowStateChangedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, GWindowType window_type, bool is_minimized, const String& icon_path)
|
||||
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, GWindowType window_type, bool is_minimized)
|
||||
: GWMEvent(GEvent::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_icon_path(icon_path)
|
||||
, m_rect(rect)
|
||||
, m_window_type(window_type)
|
||||
, m_active(is_active)
|
||||
|
@ -85,17 +85,29 @@ public:
|
|||
bool is_active() const { return m_active; }
|
||||
GWindowType window_type() const { return m_window_type; }
|
||||
bool is_minimized() const { return m_minimized; }
|
||||
String icon_path() const { return m_icon_path; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
String m_icon_path;
|
||||
Rect m_rect;
|
||||
GWindowType m_window_type;
|
||||
bool m_active;
|
||||
bool m_minimized;
|
||||
};
|
||||
|
||||
class GWMWindowIconChangedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowIconChangedEvent(int client_id, int window_id, const String& icon_path)
|
||||
: GWMEvent(GEvent::Type::WM_WindowIconChanged, client_id, window_id)
|
||||
, m_icon_path(icon_path)
|
||||
{
|
||||
}
|
||||
|
||||
String icon_path() const { return m_icon_path; }
|
||||
|
||||
private:
|
||||
String m_icon_path;
|
||||
};
|
||||
|
||||
class GPaintEvent final : public GEvent {
|
||||
public:
|
||||
explicit GPaintEvent(const Rect& rect, const Size& window_size = Size())
|
||||
|
|
|
@ -174,7 +174,9 @@ void GEventLoop::handle_wm_event(const WSAPI_ServerMessage& event, GWindow& wind
|
|||
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
|
||||
#endif
|
||||
if (event.type == WSAPI_ServerMessage::WM_WindowStateChanged)
|
||||
return post_event(window, make<GWMWindowStateChangedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active, (GWindowType)event.wm.window_type, event.wm.is_minimized, String(event.wm.icon_path, event.wm.icon_path_length)));
|
||||
return post_event(window, make<GWMWindowStateChangedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active, (GWindowType)event.wm.window_type, event.wm.is_minimized));
|
||||
if (event.type == WSAPI_ServerMessage::WM_WindowIconChanged)
|
||||
return post_event(window, make<GWMWindowIconChangedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length)));
|
||||
if (event.type == WSAPI_ServerMessage::WM_WindowRemoved)
|
||||
return post_event(window, make<GWMWindowRemovedEvent>(event.wm.client_id, event.wm.window_id));
|
||||
ASSERT_NOT_REACHED();
|
||||
|
@ -277,6 +279,7 @@ void GEventLoop::process_unprocessed_messages()
|
|||
break;
|
||||
case WSAPI_ServerMessage::Type::WM_WindowRemoved:
|
||||
case WSAPI_ServerMessage::Type::WM_WindowStateChanged:
|
||||
case WSAPI_ServerMessage::Type::WM_WindowIconChanged:
|
||||
handle_wm_event(event, *window);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -277,7 +277,7 @@ void GWindow::event(CEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.type() == GEvent::WM_WindowRemoved || event.type() == GEvent::WM_WindowStateChanged)
|
||||
if (event.type() == GEvent::WM_WindowRemoved || event.type() == GEvent::WM_WindowStateChanged || event.type() == GEvent::WM_WindowIconChanged)
|
||||
return wm_event(static_cast<GWMEvent&>(event));
|
||||
|
||||
CObject::event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue