keybindings: Simplify interface for VT switching

This commit is contained in:
Jasper St. Pierre 2014-02-01 19:34:24 -05:00
parent e04a55d1a2
commit 7e7b671b8e
3 changed files with 25 additions and 25 deletions

View File

@ -4090,27 +4090,14 @@ 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))
if (!meta_wayland_compositor_activate_vt (compositor, vt, &error))
{
g_warning ("Failed to switch VT: %s", error->message);
g_error_free (error);
}
}
else
{
g_debug ("Ignoring VT switch keybinding, not running as VT manager");
}
}
#endif

View File

@ -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 */

View File

@ -743,14 +743,24 @@ meta_wayland_finalize (void)
meta_launcher_free (compositor->launcher);
}
MetaLauncher *
meta_wayland_compositor_get_launcher (MetaWaylandCompositor *compositor)
{
return compositor->launcher;
}
gboolean
meta_wayland_compositor_is_native (MetaWaylandCompositor *compositor)
{
return compositor->native;
}
gboolean
meta_wayland_compositor_activate_vt (MetaWaylandCompositor *compositor,
int vt,
GError **error)
{
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;
}
}