[gtk+] x11: Add gdk_x11_display_set_window_scale
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] x11: Add gdk_x11_display_set_window_scale
- Date: Tue, 20 Aug 2013 09:17:10 +0000 (UTC)
commit 78dae73a303bd339299a7f2b04844dabb0efb401
Author: Alexander Larsson <alexl redhat com>
Date: Tue Aug 20 11:15:08 2013 +0200
x11: Add gdk_x11_display_set_window_scale
This lets you force a specific window scale, this is needed
for mutter to be able to disable the scaling as it needs access
to unmangled X window/screen sizes. It can also be useful to
force a specific scale in e.g. tests.
gdk/x11/gdkdisplay-x11.c | 37 +++++++++++++++++++++++++++++++++++++
gdk/x11/gdkx11display.h | 4 ++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 575a3b7..e1a28ea 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -2674,6 +2674,43 @@ gdk_x11_display_error_trap_pop_internal (GdkDisplay *display,
}
/**
+ * gdk_x11_display_set_window_scale:
+ * @display: (type GdkX11Display): the display
+ * @scale: The new scale value
+ *
+ * Forces a specific window scale for all windows on this display,
+ * instead of using the default or user configured scale. This
+ * is can be used to disable scaling support by setting @scale to
+ * 1, or to programmatically set the window scale.
+ *
+ * Once the scale is set by this call it will not change in response
+ * to later user configuration changes.
+ *
+ * Since: 3.10
+ */
+void
+gdk_x11_display_set_window_scale (GdkDisplay *display,
+ gint scale)
+{
+ GdkX11Screen *x11_screen;
+
+ g_return_if_fail (GDK_IS_X11_DISPLAY (display));
+
+ scale = MAX (scale, 1);
+
+#ifndef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+ /* Without cairo support we can't support any scale but 1 */
+ scale = 1;
+#endif
+
+ x11_screen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen);
+
+ x11_screen->fixed_window_scale = TRUE;
+ _gdk_x11_screen_set_window_scale (x11_screen, scale);
+}
+
+
+/**
* gdk_x11_display_error_trap_pop:
* @display: (type GdkX11Display): the display
*
diff --git a/gdk/x11/gdkx11display.h b/gdk/x11/gdkx11display.h
index c4e66ec..703aec7 100644
--- a/gdk/x11/gdkx11display.h
+++ b/gdk/x11/gdkx11display.h
@@ -85,6 +85,10 @@ void gdk_x11_display_grab (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_ungrab (GdkDisplay *display);
+GDK_AVAILABLE_IN_3_10
+void gdk_x11_display_set_window_scale (GdkDisplay *display,
+ gint scale);
+
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_error_trap_push (GdkDisplay *display);
/* warn unused because you could use pop_ignored otherwise */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]