mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:17:45 +00:00
WindowServer: Support resizing windows.
This is pretty limited and not entirely stable, but it does work! :^)
This commit is contained in:
parent
a9911fca80
commit
59b8183c4b
11 changed files with 112 additions and 13 deletions
|
@ -121,6 +121,11 @@ void GEventLoop::handle_paint_event(const WSAPI_ServerMessage& event, GWindow& w
|
|||
post_event(&window, make<GPaintEvent>(event.paint.rect));
|
||||
}
|
||||
|
||||
void GEventLoop::handle_resize_event(const WSAPI_ServerMessage& event, GWindow& window)
|
||||
{
|
||||
post_event(&window, make<GResizeEvent>(event.window.old_rect.size, event.window.rect.size));
|
||||
}
|
||||
|
||||
void GEventLoop::handle_window_activation_event(const WSAPI_ServerMessage& event, GWindow& window)
|
||||
{
|
||||
#ifdef GEVENTLOOP_DEBUG
|
||||
|
@ -303,6 +308,9 @@ void GEventLoop::wait_for_event()
|
|||
case WSAPI_ServerMessage::Type::WindowLeft:
|
||||
handle_window_entered_or_left_event(event, *window);
|
||||
break;
|
||||
case WSAPI_ServerMessage::Type::WindowResized:
|
||||
handle_resize_event(event, *window);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ private:
|
|||
void wait_for_event();
|
||||
bool drain_messages_from_server();
|
||||
void handle_paint_event(const WSAPI_ServerMessage&, GWindow&);
|
||||
void handle_resize_event(const WSAPI_ServerMessage&, GWindow&);
|
||||
void handle_mouse_event(const WSAPI_ServerMessage&, GWindow&);
|
||||
void handle_key_event(const WSAPI_ServerMessage&, GWindow&);
|
||||
void handle_window_activation_event(const WSAPI_ServerMessage&, GWindow&);
|
||||
|
|
|
@ -209,6 +209,13 @@ void GWindow::event(GEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.type() == GEvent::Resize) {
|
||||
m_pending_paint_event_rects.clear();
|
||||
m_rect_when_windowless = { { }, static_cast<GResizeEvent&>(event).size() };
|
||||
m_main_widget->set_relative_rect({ { }, static_cast<GResizeEvent&>(event).size() });
|
||||
return;
|
||||
}
|
||||
|
||||
GObject::event(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue