diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-06-21 11:03:43 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-21 11:03:43 +0200 |
commit | 2e9cc75d11dba67498b82fab31323688b1f5ccc5 (patch) | |
tree | 26986773a191202be3bf89194c3b4de12417d101 /Servers/WindowServer/WSWindowFrame.cpp | |
parent | da475ce3f58e625b43448bc79a97d413b87eb684 (diff) | |
download | serenity-2e9cc75d11dba67498b82fab31323688b1f5ccc5.zip |
WindowServer+Taskbar: Let WindowServer manage the "window menus".
Taskbar now simply asks the WindowServer to popup a window menu when right
clicking on a taskbar button.
This patch also implements the "close" menu item, and furthermore makes the
window menu show up when you left-click a window's titlebar icon. :^)
Diffstat (limited to 'Servers/WindowServer/WSWindowFrame.cpp')
-rw-r--r-- | Servers/WindowServer/WSWindowFrame.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Servers/WindowServer/WSWindowFrame.cpp b/Servers/WindowServer/WSWindowFrame.cpp index da3ea26715..c4ee2cca5c 100644 --- a/Servers/WindowServer/WSWindowFrame.cpp +++ b/Servers/WindowServer/WSWindowFrame.cpp @@ -91,8 +91,7 @@ WSWindowFrame::WSWindowFrame(WSWindow& window) s_unmaximize_button_bitmap = &CharacterBitmap::create_from_ascii(s_unmaximize_button_bitmap_data, s_unmaximize_button_bitmap_width, s_unmaximize_button_bitmap_height).leak_ref(); m_buttons.append(make<WSButton>(*this, *s_close_button_bitmap, [this](auto&) { - WSEvent close_request(WSEvent::WindowCloseRequest); - m_window.event(close_request); + m_window.request_close(); })); if (window.is_resizable()) { @@ -271,6 +270,11 @@ void WSWindowFrame::on_mouse_event(const WSMouseEvent& event) if (m_window.type() != WSWindowType::Normal) return; + if (event.type() == WSEvent::MouseDown && event.button() == MouseButton::Left && title_bar_icon_rect().contains(event.position())) { + m_window.popup_window_menu(event.position().translated(rect().location())); + return; + } + // This is slightly hackish, but expand the title bar rect by one pixel downwards, // so that mouse events between the title bar and window contents don't act like // mouse events on the border. |