[mutter/halfline/wip/kms-cleanups: 3/9] session-controller: make take_device method public



commit 9bc764d2687fd6d4bf0d5dd1d0c08158c20b186b
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jan 8 12:07:12 2016 -0500

    session-controller: make take_device method public
    
    We ultimately want to move the renderering related code
    off to a separate file. When moved that code will need
    to call back to the session controller to do that actual
    talking to logind.
    
    This commit exports the take_device method from the
    session controller code, so that, in a later commit, the
    rendering code can make use of it.

 src/backends/native/meta-session-controller.c |   24 ++++++++++++++++++++++++
 src/backends/native/meta-session-controller.h |    8 +++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/native/meta-session-controller.c b/src/backends/native/meta-session-controller.c
index 65c3d09..cc1def2 100644
--- a/src/backends/native/meta-session-controller.c
+++ b/src/backends/native/meta-session-controller.c
@@ -425,6 +425,30 @@ get_seat_id (GError **error)
   return seat_id;
 }
 
+gboolean
+meta_session_controller_take_device (MetaSessionController  *self,
+                                     const char             *device_path,
+                                     GCancellable           *cancellable,
+                                     int                    *device_fd,
+                                     GError                **error)
+{
+  int major, minor;
+
+  if (!get_device_info_from_path (device_path, &major, &minor))
+    {
+      g_set_error (error,
+                   G_IO_ERROR,
+                   G_IO_ERROR_NOT_FOUND,
+                   "Could not access device %s", device_path);
+      return FALSE;
+    }
+
+  if (!take_device (self->session_proxy, major, minor, &device_fd, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
 MetaSessionController *
 meta_session_controller_new (GError **error)
 {
diff --git a/src/backends/native/meta-session-controller.h b/src/backends/native/meta-session-controller.h
index 2d66dc1..f2561cb 100644
--- a/src/backends/native/meta-session-controller.h
+++ b/src/backends/native/meta-session-controller.h
@@ -20,7 +20,7 @@
 #ifndef META_SESSION_CONTROLLER_H
 #define META_SESSION_CONTROLLER_H
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 typedef struct _MetaSessionController MetaSessionController;
 
@@ -34,4 +34,10 @@ gboolean               meta_session_controller_activate_vt      (MetaSessionCont
                                                                  signed char             vt,
                                                                  GError                **error);
 
+gboolean               meta_session_controller_take_device      (MetaSessionController  *self,
+                                                                 const char             *device_path,
+                                                                 GCancellable           *cancellable,
+                                                                 int                    *device_fd,
+                                                                 GError                **error);
+
 #endif /* META_SESSION_CONTROLLER_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]