surface: Add a scale-factor property

This will allow us to notify when the scale changes.
This commit is contained in:
Matthias Clasen 2021-01-16 15:16:36 -05:00
parent 691b6b88ea
commit aefc630d29

View File

@ -92,6 +92,7 @@ enum {
PROP_MAPPED,
PROP_WIDTH,
PROP_HEIGHT,
PROP_SCALE_FACTOR,
LAST_PROP
};
@ -551,6 +552,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
P_("Scale factor"),
P_("Scale factor"),
1, G_MAXINT, 1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@ -782,6 +790,10 @@ gdk_surface_get_property (GObject *object,
g_value_set_int (value, surface->height);
break;
case PROP_SCALE_FACTOR:
g_value_set_int (value, gdk_surface_get_scale_factor (surface));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;