Merge branch 'wip/chergert/fix-broadway-build' into 'master'

inspector: fix compilation with broadway

See merge request GNOME/gtk!3681
This commit is contained in:
Matthias Clasen 2021-06-17 19:45:16 +00:00
commit 8df2cce5c1
3 changed files with 27 additions and 2 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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);