diff options
Diffstat (limited to 'Userland/Applications/Magnifier/MagnifierWidget.cpp')
-rw-r--r-- | Userland/Applications/Magnifier/MagnifierWidget.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Userland/Applications/Magnifier/MagnifierWidget.cpp b/Userland/Applications/Magnifier/MagnifierWidget.cpp index 3595ece21e..9148cecfff 100644 --- a/Userland/Applications/Magnifier/MagnifierWidget.cpp +++ b/Userland/Applications/Magnifier/MagnifierWidget.cpp @@ -24,6 +24,14 @@ void MagnifierWidget::set_scale_factor(int scale_factor) update(); } +void MagnifierWidget::lock_location(bool lock) +{ + if (lock) + m_locked_location = GUI::ConnectionToWindowServer::the().get_global_cursor_position(); + else + m_locked_location = {}; +} + void MagnifierWidget::set_color_filter(OwnPtr<Gfx::ColorBlindnessFilter> color_filter) { m_color_filter = move(color_filter); @@ -53,7 +61,12 @@ void MagnifierWidget::sync() auto size = frame_inner_rect().size(); Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor }; - m_grabbed_bitmap = GUI::ConnectionToWindowServer::the().get_screen_bitmap_around_cursor(grab_size).bitmap(); + + if (m_locked_location.has_value()) { + m_grabbed_bitmap = GUI::ConnectionToWindowServer::the().get_screen_bitmap_around_location(grab_size, m_locked_location.value()).bitmap(); + } else { + m_grabbed_bitmap = GUI::ConnectionToWindowServer::the().get_screen_bitmap_around_cursor(grab_size).bitmap(); + } m_grabbed_bitmaps.enqueue(m_grabbed_bitmap); update(); } |