[gtk+/wip/garnacho/gdkseat: 52/74] GdkDisplay: Add GdkSeat getters
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/garnacho/gdkseat: 52/74] GdkDisplay: Add GdkSeat getters
- Date: Mon, 14 Dec 2015 20:07:01 +0000 (UTC)
commit 81773767862a3b6f530fefa63699def109871846
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 26 19:52:23 2015 +0100
GdkDisplay: Add GdkSeat getters
https://bugzilla.gnome.org/show_bug.cgi?id=759309
docs/reference/gdk/gdk3-sections.txt | 2 +
gdk/gdkdisplay.c | 80 ++++++++++++++++++++++++++++++++++
gdk/gdkdisplay.h | 7 +++
gdk/gdkdisplayprivate.h | 9 ++++
4 files changed, 98 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index ba66214..b7f1b09 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -156,6 +156,8 @@ gdk_display_supports_input_shapes
gdk_display_supports_composite
gdk_display_get_app_launch_context
gdk_display_notify_startup_complete
+gdk_display_get_default_seat
+gdk_display_list_seats
<SUBSECTION Standard>
GDK_DISPLAY
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 29e359f..37ef5fb 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -125,6 +125,15 @@ gdk_display_real_event_data_free (GdkDisplay *display,
{
}
+static GdkSeat *
+gdk_display_real_get_default_seat (GdkDisplay *display)
+{
+ if (!display->seats)
+ return NULL;
+
+ return display->seats->data;
+}
+
static void
gdk_display_class_init (GdkDisplayClass *class)
{
@@ -140,6 +149,7 @@ gdk_display_class_init (GdkDisplayClass *class)
class->make_default = gdk_display_real_make_default;
class->event_data_copy = gdk_display_real_event_data_copy;
class->event_data_free = gdk_display_real_event_data_free;
+ class->get_default_seat = gdk_display_real_get_default_seat;
/**
* GdkDisplay::opened:
@@ -2318,3 +2328,73 @@ gdk_display_get_debug_updates (GdkDisplay *display)
else
return _gdk_debug_updates;
}
+
+void
+gdk_display_add_seat (GdkDisplay *display,
+ GdkSeat *seat)
+{
+ g_return_if_fail (GDK_IS_DISPLAY (display));
+ g_return_if_fail (GDK_IS_SEAT (seat));
+
+ display->seats = g_list_prepend (display->seats, g_object_ref (seat));
+}
+
+void
+gdk_display_remove_seat (GdkDisplay *display,
+ GdkSeat *seat)
+{
+ GList *link;
+
+ g_return_if_fail (GDK_IS_DISPLAY (display));
+ g_return_if_fail (GDK_IS_SEAT (seat));
+
+ link = g_list_find (display->seats, seat);
+
+ if (link)
+ {
+ display->seats = g_list_remove_link (display->seats, link);
+ g_object_unref (link->data);
+ g_list_free (link);
+ }
+}
+
+/**
+ * gdk_display_get_default_seat:
+ * @display: a #GdkDisplay
+ *
+ * Returns the default #GdkSeat for this display.
+ *
+ * Returns: (transfer none): the default seat.
+ *
+ * Since: 3.20
+ **/
+GdkSeat *
+gdk_display_get_default_seat (GdkDisplay *display)
+{
+ GdkDisplayClass *display_class;
+
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ display_class = GDK_DISPLAY_GET_CLASS (display);
+
+ return display_class->get_default_seat (display);
+}
+
+/**
+ * gdk_display_list_seats:
+ * @display: a #GdkDisplay
+ *
+ * Returns the list of seats known to @display.
+ *
+ * Returns: (transfer container) (element-type GdkSeat): the
+ * list of seats known to the #GdkDisplay
+ *
+ * Since: 3.20
+ **/
+GList *
+gdk_display_list_seats (GdkDisplay *display)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ return g_list_copy (display->seats);
+}
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index a76af35..9e30d87 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -30,6 +30,7 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkdevicemanager.h>
+#include <gdk/gdkseat.h>
G_BEGIN_DECLS
@@ -171,6 +172,12 @@ GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);
+GDK_AVAILABLE_IN_3_20
+GdkSeat * gdk_display_get_default_seat (GdkDisplay *display);
+
+GDK_AVAILABLE_IN_3_20
+GList * gdk_display_list_seats (GdkDisplay *display);
+
G_END_DECLS
#endif /* __GDK_DISPLAY_H__ */
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 14d8ea6..702d6cf 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -125,6 +125,8 @@ struct _GdkDisplay
guint debug_updates_set : 1;
GdkRenderingMode rendering_mode;
+
+ GList *seats;
};
struct _GdkDisplayClass
@@ -237,6 +239,8 @@ struct _GdkDisplayClass
gboolean (*make_gl_context_current) (GdkDisplay *display,
GdkGLContext *context);
+ GdkSeat * (*get_default_seat) (GdkDisplay *display);
+
/* Signals */
void (*opened) (GdkDisplay *display);
void (*closed) (GdkDisplay *display,
@@ -318,6 +322,11 @@ GdkWindow * _gdk_display_create_window (GdkDisplay *display
gboolean gdk_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);
+void gdk_display_add_seat (GdkDisplay *display,
+ GdkSeat *seat);
+void gdk_display_remove_seat (GdkDisplay *display,
+ GdkSeat *seat);
+
G_END_DECLS
#endif /* __GDK_DISPLAY_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]