summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-12-20 02:00:49 -0500
committerRay Strode <rstrode@redhat.com>2008-12-20 02:00:49 -0500
commite96dcb8f93565fd6d4ef49ccc6e03e9e70ed3ef6 (patch)
treebd4a309b8d33c8ddddcf0e50e39c2e57167e3975
parent33500890b32f33e1bf95ec8c9460079232a3f7e3 (diff)
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.
-rw-r--r--wayland-system-compositor.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/wayland-system-compositor.c b/wayland-system-compositor.c
index fb44ab9..e54b01f 100644
--- a/wayland-system-compositor.c
+++ b/wayland-system-compositor.c
@@ -86,6 +86,7 @@ struct egl_compositor {
/* tty handling state */
int tty_fd;
+ uint32_t vt_active : 1;
struct termios terminal_attributes;
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;
int32_t sx, sy;
+ if (!ec->vt_active)
+ return;
+
if (x < 0)
x = 0;
if (y < 0)
@@ -629,8 +633,12 @@ notify_button(struct wlsc_input_device *device,
int32_t button, int32_t state)
{
struct egl_surface *es;
+ struct egl_compositor *ec = device->ec;
int32_t sx, sy;
+ if (!ec->vt_active)
+ return;
+
es = pick_surface(device);
if (es) {
wl_list_remove(&es->link);
@@ -662,6 +670,11 @@ void
notify_key(struct wlsc_input_device *device,
uint32_t key, uint32_t state)
{
+ struct egl_compositor *ec = device->ec;
+
+ if (!ec->vt_active)
+ return;
+
if (device->focus_surface != NULL)
wl_surface_post_event(&device->focus_surface->base,
&device->base,
@@ -854,6 +867,7 @@ static void on_enter_vt(int signal_number, void *data)
int ret, fd;
ioctl(ec->tty_fd, VT_RELDISP, VT_ACKACQ);
+ ec->vt_active = TRUE;
fd = eglGetDisplayFD(ec->display);
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;
ioctl (ec->tty_fd, VT_RELDISP, 1);
+ ec->vt_active = FALSE;
}
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);
loop = wl_display_get_event_loop(ec->wl_display);
+
+ ec->vt_active = TRUE;
if (open_active_tty (ec)) {
ignore_tty_input (ec, loop);
watch_for_vt_changes (ec, loop);