mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-04 13:29:51 -05:00
Only forward events to compositor if on active VT
Previously, we'd send things like the user's password to the active irc window when they logged into a getty running on a different tty.
This commit is contained in:
parent
33500890b3
commit
e96dcb8f93
1 changed files with 17 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ struct egl_compositor {
|
||||||
|
|
||||||
/* tty handling state */
|
/* tty handling state */
|
||||||
int tty_fd;
|
int tty_fd;
|
||||||
|
uint32_t vt_active : 1;
|
||||||
|
|
||||||
struct termios terminal_attributes;
|
struct termios terminal_attributes;
|
||||||
struct wl_event_source *tty_input_source;
|
struct wl_event_source *tty_input_source;
|
||||||
|
|
@ -598,6 +599,9 @@ notify_motion(struct wlsc_input_device *device, int x, int y)
|
||||||
const int hotspot_x = 16, hotspot_y = 16;
|
const int hotspot_x = 16, hotspot_y = 16;
|
||||||
int32_t sx, sy;
|
int32_t sx, sy;
|
||||||
|
|
||||||
|
if (!ec->vt_active)
|
||||||
|
return;
|
||||||
|
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
|
|
@ -629,8 +633,12 @@ notify_button(struct wlsc_input_device *device,
|
||||||
int32_t button, int32_t state)
|
int32_t button, int32_t state)
|
||||||
{
|
{
|
||||||
struct egl_surface *es;
|
struct egl_surface *es;
|
||||||
|
struct egl_compositor *ec = device->ec;
|
||||||
int32_t sx, sy;
|
int32_t sx, sy;
|
||||||
|
|
||||||
|
if (!ec->vt_active)
|
||||||
|
return;
|
||||||
|
|
||||||
es = pick_surface(device);
|
es = pick_surface(device);
|
||||||
if (es) {
|
if (es) {
|
||||||
wl_list_remove(&es->link);
|
wl_list_remove(&es->link);
|
||||||
|
|
@ -662,6 +670,11 @@ void
|
||||||
notify_key(struct wlsc_input_device *device,
|
notify_key(struct wlsc_input_device *device,
|
||||||
uint32_t key, uint32_t state)
|
uint32_t key, uint32_t state)
|
||||||
{
|
{
|
||||||
|
struct egl_compositor *ec = device->ec;
|
||||||
|
|
||||||
|
if (!ec->vt_active)
|
||||||
|
return;
|
||||||
|
|
||||||
if (device->focus_surface != NULL)
|
if (device->focus_surface != NULL)
|
||||||
wl_surface_post_event(&device->focus_surface->base,
|
wl_surface_post_event(&device->focus_surface->base,
|
||||||
&device->base,
|
&device->base,
|
||||||
|
|
@ -854,6 +867,7 @@ static void on_enter_vt(int signal_number, void *data)
|
||||||
int ret, fd;
|
int ret, fd;
|
||||||
|
|
||||||
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ);
|
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ);
|
||||||
|
ec->vt_active = TRUE;
|
||||||
|
|
||||||
fd = eglGetDisplayFD(ec->display);
|
fd = eglGetDisplayFD(ec->display);
|
||||||
ret = drmModeSetCrtc(fd, ec->crtc_id, ec->fb_id, 0, 0,
|
ret = drmModeSetCrtc(fd, ec->crtc_id, ec->fb_id, 0, 0,
|
||||||
|
|
@ -869,6 +883,7 @@ static void on_leave_vt(int signal_number, void *data)
|
||||||
struct egl_compositor *ec = data;
|
struct egl_compositor *ec = data;
|
||||||
|
|
||||||
ioctl (ec->tty_fd, VT_RELDISP, 1);
|
ioctl (ec->tty_fd, VT_RELDISP, 1);
|
||||||
|
ec->vt_active = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool open_active_tty(struct egl_compositor *ec)
|
static bool open_active_tty(struct egl_compositor *ec)
|
||||||
|
|
@ -1037,6 +1052,8 @@ egl_compositor_create(struct wl_display *display)
|
||||||
wl_display_add_global(display, &shooter->base);
|
wl_display_add_global(display, &shooter->base);
|
||||||
|
|
||||||
loop = wl_display_get_event_loop(ec->wl_display);
|
loop = wl_display_get_event_loop(ec->wl_display);
|
||||||
|
|
||||||
|
ec->vt_active = TRUE;
|
||||||
if (open_active_tty (ec)) {
|
if (open_active_tty (ec)) {
|
||||||
ignore_tty_input (ec, loop);
|
ignore_tty_input (ec, loop);
|
||||||
watch_for_vt_changes (ec, loop);
|
watch_for_vt_changes (ec, loop);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue