mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
keybindings: Simplify interface for VT switching
This commit is contained in:
parent
e04a55d1a2
commit
7e7b671b8e
@ -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)
|
||||
if (!meta_wayland_compositor_activate_vt (compositor, vt, &error))
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user