[gtk/wip/chergert/fix-broadway-build] inspector: fix compilation with broadway
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/fix-broadway-build] inspector: fix compilation with broadway
- Date: Thu, 17 Jun 2021 18:30:31 +0000 (UTC)
commit 352898ae9ef91fd1d284844cd2fdaa00e632c570
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 17 11:40:10 2021 -0700
inspector: fix compilation with broadway
gdk/broadway/gdkbroadwaydisplay.h | 2 ++
gdk/broadway/gdkdisplay-broadway.c | 23 +++++++++++++++++++++++
gtk/inspector/visual.c | 4 ++--
3 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/gdk/broadway/gdkbroadwaydisplay.h b/gdk/broadway/gdkbroadwaydisplay.h
index 79e78c9a62..767b8b8a9d 100644
--- a/gdk/broadway/gdkbroadwaydisplay.h
+++ b/gdk/broadway/gdkbroadwaydisplay.h
@@ -48,6 +48,8 @@ void gdk_broadway_display_show_keyboard (GdkBroadwayDis
GDK_AVAILABLE_IN_ALL
void gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display);
+GDK_AVAILABLE_IN_4_4
+int gdk_broadway_display_get_surface_scale (GdkDisplay *display);
GDK_AVAILABLE_IN_4_4
void gdk_broadway_display_set_surface_scale (GdkDisplay *display,
int scale);
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 29f2256323..a8ebb1dc88 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -361,6 +361,29 @@ gdk_broadway_display_set_surface_scale (GdkDisplay *display,
gdk_monitor_set_scale_factor (self->monitor, scale);
}
+/**
+ * gdk_broadway_display_get_surface_scale:
+ * @display: (type GdkBroadwayDisplay): the display
+ *
+ * Gets the surface scale that was previously set by the client or
+ * gdk_broadway_display_set_surface_scale().
+ *
+ * Returns: the scale for surfaces
+ *
+ * Since: 4.4
+ */
+int
+gdk_broadway_display_get_surface_scale (GdkDisplay *display)
+{
+ GdkBroadwayDisplay *self;
+
+ g_return_val_if_fail (GDK_IS_BROADWAY_DISPLAY (display), 1);
+
+ self = GDK_BROADWAY_DISPLAY (display);
+
+ return self->scale_factor;
+}
+
static GListModel *
gdk_broadway_display_get_monitors (GdkDisplay *display)
{
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index a328b81c6d..04351bafc9 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -835,9 +835,9 @@ init_scale (GtkInspectorVisual *vis)
#if defined (GDK_WINDOWING_BROADWAY)
if (GDK_IS_BROADWAY_DISPLAY (vis->display))
{
- double scale;
+ int scale;
- scale = gdk_monitor_get_scale_factor (gdk_x11_display_get_primary_monitor (vis->display));
+ scale = gdk_broadway_display_get_surface_scale (vis->display);
gtk_adjustment_set_value (vis->scale_adjustment, scale);
g_signal_connect (vis->scale_adjustment, "value-changed",
G_CALLBACK (scale_changed), vis);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]