mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-25 05:15:33 +00:00
Address PR review comments
- 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>
This commit is contained in:
co-authored by
ashaduri
parent
b574294a51
commit
a79907bd05
@@ -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()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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<int>(glade_w * (1.0 + fraction_percent / 100.0));
|
||||
size_h = static_cast<int>(glade_h * (1.0 + fraction_percent / 100.0));
|
||||
const double scale_factor = 1.0 + static_cast<double>(fraction_percent) / 100.0;
|
||||
size_w = static_cast<int>(std::lround(glade_w * scale_factor));
|
||||
size_h = static_cast<int>(std::lround(glade_h * scale_factor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ Copyright:
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Gtk {
|
||||
class Window;
|
||||
}
|
||||
|
||||
|
||||
/// Initialize the application and run the main loop
|
||||
bool app_init_and_loop(int& argc, char**& argv);
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user