summaryrefslogtreecommitdiff
path: root/gdk/broadway
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-05-13 07:00:35 +0200
committerBenjamin Otte <otte@redhat.com>2020-05-13 07:00:35 +0200
commitdd7d76f3899b33eb6de36a33f1fee45648dcba5d (patch)
treef1046eb69647d8d2aa3728b1c2b98571b6ca11fb /gdk/broadway
parentbc88f0116560d461b35eafff152fbdacfb461830 (diff)
downloadgtk+-dd7d76f3899b33eb6de36a33f1fee45648dcba5d.tar.gz
gdk: Add gdk_display_get_monitors()
Returns a GListModel of GDK_TYPE_MONITOR. This will replace the current andling of monitors in GdkDisplay.
Diffstat (limited to 'gdk/broadway')
-rw-r--r--gdk/broadway/gdkdisplay-broadway.c30
-rw-r--r--gdk/broadway/gdkdisplay-broadway.h1
2 files changed, 26 insertions, 5 deletions
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 0a507dc3ae..049670181b 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -243,13 +243,18 @@ gdk_broadway_display_get_default_group (GdkDisplay *display)
static void
gdk_broadway_display_dispose (GObject *object)
{
- GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
+ GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (object);
- if (broadway_display->event_source)
+ if (self->event_source)
+ {
+ g_source_destroy (self->event_source);
+ g_source_unref (self->event_source);
+ self->event_source = NULL;
+ }
+ if (self->monitors)
{
- g_source_destroy (broadway_display->event_source);
- g_source_unref (broadway_display->event_source);
- broadway_display->event_source = NULL;
+ g_list_store_remove_all (self->monitors);
+ g_clear_object (&self->monitors);
}
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
@@ -332,6 +337,20 @@ gdk_broadway_display_get_monitor (GdkDisplay *display,
return NULL;
}
+static GListModel *
+gdk_broadway_display_get_monitors (GdkDisplay *display)
+{
+ GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (display);
+
+ if (self->monitors == NULL)
+ {
+ self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
+ g_list_store_append (self->monitors, self->monitor);
+ }
+
+ return G_LIST_MODEL (self->monitors);
+}
+
static gboolean
gdk_broadway_display_get_setting (GdkDisplay *display,
const char *name,
@@ -430,5 +449,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->get_n_monitors = gdk_broadway_display_get_n_monitors;
display_class->get_monitor = gdk_broadway_display_get_monitor;
+ display_class->get_monitors = gdk_broadway_display_get_monitors;
display_class->get_setting = gdk_broadway_display_get_setting;
}
diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h
index b8e11168ef..0a2f1c91a5 100644
--- a/gdk/broadway/gdkdisplay-broadway.h
+++ b/gdk/broadway/gdkdisplay-broadway.h
@@ -52,6 +52,7 @@ struct _GdkBroadwayDisplay
GdkBroadwayServer *server;
gpointer move_resize_data;
+ GListStore *monitors;
GdkMonitor *monitor;
int scale_factor;