I want to change the scale of the app. I found that the setting in GTK Inspector Global
> Settings
> Font
> Scale
is the perfect setting for me.
According to the source code (gtk/gtk/inspector/visual.c at 15edfe4ffa7a800ab67717e6a6be81d0b37c1813 · GNOME/gtk · GitHub), this is the line that I want, but in C:
g_object_set (vis->settings, "gtk-xft-dpi", (int)(factor * get_dpi_ratio (vis)), NULL);
Where the 3rd argument basically is a const.
vis->settings
is defined here gtk/inspector/visual.c
void
gtk_inspector_visual_set_display (GtkInspectorVisual *vis,
GdkDisplay *display)
{
vis->display = display;
vis->settings = gtk_settings_get_for_display (display);
And the gtk_settings_get_for_display()
functions is defined in gtk/gtk/gtksettings.c
.
I found bindings for the g_object_set()
function in the source and I tried things like
let new_dpi: f64 = 2. * (96.0 * 1024.0);
gtk_app.set_properties(&[("gtk-xft-dpi", &new_dpi)]);
(Panics with Can't find property 'gtk-xft-dpi' for type 'GtkApplication'
)
And I tried other things too with no success. I see there are a struct Settings
, as well as Display
in gtk4
, but I don’t know how to access them. I guess they probably are defined in some private structure inside GTK::Application
or something like that.
For instance, the gtk4::Settings
has the gtk-xft-dpi
property, but I can’t figure out how to access the current settings or setup a new one.
I’m using both gtk4-rs
(in one of the attempts) and relm4 (with my second attempt to port the Python code).