summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-20 14:40:38 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-20 14:40:59 +0200
commit49e7ffc06a51632fc6210660d7765f2dfbe408d7 (patch)
treed7ec639f172d1ef6eac05a301985e950764744a6 /LibGUI
parentab94a6be00ecd48575653e5d0ab3b2f21d131836 (diff)
downloadserenity-49e7ffc06a51632fc6210660d7765f2dfbe408d7.zip
WindowServer: Introduce a WM event mask so Taskbar can ignore window rects.
Taskbar was waking up to do nothing every time a window rect changed.
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GEvent.h18
-rw-r--r--LibGUI/GEventLoop.cpp2
-rw-r--r--LibGUI/GWindow.cpp2
3 files changed, 21 insertions, 1 deletions
diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h
index ecbe51ead3..25636afbef 100644
--- a/LibGUI/GEvent.h
+++ b/LibGUI/GEvent.h
@@ -30,9 +30,13 @@ public:
FocusOut,
WindowCloseRequest,
ContextMenu,
+
+ __Begin_WM_Events,
WM_WindowRemoved,
WM_WindowStateChanged,
+ WM_WindowRectChanged,
WM_WindowIconChanged,
+ __End_WM_Events,
};
GEvent() { }
@@ -95,6 +99,20 @@ private:
bool m_minimized;
};
+class GWMWindowRectChangedEvent : public GWMEvent {
+public:
+ GWMWindowRectChangedEvent(int client_id, int window_id, const Rect& rect)
+ : GWMEvent(GEvent::Type::WM_WindowRectChanged, client_id, window_id)
+ , m_rect(rect)
+ {
+ }
+
+ Rect rect() const { return m_rect; }
+
+private:
+ Rect m_rect;
+};
+
class GWMWindowIconChangedEvent : public GWMEvent {
public:
GWMWindowIconChangedEvent(int client_id, int window_id, const String& icon_path)
diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp
index b14c621e91..809943a738 100644
--- a/LibGUI/GEventLoop.cpp
+++ b/LibGUI/GEventLoop.cpp
@@ -175,6 +175,8 @@ void GEventLoop::handle_wm_event(const WSAPI_ServerMessage& event, GWindow& wind
#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));
+ if (event.type == WSAPI_ServerMessage::WM_WindowRectChanged)
+ return post_event(window, make<GWMWindowRectChangedEvent>(event.wm.client_id, event.wm.window_id, event.wm.rect));
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)
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index de38f0ffcc..505338f7d6 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -277,7 +277,7 @@ void GWindow::event(CEvent& event)
return;
}
- if (event.type() == GEvent::WM_WindowRemoved || event.type() == GEvent::WM_WindowStateChanged || event.type() == GEvent::WM_WindowIconChanged)
+ if (event.type() > GEvent::__Begin_WM_Events && event.type() < GEvent::__End_WM_Events)
return wm_event(static_cast<GWMEvent&>(event));
CObject::event(event);