[mutter/wayland] keybindings: Simplify interface for VT switching



commit 7e7b671b8e11cfc4575e206ae40c031376ca95cb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 1 19:34:24 2014 -0500

    keybindings: Simplify interface for VT switching

 src/core/keybindings.c             |   23 +++++------------------
 src/wayland/meta-wayland-private.h |    5 ++++-
 src/wayland/meta-wayland.c         |   20 +++++++++++++++-----
 3 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index e6c6a88..22aa3a8 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -4090,26 +4090,13 @@ handle_switch_vt (MetaDisplay     *display,
                   gpointer         dummy)
 {
   gint vt = binding->handler->data;
-  MetaWaylandCompositor *compositor;
-  MetaLauncher *launcher;
+  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+  GError *error = NULL;
 
-  compositor = meta_wayland_compositor_get_default ();
-  launcher = meta_wayland_compositor_get_launcher (compositor);
-
-  if (launcher)
-    {
-      GError *error;
-
-      error = NULL;
-      if (!meta_launcher_activate_vt (launcher, vt, &error))
-        {
-          g_warning ("Failed to switch VT: %s", error->message);
-          g_error_free (error);
-        }
-    }
-  else
+  if (!meta_wayland_compositor_activate_vt (compositor, vt, &error))
     {
-      g_debug ("Ignoring VT switch keybinding, not running as VT manager");
+      g_warning ("Failed to switch VT: %s", error->message);
+      g_error_free (error);
     }
 }
 #endif
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index efd2e4a..7c860e1 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -99,7 +99,6 @@ void                    meta_wayland_compositor_set_input_focus (MetaWaylandComp
 gboolean                meta_wayland_compositor_handle_event    (MetaWaylandCompositor *compositor,
                                                                  const ClutterEvent    *event);
 
-MetaLauncher           *meta_wayland_compositor_get_launcher    (MetaWaylandCompositor *compositor);
 gboolean                meta_wayland_compositor_is_native       (MetaWaylandCompositor *compositor);
 
 MetaWaylandBuffer *     meta_wayland_buffer_from_resource       (struct wl_resource    *resource);
@@ -110,4 +109,8 @@ void                    meta_wayland_compositor_update          (MetaWaylandComp
                                                                  const ClutterEvent    *event);
 void                    meta_wayland_compositor_paint_finished  (MetaWaylandCompositor *compositor);
 
+gboolean                meta_wayland_compositor_activate_vt     (MetaWaylandCompositor  *compositor,
+                                                                 int                     vt,
+                                                                 GError                **error);
+
 #endif /* META_WAYLAND_PRIVATE_H */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index f3e828f..ac49ad9 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -743,14 +743,24 @@ meta_wayland_finalize (void)
     meta_launcher_free (compositor->launcher);
 }
 
-MetaLauncher *
-meta_wayland_compositor_get_launcher (MetaWaylandCompositor *compositor)
+gboolean
+meta_wayland_compositor_is_native (MetaWaylandCompositor *compositor)
 {
-  return compositor->launcher;
+  return compositor->native;
 }
 
 gboolean
-meta_wayland_compositor_is_native (MetaWaylandCompositor *compositor)
+meta_wayland_compositor_activate_vt (MetaWaylandCompositor  *compositor,
+                                     int                     vt,
+                                     GError                **error)
 {
-  return compositor->native;
+  if (compositor->launcher)
+    {
+      return meta_launcher_activate_vt (compositor->launcher, vt, error);
+    }
+  else
+    {
+      g_debug ("Ignoring VT switch keybinding, not running as VT manager");
+      return TRUE;
+    }
 }


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