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
This commit is contained in:
Owen W. Taylor
2014-03-05 15:42:38 -05:00
committed by Matthias Clasen
parent 43b0eee81d
commit 99ac2f5c49
3 changed files with 20 additions and 1 deletions

View File

@ -2697,6 +2697,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));
@ -2709,8 +2710,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);
}

View File

@ -581,6 +581,12 @@ _gdk_x11_xsettings_init (GdkX11Screen *x11_screen)
check_manager_window (x11_screen, FALSE);
}
void
_gdk_x11_settings_force_reread (GdkX11Screen *x11_screen)
{
read_settings (x11_screen, TRUE);
}
void
_gdk_x11_xsettings_finish (GdkX11Screen *x11_screen)
{

View File

@ -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 */