diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-04 22:33:28 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-04 23:15:16 +0200 |
commit | 3e63633e1c5160539fd4c18c9de216dbcfbe8147 (patch) | |
tree | df8564f688a20a3e8d202c562280e00e5610ced8 /Userland/Applications/Magnifier | |
parent | 782a5c88ce895da644444c98be88e03e84526bbf (diff) | |
download | serenity-3e63633e1c5160539fd4c18c9de216dbcfbe8147.zip |
Magnifier: Make the main widget a GUI::Frame
This makes the magnifier window look slightly nicer. :^)
Diffstat (limited to 'Userland/Applications/Magnifier')
-rw-r--r-- | Userland/Applications/Magnifier/MagnifierWidget.cpp | 9 | ||||
-rw-r--r-- | Userland/Applications/Magnifier/MagnifierWidget.h | 10 |
2 files changed, 11 insertions, 8 deletions
diff --git a/Userland/Applications/Magnifier/MagnifierWidget.cpp b/Userland/Applications/Magnifier/MagnifierWidget.cpp index 8c17a917e3..c4d949a6ee 100644 --- a/Userland/Applications/Magnifier/MagnifierWidget.cpp +++ b/Userland/Applications/Magnifier/MagnifierWidget.cpp @@ -39,15 +39,18 @@ void MagnifierWidget::set_scale_factor(int scale_factor) void MagnifierWidget::sync() { - Gfx::IntSize grab_size { size().width() / m_scale_factor, size().height() / m_scale_factor }; + auto size = frame_inner_rect().size(); + Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor }; m_grabbed_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap_around_cursor(grab_size).bitmap(); update(); } -void MagnifierWidget::paint_event(GUI::PaintEvent&) +void MagnifierWidget::paint_event(GUI::PaintEvent& event) { + GUI::Frame::paint_event(event); + GUI::Painter painter(*this); if (m_grabbed_bitmap) - painter.draw_scaled_bitmap(rect(), *m_grabbed_bitmap, m_grabbed_bitmap->rect()); + painter.draw_scaled_bitmap(frame_inner_rect(), *m_grabbed_bitmap, m_grabbed_bitmap->rect()); } diff --git a/Userland/Applications/Magnifier/MagnifierWidget.h b/Userland/Applications/Magnifier/MagnifierWidget.h index 228667c082..a7df2c653c 100644 --- a/Userland/Applications/Magnifier/MagnifierWidget.h +++ b/Userland/Applications/Magnifier/MagnifierWidget.h @@ -6,19 +6,19 @@ #pragma once -#include <LibGUI/Widget.h> -#include <LibGfx/Point.h> +#include <LibGUI/Frame.h> -class MagnifierWidget final : public GUI::Widget { - C_OBJECT(MagnifierWidget) +class MagnifierWidget final : public GUI::Frame { + C_OBJECT(MagnifierWidget); public: - MagnifierWidget(); virtual ~MagnifierWidget(); void set_scale_factor(int scale_factor); void track_cursor_globally(); private: + MagnifierWidget(); + virtual void paint_event(GUI::PaintEvent&) override; void sync(); |