Skip to content

Commit c322192

Browse files
committed
meta-gpu-xrandr: Account for the current user text scale factor
when calculating the crtc scale based on Xft.dpi. - cinnamon-settings-daemon retrieves the global scale from muffin, and the text scale from gsettings, calculates the dpi and sets it on the server. - muffin retrieves the dpi from the server and calculates the global scale from that *rounding to the nearest integer*. A text factor of >= 1.5 causes a higher global scale to be assumed each time muffin restarts. Muffin triggers a dbus signal, and cinnamon- settings-daemon does its thing over again. ref: linuxmint/mint21.1-beta#43
1 parent 6f6f219 commit c322192

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Diff for: src/backends/meta-settings-private.h

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ void meta_settings_update_ui_scaling_factor (MetaSettings *settings);
5858
gboolean meta_settings_get_global_scaling_factor (MetaSettings *settings,
5959
int *scaing_factor);
6060

61+
double meta_settings_get_font_scaling_factor (MetaSettings *settings);
62+
6163
META_EXPORT_TEST
6264
gboolean meta_settings_is_experimental_feature_enabled (MetaSettings *settings,
6365
MetaExperimentalFeature feature);

Diff for: src/backends/meta-settings.c

+6
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ meta_settings_update_font_dpi (MetaSettings *settings)
223223
g_signal_emit (settings, signals[FONT_DPI_CHANGED], 0);
224224
}
225225

226+
double
227+
meta_settings_get_font_scaling_factor(MetaSettings *settings)
228+
{
229+
return g_settings_get_double (settings->interface_settings, "text-scaling-factor");
230+
}
231+
226232
int
227233
meta_settings_get_font_dpi (MetaSettings *settings)
228234
{

Diff for: src/backends/x11/meta-gpu-xrandr.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ static int
9898
get_current_dpi_scale (MetaMonitorManagerXrandr *manager_xrandr,
9999
MetaGpuXrandr *gpu_xrandr)
100100
{
101+
MetaMonitorManager *monitor_manager = META_MONITOR_MANAGER (manager_xrandr);
102+
MetaBackend *backend = meta_monitor_manager_get_backend (monitor_manager);
103+
MetaSettings *settings = meta_backend_get_settings (backend);
104+
101105
Atom actual;
102106
int result, format;
103107
unsigned long n, left;
@@ -109,10 +113,6 @@ get_current_dpi_scale (MetaMonitorManagerXrandr *manager_xrandr,
109113
if (gpu_xrandr->resources->timestamp ==
110114
meta_monitor_manager_xrandr_get_config_timestamp (manager_xrandr))
111115
{
112-
MetaMonitorManager *monitor_manager = META_MONITOR_MANAGER (manager_xrandr);
113-
MetaBackend *backend = meta_monitor_manager_get_backend (monitor_manager);
114-
MetaSettings *settings = meta_backend_get_settings (backend);
115-
116116
return meta_settings_get_ui_scaling_factor (settings);
117117
}
118118

@@ -139,7 +139,10 @@ get_current_dpi_scale (MetaMonitorManagerXrandr *manager_xrandr,
139139
dpi = g_ascii_strtoull (res[1], NULL, 10);
140140

141141
if (dpi > 0 && dpi < 96 * 10)
142-
return MAX (1, roundf ((float) dpi / 96.0f));
142+
{
143+
double factor = meta_settings_get_font_scaling_factor (settings);
144+
return MAX (1, roundf ((float) dpi / 96.0f / factor));
145+
}
143146
}
144147
}
145148
}

0 commit comments

Comments
 (0)