summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorDawid Wolosowicz <d@1823.pl>2021-09-01 19:11:33 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-01 23:04:10 +0200
commit977b62a2131a8f2edccd9470f5d9a90f1abe9a82 (patch)
tree7db33aa1fa9d8f54c866865301daf7c7ef507be2 /Userland
parent51ae913bfe3ee42c7da949b32f313a79e9c9f143 (diff)
downloadserenity-977b62a2131a8f2edccd9470f5d9a90f1abe9a82.zip
3DFileViewer: Maintain the FPS counter's position
Without this, any resize of the GLContextWidget might leave the label somewhere it shouldn't be. Toggling fullscreen is a single example of that behavior.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/3DFileViewer/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp
index 870381c97d..a3bae3e2d4 100644
--- a/Userland/Applications/3DFileViewer/main.cpp
+++ b/Userland/Applications/3DFileViewer/main.cpp
@@ -80,6 +80,7 @@ private:
}
virtual void paint_event(GUI::PaintEvent&) override;
+ virtual void resize_event(GUI::ResizeEvent&) override;
virtual void timer_event(Core::TimerEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
virtual void mousewheel_event(GUI::MouseEvent&) override;
@@ -118,6 +119,14 @@ void GLContextWidget::paint_event(GUI::PaintEvent& event)
painter.draw_scaled_bitmap(frame_inner_rect(), *m_bitmap, m_bitmap->rect());
}
+void GLContextWidget::resize_event(GUI::ResizeEvent& event)
+{
+ GUI::Frame::resize_event(event);
+
+ if (m_stats)
+ m_stats->set_x(width() - m_stats->width());
+};
+
void GLContextWidget::mousemove_event(GUI::MouseEvent& event)
{
if (event.buttons() == GUI::MouseButton::Left) {
@@ -259,7 +268,7 @@ int main(int argc, char** argv)
time.set_visible(false);
time.set_foreground_role(ColorRole::HoverHighlight);
time.set_relative_rect({ 0, 8, 86, 10 });
- time.move_by({ window->width() - time.width(), 0 });
+ time.set_x(widget.width() - time.width());
widget.set_stat_label(time);
auto& file_menu = window->add_menu("&File");