display-config: Expose the supported scales as a reffed GArray

It's just a nicer api and allows us to avoid having to count all the
elements around or to expose the size via an out value.

Given this is a private API anyway there's no risk for modifying the
array, so it's something safe to use anyways.
This commit is contained in:
Marco Trevisan (Treviño) 2021-05-28 23:11:57 +02:00 committed by Georges Basile Stavracas Neto
parent 89cb1d99cb
commit a3392176a9
4 changed files with 16 additions and 13 deletions

View file

@ -87,12 +87,12 @@ cc_display_mode_dbus_get_resolution (CcDisplayMode *pself,
*h = self->height;
}
static const double *
static GArray *
cc_display_mode_dbus_get_supported_scales (CcDisplayMode *pself)
{
CcDisplayModeDBus *self = CC_DISPLAY_MODE_DBUS (pself);
return (const double *) self->supported_scales->data;
return g_array_ref (self->supported_scales);
}
static double
@ -148,7 +148,7 @@ cc_display_mode_dbus_get_freq_f (CcDisplayMode *pself)
static void
cc_display_mode_dbus_init (CcDisplayModeDBus *self)
{
self->supported_scales = g_array_new (TRUE, TRUE, sizeof (double));
self->supported_scales = g_array_new (FALSE, FALSE, sizeof (double));
}
static void