From a79907bd05b6eb698cf24ced01fdeb7ff030f3b2 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Fri, 6 Mar 2026 14:38:18 +0000 Subject: [PATCH] Address PR review comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add forward declaration for Gtk::Window in gsc_init.h to fix compilation - Use std::lround() instead of truncation for proper rounding in scaling - Update include comments to reference app_apply_fractional_scaling_to_default_size() Changes: 1. Forward declare Gtk::Window namespace to avoid requiring Gtkmm headers 2. Replace truncating cast with std::lround() for accurate scaling (e.g., 850*1.25 = 1062.5 → 1063 instead of 1062) 3. Fix include comments in gsc_text_window.h and gsc_info_window.cpp Co-authored-by: ashaduri <2302268+ashaduri@users.noreply.github.com> --- src/gui/gsc_info_window.cpp | 2 +- src/gui/gsc_init.cpp | 5 +++-- src/gui/gsc_init.h | 5 +++++ src/gui/gsc_text_window.h | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/gsc_info_window.cpp b/src/gui/gsc_info_window.cpp index f9eada7..06c617b 100644 --- a/src/gui/gsc_info_window.cpp +++ b/src/gui/gsc_info_window.cpp @@ -35,7 +35,7 @@ Copyright: #include "gsc_info_window.h" #include "gsc_executor_error_dialog.h" #include "gsc_startup_settings.h" -#include "gsc_init.h" // app_get_windows_fractional_scaling_percent() +#include "gsc_init.h" // app_apply_fractional_scaling_to_default_size() diff --git a/src/gui/gsc_init.cpp b/src/gui/gsc_init.cpp index a7533f2..2f822bc 100644 --- a/src/gui/gsc_init.cpp +++ b/src/gui/gsc_init.cpp @@ -119,8 +119,9 @@ void app_apply_fractional_scaling_to_default_size(Gtk::Window* window, int confi int glade_w = 0, glade_h = 0; window->get_default_size(glade_w, glade_h); if (glade_w > 0 && glade_h > 0) { - size_w = static_cast(glade_w * (1.0 + fraction_percent / 100.0)); - size_h = static_cast(glade_h * (1.0 + fraction_percent / 100.0)); + const double scale_factor = 1.0 + static_cast(fraction_percent) / 100.0; + size_w = static_cast(std::lround(glade_w * scale_factor)); + size_h = static_cast(std::lround(glade_h * scale_factor)); } } diff --git a/src/gui/gsc_init.h b/src/gui/gsc_init.h index 2b9e0b5..585aa5b 100644 --- a/src/gui/gsc_init.h +++ b/src/gui/gsc_init.h @@ -15,6 +15,11 @@ Copyright: #include +namespace Gtk { + class Window; +} + + /// Initialize the application and run the main loop bool app_init_and_loop(int& argc, char**& argv); diff --git a/src/gui/gsc_text_window.h b/src/gui/gsc_text_window.h index 6fde22f..f45cfa2 100644 --- a/src/gui/gsc_text_window.h +++ b/src/gui/gsc_text_window.h @@ -24,7 +24,7 @@ Copyright: #include "applib/app_builder_widget.h" #include "applib/app_gtkmm_tools.h" -#include "gsc_init.h" // app_get_windows_fractional_scaling_percent() +#include "gsc_init.h" // app_apply_fractional_scaling_to_default_size()