mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
WindowServer: Add message to notify clients of applet area resize
Applets and windows would like to be able to know when the applet area has been resized. For example, this happens asynchronously after an applet has been resized, so we cannot then rely on the applet area position synchronously after resizing. This adds a new message applet_area_rect_changed and associated Event AppletAreaRectChange, and the appropriate virtual functions.
This commit is contained in:
parent
1179d5d921
commit
9df79a77da
10 changed files with 62 additions and 0 deletions
|
@ -550,6 +550,22 @@ void Window::handle_screen_rects_change_event(ScreenRectsChangeEvent& event)
|
|||
screen_rects_change_event(event);
|
||||
}
|
||||
|
||||
void Window::handle_applet_area_rect_change_event(AppletAreaRectChangeEvent& event)
|
||||
{
|
||||
if (!m_main_widget)
|
||||
return;
|
||||
auto dispatch_applet_area_rect_change = [&](auto& widget, auto recursive) {
|
||||
widget.dispatch_event(event, this);
|
||||
widget.for_each_child_widget([&](auto& widget) -> IterationDecision {
|
||||
widget.dispatch_event(event, this);
|
||||
recursive(widget, recursive);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
};
|
||||
dispatch_applet_area_rect_change(*m_main_widget.ptr(), dispatch_applet_area_rect_change);
|
||||
applet_area_rect_change_event(event);
|
||||
}
|
||||
|
||||
void Window::handle_drag_move_event(DragEvent& event)
|
||||
{
|
||||
if (!m_main_widget)
|
||||
|
@ -640,6 +656,9 @@ void Window::event(Core::Event& event)
|
|||
if (event.type() == Event::ScreenRectsChange)
|
||||
return handle_screen_rects_change_event(static_cast<ScreenRectsChangeEvent&>(event));
|
||||
|
||||
if (event.type() == Event::AppletAreaRectChange)
|
||||
return handle_applet_area_rect_change_event(static_cast<AppletAreaRectChangeEvent&>(event));
|
||||
|
||||
Core::Object::event(event);
|
||||
}
|
||||
|
||||
|
@ -878,6 +897,10 @@ void Window::screen_rects_change_event(ScreenRectsChangeEvent&)
|
|||
{
|
||||
}
|
||||
|
||||
void Window::applet_area_rect_change_event(AppletAreaRectChangeEvent&)
|
||||
{
|
||||
}
|
||||
|
||||
void Window::set_icon(const Gfx::Bitmap* icon)
|
||||
{
|
||||
if (m_icon == icon)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue