[gtk+/gtk-3-10] Fix font size when gdk_x11_display_set_window_scale() is used
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-10] Fix font size when gdk_x11_display_set_window_scale() is used
- Date: Sun, 6 Apr 2014 03:43:27 +0000 (UTC)
commit f27ad4df43a20a46ba805c72d145d6cf9bd1a466
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Mar 5 15:42:38 2014 -0500
Fix font size when gdk_x11_display_set_window_scale() is used
We have a hack in the XSETTINGS code to substitute gtk-xft-dpi
with gdk-unscaled-dpi unless the screen has a fixed window scale,
in which case we just use gtk-xft-dpi.
But if the screen is changed to have a fixed window scale, then
the substituted value of gdk-unscaled-dpi will stick around until
the next (coincidental) change to XSETTINGS. To fix this, force
an immediate reread of the XSETTINGS property when
gdk_x11_display_set_window_scale() is used.
https://bugzilla.gnome.org/show_bug.cgi?id=725754
gdk/x11/gdkdisplay-x11.c | 14 +++++++++++++-
gdk/x11/xsettings-client.c | 6 ++++++
gdk/x11/xsettings-client.h | 1 +
3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index fbbd918..ae47812 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -2718,6 +2718,7 @@ gdk_x11_display_set_window_scale (GdkDisplay *display,
gint scale)
{
GdkX11Screen *x11_screen;
+ gboolean need_reread_settings = FALSE;
g_return_if_fail (GDK_IS_X11_DISPLAY (display));
@@ -2730,8 +2731,19 @@ gdk_x11_display_set_window_scale (GdkDisplay *display,
x11_screen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen);
- x11_screen->fixed_window_scale = TRUE;
+ if (!x11_screen->fixed_window_scale)
+ {
+ x11_screen->fixed_window_scale = TRUE;
+
+ /* We treat screens with a window scale set differently when
+ * reading xsettings, so we need to reread */
+ need_reread_settings = TRUE;
+ }
+
_gdk_x11_screen_set_window_scale (x11_screen, scale);
+
+ if (need_reread_settings)
+ _gdk_x11_settings_force_reread (x11_screen);
}
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index 2d1c251..f5754d9 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -581,6 +581,12 @@ _gdk_x11_xsettings_init (GdkX11Screen *x11_screen)
}
void
+_gdk_x11_settings_force_reread (GdkX11Screen *x11_screen)
+{
+ read_settings (x11_screen, TRUE);
+}
+
+void
_gdk_x11_xsettings_finish (GdkX11Screen *x11_screen)
{
gdk_window_remove_filter (gdk_screen_get_root_window (GDK_SCREEN (x11_screen)),
gdk_xsettings_root_window_filter, x11_screen);
diff --git a/gdk/x11/xsettings-client.h b/gdk/x11/xsettings-client.h
index 9ae149e..89adc7d 100644
--- a/gdk/x11/xsettings-client.h
+++ b/gdk/x11/xsettings-client.h
@@ -27,5 +27,6 @@
void _gdk_x11_xsettings_init (GdkX11Screen *x11_screen);
void _gdk_x11_xsettings_finish (GdkX11Screen *x11_screen);
+void _gdk_x11_settings_force_reread (GdkX11Screen *x11_screen);
#endif /* XSETTINGS_CLIENT_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]