1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibGUI+WindowServer: Add support for GWidget tooltips.

Any GWidget can have a tooltip and it will automatically pop up below the
center of the widget when hovered. GActions added to GToolBars will use
the action text() as their tooltip automagically. :^)
This commit is contained in:
Andreas Kling 2019-04-08 18:58:44 +02:00
parent 3e175c9a96
commit 7f2eeb0b35
15 changed files with 136 additions and 27 deletions

View file

@ -83,7 +83,11 @@ void GWindow::hide()
WSAPI_ClientMessage request;
request.type = WSAPI_ClientMessage::Type::DestroyWindow;
request.window_id = m_window_id;
GEventLoop::current().post_message_to_server(request);
GEventLoop::current().sync_request(request, WSAPI_ServerMessage::Type::DidDestroyWindow);
m_window_id = 0;
m_pending_paint_event_rects.clear();
m_back_bitmap = nullptr;
m_front_bitmap = nullptr;
}
void GWindow::set_title(const String& title)
@ -139,6 +143,8 @@ void GWindow::set_rect(const Rect& a_rect)
request.window_id = m_window_id;
request.window.rect = a_rect;
GEventLoop::current().post_message_to_server(request);
if (m_main_widget)
m_main_widget->resize(a_rect.size());
}
void GWindow::set_window_type(GWindowType window_type)
@ -193,6 +199,8 @@ void GWindow::event(GEvent& event)
}
if (event.is_paint_event()) {
if (!m_window_id)
return;
m_pending_paint_event_rects.clear();
if (!m_main_widget)
return;