launcher: don't try to switch to weston's vt
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
7fe0bb2580
commit
a32986ecf5
|
@ -305,6 +305,17 @@ launcher_direct_destroy(struct weston_launcher *launcher_base)
|
|||
free(launcher);
|
||||
}
|
||||
|
||||
static int
|
||||
launcher_direct_get_vt(struct weston_launcher *base)
|
||||
{
|
||||
struct launcher_direct *launcher = wl_container_of(base, launcher, base);
|
||||
struct stat s;
|
||||
if (fstat(launcher->tty, &s) < 0)
|
||||
return -1;
|
||||
|
||||
return minor(s.st_rdev);
|
||||
}
|
||||
|
||||
struct launcher_interface launcher_direct_iface = {
|
||||
launcher_direct_connect,
|
||||
launcher_direct_destroy,
|
||||
|
@ -312,4 +323,5 @@ struct launcher_interface launcher_direct_iface = {
|
|||
launcher_direct_close,
|
||||
launcher_direct_activate_vt,
|
||||
launcher_direct_restore,
|
||||
launcher_direct_get_vt,
|
||||
};
|
||||
|
|
|
@ -34,6 +34,8 @@ struct launcher_interface {
|
|||
void (* close) (struct weston_launcher *launcher, int fd);
|
||||
int (* activate_vt) (struct weston_launcher *launcher, int vt);
|
||||
void (* restore) (struct weston_launcher *launcher);
|
||||
/* Get the number of the VT weston is running in */
|
||||
int (* get_vt) (struct weston_launcher *launcher);
|
||||
};
|
||||
|
||||
struct weston_launcher {
|
||||
|
|
|
@ -830,6 +830,13 @@ launcher_logind_destroy(struct weston_launcher *launcher)
|
|||
free(wl);
|
||||
}
|
||||
|
||||
static int
|
||||
launcher_logind_get_vt(struct weston_launcher *launcher)
|
||||
{
|
||||
struct launcher_logind *wl = wl_container_of(launcher, wl, base);
|
||||
return wl->vtnr;
|
||||
}
|
||||
|
||||
struct launcher_interface launcher_logind_iface = {
|
||||
launcher_logind_connect,
|
||||
launcher_logind_destroy,
|
||||
|
@ -837,4 +844,5 @@ struct launcher_interface launcher_logind_iface = {
|
|||
launcher_logind_close,
|
||||
launcher_logind_activate_vt,
|
||||
launcher_logind_restore,
|
||||
launcher_logind_get_vt,
|
||||
};
|
||||
|
|
|
@ -98,8 +98,13 @@ switch_vt_binding(struct weston_keyboard *keyboard,
|
|||
uint32_t time, uint32_t key, void *data)
|
||||
{
|
||||
struct weston_compositor *compositor = data;
|
||||
struct weston_launcher *launcher = compositor->launcher;
|
||||
int vt = key - KEY_F1 + 1;
|
||||
|
||||
weston_launcher_activate_vt(compositor->launcher, key - KEY_F1 + 1);
|
||||
if (vt == launcher->iface->get_vt(launcher))
|
||||
return;
|
||||
|
||||
weston_launcher_activate_vt(launcher, vt);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
|
|
|
@ -276,6 +276,17 @@ launcher_weston_launch_destroy(struct weston_launcher *launcher_base)
|
|||
free(launcher);
|
||||
}
|
||||
|
||||
static int
|
||||
launcher_weston_launch_get_vt(struct weston_launcher *base)
|
||||
{
|
||||
struct launcher_weston_launch *launcher = wl_container_of(base, launcher, base);
|
||||
struct stat s;
|
||||
if (fstat(launcher->tty, &s) < 0)
|
||||
return -1;
|
||||
|
||||
return minor(s.st_rdev);
|
||||
}
|
||||
|
||||
struct launcher_interface launcher_weston_launch_iface = {
|
||||
launcher_weston_launch_connect,
|
||||
launcher_weston_launch_destroy,
|
||||
|
@ -283,4 +294,5 @@ struct launcher_interface launcher_weston_launch_iface = {
|
|||
launcher_weston_launch_close,
|
||||
launcher_weston_launch_activate_vt,
|
||||
launcher_weston_launch_restore,
|
||||
launcher_weston_launch_get_vt,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue