Revert "meta-weston-launch: Call VT_ACTIVATE ourselves"
This reverts commit ebe6e3180e
.
This is wrong, as mutter's controlling TTY may not be the same
as the active VT, and in fact won't be in the case of systemd
spawning us.
The "correct" API for this is to use David Herrmann's
"Session Positions" system to switch to another VT:
http://lists.freedesktop.org/archives/systemd-devel/2013-December/014956.html
This commit is contained in:
@ -54,9 +54,6 @@
|
||||
|
||||
#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"
|
||||
@ -4084,18 +4081,6 @@ 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,
|
||||
@ -4104,10 +4089,28 @@ handle_switch_vt (MetaDisplay *display,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
gint vt = binding->handler->data;
|
||||
gint vt = binding->handler->data;
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaLauncher *launcher;
|
||||
|
||||
if (!activate_vt (vt))
|
||||
g_warning ("Failed to switch VT");
|
||||
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");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user