diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-09 17:17:30 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-09 17:17:30 +0200 |
commit | 1ab99903af910d9615f78d967365104aa5397c73 (patch) | |
tree | 2e08bb1606614158bce1588b87202481a1299c19 /Servers | |
parent | 4c0f586f2b598349035ea3fd706e1726ddfa87c6 (diff) | |
download | serenity-1ab99903af910d9615f78d967365104aa5397c73.zip |
WindowServer: Display the window geometry while it's being moved or resized.
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSWindowManager.cpp | 13 | ||||
-rw-r--r-- | Servers/WindowServer/WSWindowManager.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index f34bd7f0c1..c39fd58ca3 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -722,6 +722,7 @@ void WSWindowManager::clear_resize_candidate() void WSWindowManager::compose() { auto dirty_rects = move(m_dirty_rects); + dirty_rects.add(Rect::intersection(m_last_geometry_label_rect, m_screen_rect)); dirty_rects.add(Rect::intersection(m_last_cursor_rect, m_screen_rect)); dirty_rects.add(Rect::intersection(current_cursor_rect(), m_screen_rect)); #ifdef DEBUG_COUNTERS @@ -820,6 +821,18 @@ void WSWindowManager::compose() return IterationDecision::Continue; }); + if (auto* window_being_moved_or_resized = m_drag_window ? m_drag_window.ptr() : (m_resize_window ? m_resize_window.ptr() : nullptr)) { + auto geometry_string = window_being_moved_or_resized->rect().to_string(); + auto geometry_label_rect = Rect { 0, 0, font().width(geometry_string) + 16, font().glyph_height() + 10 }; + geometry_label_rect.center_within(window_being_moved_or_resized->rect()); + m_back_painter->fill_rect(geometry_label_rect, Color::LightGray); + m_back_painter->draw_rect(geometry_label_rect, Color::DarkGray); + m_back_painter->draw_text(geometry_label_rect, geometry_string, TextAlignment::Center); + m_last_geometry_label_rect = geometry_label_rect; + } else { + m_last_geometry_label_rect = { }; + } + draw_menubar(); draw_cursor(); diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h index 9ad5058107..ef246537f4 100644 --- a/Servers/WindowServer/WSWindowManager.h +++ b/Servers/WindowServer/WSWindowManager.h @@ -172,6 +172,7 @@ private: ResizeDirection m_resize_direction { ResizeDirection::None }; Rect m_last_cursor_rect; + Rect m_last_geometry_label_rect; unsigned m_compose_count { 0 }; unsigned m_flush_count { 0 }; |