mirror of
https://github.com/brl/mutter.git
synced 2025-08-07 00:54:42 +00:00
meta-weston-launch: Call VT_ACTIVATE ourselves
We don't need any special permissions, so we don't need to go through weston-launch to do so...
This commit is contained in:
@@ -56,6 +56,9 @@
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "meta-wayland-private.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/vt.h>
|
||||
#endif
|
||||
|
||||
#define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings"
|
||||
@@ -4083,6 +4086,18 @@ handle_set_spew_mark (MetaDisplay *display,
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
static gboolean
|
||||
activate_vt (int vt)
|
||||
{
|
||||
int tty, reply;
|
||||
|
||||
tty = open ("/dev/tty", O_RDWR | O_NOCTTY | O_CLOEXEC);
|
||||
reply = ioctl (tty, VT_ACTIVATE, vt);
|
||||
close (tty);
|
||||
|
||||
return (reply == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_switch_vt (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@@ -4091,28 +4106,10 @@ handle_switch_vt (MetaDisplay *display,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
gint vt = binding->handler->data;
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaLauncher *launcher;
|
||||
gint vt = binding->handler->data;
|
||||
|
||||
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
|
||||
{
|
||||
g_debug ("Ignoring VT switch keybinding, not running as VT manager");
|
||||
}
|
||||
if (!activate_vt (vt))
|
||||
g_warning ("Failed to switch VT");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user