summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAziz Berkay Yesilyurt <abyesilyurt@gmail.com>2021-07-09 00:57:42 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-09 10:22:26 +0200
commitdd476c35cbd9155931aaff61249559a79c3c40cf (patch)
tree68da57577cced996c742591f7d00ba0838fa53b7 /Userland
parent36c8b1c58cae3f7d41fbd83909e5e626ef501d90 (diff)
downloadserenity-dd476c35cbd9155931aaff61249559a79c3c40cf.zip
ImageViewer: Don't resize the window after the first image is displayed
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/ImageViewer/ViewWidget.h3
-rw-r--r--Userland/Applications/ImageViewer/main.cpp3
2 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.h b/Userland/Applications/ImageViewer/ViewWidget.h
index 9bc093a89f..97d2da81ce 100644
--- a/Userland/Applications/ImageViewer/ViewWidget.h
+++ b/Userland/Applications/ImageViewer/ViewWidget.h
@@ -32,6 +32,8 @@ public:
int scale() { return m_scale; }
void set_toolbar_height(int height) { m_toolbar_height = height; }
int toolbar_height() { return m_toolbar_height; }
+ bool scaled_for_first_image() { return m_scaled_for_first_image; }
+ void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
void clear();
void flip(Gfx::Orientation);
@@ -73,6 +75,7 @@ private:
int m_scale { -1 };
int m_toolbar_height { 28 };
+ bool m_scaled_for_first_image { false };
Gfx::FloatPoint m_pan_origin;
Gfx::IntPoint m_click_position;
Gfx::FloatPoint m_saved_pan_origin;
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index d05f8284b4..9633e2a6e0 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -92,7 +92,8 @@ int main(int argc, char** argv)
if (window->is_maximized())
return;
- if (scale == 100) {
+ if (scale == 100 && !widget.scaled_for_first_image()) {
+ widget.set_scaled_for_first_image(true);
auto w = min(GUI::Desktop::the().rect().width(), rect.width() + 4);
auto h = min(GUI::Desktop::the().rect().height(), rect.height() + widget.toolbar_height() + 6);
window->resize(w, h);