[gtk/broadway-display-scale] inspector: Support scale changes on Broadway
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/broadway-display-scale] inspector: Support scale changes on Broadway
- Date: Mon, 10 May 2021 14:56:04 +0000 (UTC)
commit b13c2e17f138215fce055a33e1aff4dfaa4eab2e
Author: Matthias Clasen <mclasen redhat com>
Date: Mon May 10 10:55:41 2021 -0400
inspector: Support scale changes on Broadway
gtk/inspector/visual.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index f3cb4695ac..a328b81c6d 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -55,6 +55,9 @@
#ifdef GDK_WINDOWING_MACOS
#include "macos/gdkmacos.h"
#endif
+#ifdef GDK_WINDOWING_BROADWAY
+#include "broadway/gdkbroadway.h"
+#endif
#include "gdk/gdk-private.h"
@@ -796,14 +799,21 @@ init_font_scale (GtkInspectorVisual *vis)
G_CALLBACK (font_scale_entry_activated), vis);
}
-#if defined (GDK_WINDOWING_X11)
+#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_BROADWAY)
static void
scale_changed (GtkAdjustment *adjustment, GtkInspectorVisual *vis)
{
int scale;
scale = gtk_adjustment_get_value (adjustment);
- gdk_x11_display_set_surface_scale (vis->display, scale);
+#if defined (GDK_WINDOWING_X11)
+ if (GDK_IS_X11_DISPLAY (vis->display))
+ gdk_x11_display_set_surface_scale (vis->display, scale);
+#endif
+#if defined (GDK_WINDOWING_BROADWAY)
+ if (GDK_IS_BROADWAY_DISPLAY (vis->display))
+ gdk_broadway_display_set_surface_scale (vis->display, scale);
+#endif
}
#endif
@@ -821,6 +831,18 @@ init_scale (GtkInspectorVisual *vis)
G_CALLBACK (scale_changed), vis);
}
else
+#endif
+#if defined (GDK_WINDOWING_BROADWAY)
+ if (GDK_IS_BROADWAY_DISPLAY (vis->display))
+ {
+ double scale;
+
+ scale = gdk_monitor_get_scale_factor (gdk_x11_display_get_primary_monitor (vis->display));
+ gtk_adjustment_set_value (vis->scale_adjustment, scale);
+ g_signal_connect (vis->scale_adjustment, "value-changed",
+ G_CALLBACK (scale_changed), vis);
+ }
+ else
#endif
{
GtkWidget *row;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]