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

WindowServer: Make WSButton behave more like a normal button.

Previously it would just close the window on MouseDown. Now we do the normal
thing where we require a MouseUp inside the button rect before committing.
This commit is contained in:
Andreas Kling 2019-04-05 21:53:45 +02:00
parent 0d60c56b51
commit 0fc3ccaa52
6 changed files with 56 additions and 8 deletions

View file

@ -32,7 +32,7 @@ WSWindowFrame::WSWindowFrame(WSWindow& window)
if (!s_close_button_bitmap)
s_close_button_bitmap = &CharacterBitmap::create_from_ascii(s_close_button_bitmap_data, s_close_button_bitmap_width, s_close_button_bitmap_height).leak_ref();
m_buttons.append(make<WSButton>(*s_close_button_bitmap, [this] {
m_buttons.append(make<WSButton>(*this, *s_close_button_bitmap, [this] {
m_window.on_message(WSMessage(WSMessage::WindowCloseRequest));
}));
}
@ -181,6 +181,11 @@ Rect WSWindowFrame::rect() const
return frame_rect_for_window_type(m_window.type(), m_window.rect());
}
void WSWindowFrame::invalidate_title_bar()
{
WSWindowManager::the().invalidate(title_bar_rect().translated(rect().location()));
}
void WSWindowFrame::notify_window_rect_changed(const Rect& old_rect, const Rect& new_rect)
{
int window_button_width = 15;