summaryrefslogtreecommitdiff
path: root/gdk/gdkscreen.c
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2014-07-11 16:42:38 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-07-13 15:35:23 -0400
commitfc6e2cc4b27403707bf2a9f4717442842914e626 (patch)
tree5d911997ef8c1ba99f257ab43198ec8fc4bc9ddc /gdk/gdkscreen.c
parentcef6f34fb7585fc423ec999822d515d6da0e6d6f (diff)
downloadgtk+-fc6e2cc4b27403707bf2a9f4717442842914e626.tar.gz
Handle resolution changes in the GDK backend code
gdk_x11_display_set_window_scale() affects the interpretation of the Xft/DPI XSETTING - it is substituted inside GDK with the value of Gdk/UnscaledDPI xsetting. However, this change is not propagated to GTK+ and from GTK+ back to gdk_screen_set_resolution() until the main loop is run. Fix this by handling the screen resolution directly in gdk/x11. This requires duplication of code between GDK and GTK+ since we still have to handle DPI in GTK+ in the case that GdkSettings:gtk-xft-dpi is set by the application. https://bugzilla.gnome.org/show_bug.cgi?id=733076
Diffstat (limited to 'gdk/gdkscreen.c')
-rw-r--r--gdk/gdkscreen.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index e2cbfb7d0d..cc170c5b4b 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -462,6 +462,31 @@ gdk_screen_set_resolution (GdkScreen *screen,
if (dpi < 0)
dpi = -1.0;
+ screen->resolution_set = TRUE;
+
+ if (screen->resolution != dpi)
+ {
+ screen->resolution = dpi;
+
+ g_object_notify (G_OBJECT (screen), "resolution");
+ }
+}
+
+/* Just like gdk_screen_set_resolution(), but doesn't change
+ * screen->resolution. This is us to allow us to distinguish
+ * resolution changes that the backend picks up from resolution
+ * changes made through the public API - perhaps using
+ * g_object_set(<GtkSetting>, "gtk-xft-dpi", ...);
+ */
+void
+_gdk_screen_set_resolution (GdkScreen *screen,
+ gdouble dpi)
+{
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+
+ if (dpi < 0)
+ dpi = -1.0;
+
if (screen->resolution != dpi)
{
screen->resolution = dpi;