diff options
| author | Adel Gadllah <adel.gadllah@gmail.com> | 2014-03-13 12:56:02 (GMT) |
|---|---|---|
| committer | Adel Gadllah <adel.gadllah@gmail.com> | 2014-03-13 13:16:11 (GMT) |
| commit | 5616bbd45b13ec9b76619c2a594cdc9a930edca1 (patch) | |
| tree | d23107b57c6d1ba8a990967bbdab5a7022e69c30 | |
| parent | e117aa5297849dae113c4f01d23cd6d64054d083 (diff) | |
| download | gnome-shell-5616bbd45b13ec9b76619c2a594cdc9a930edca1.zip gnome-shell-5616bbd45b13ec9b76619c2a594cdc9a930edca1.tar.xz | |
hidpi: Listen for gtk-xft-dpi instead of monitors-changed
Currently we update the scale factor on startup and when we get a
monitors-changed signal, which is not the only cases where the setting changes. We cannot listen for gdk-window-scaling-factor changes because it is not
exported to gdk.
So use gtk-xft-dpi which also indicates a scale factor change.
When someone changes gtk-xft-dpi directly without changing the scale factor
we will just re-read the gdk-window-scaling-factor so no harm is done.
https://bugzilla.gnome.org/show_bug.cgi?id=726238
| -rw-r--r-- | src/shell-global.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/shell-global.c b/src/shell-global.c index d44d552..e055548 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -748,7 +748,9 @@ global_stage_after_paint (gpointer data) static void -update_scale_factor (GdkScreen *screen, gpointer data) +update_scale_factor (GtkSettings *settings, + GParamSpec *pspec, + gpointer data) { ShellGlobal *global = SHELL_GLOBAL (data); ClutterStage *stage = CLUTTER_STAGE (global->stage); @@ -938,19 +940,18 @@ _shell_global_set_plugin (ShellGlobal *global, g_signal_connect (global->meta_display, "notify::focus-window", G_CALLBACK (focus_window_changed), global); - /* - * We connect to GdkScreen's monitors-changed here to avoid - * a race condition. GdkScreen's monitors-changed signal is - * emitted *after* the xsetting has been updated. + /* gdk-window-scaling-factor is not exported to gtk-settings + * because it is handled inside gdk, so we use gtk-xft-dpi instead + * which also changes when the scale factor changes. */ - g_signal_connect (global->gdk_screen, "monitors-changed", + g_signal_connect (gtk_settings_get_default (), "notify::gtk-xft-dpi", G_CALLBACK (update_scale_factor), global); gdk_event_handler_set (gnome_shell_gdk_event_handler, global, NULL); global->focus_manager = st_focus_manager_get_for_stage (global->stage); - update_scale_factor (global->gdk_screen, global); + update_scale_factor (gtk_settings_get_default (), NULL, global); } GjsContext * |
