compositor-drm: remove/add evdev devices when vt switches
Reported-by: Ran Benite <ran234@gmail.com> Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
This commit is contained in:
@@ -789,6 +789,7 @@ vt_func(struct wlsc_compositor *compositor, int event)
|
|||||||
{
|
{
|
||||||
struct drm_compositor *ec = (struct drm_compositor *) compositor;
|
struct drm_compositor *ec = (struct drm_compositor *) compositor;
|
||||||
struct wlsc_output *output;
|
struct wlsc_output *output;
|
||||||
|
struct wlsc_input_device *input;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case TTY_ENTER_VT:
|
case TTY_ENTER_VT:
|
||||||
@@ -796,12 +797,16 @@ vt_func(struct wlsc_compositor *compositor, int event)
|
|||||||
drmSetMaster(ec->drm.fd);
|
drmSetMaster(ec->drm.fd);
|
||||||
compositor->state = ec->prev_state;
|
compositor->state = ec->prev_state;
|
||||||
wlsc_compositor_damage_all(compositor);
|
wlsc_compositor_damage_all(compositor);
|
||||||
|
wl_list_for_each(input, &compositor->input_device_list, link)
|
||||||
|
evdev_add_devices(ec->udev, input);
|
||||||
break;
|
break;
|
||||||
case TTY_LEAVE_VT:
|
case TTY_LEAVE_VT:
|
||||||
compositor->focus = 0;
|
compositor->focus = 0;
|
||||||
ec->prev_state = compositor->state;
|
ec->prev_state = compositor->state;
|
||||||
compositor->state = WLSC_COMPOSITOR_SLEEPING;
|
compositor->state = WLSC_COMPOSITOR_SLEEPING;
|
||||||
|
|
||||||
|
wl_list_for_each(input, &compositor->input_device_list, link)
|
||||||
|
evdev_remove_devices(input);
|
||||||
wl_list_for_each(output, &ec->base.output_list, link)
|
wl_list_for_each(output, &ec->base.output_list, link)
|
||||||
drm_output_set_cursor(output, NULL);
|
drm_output_set_cursor(output, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -377,6 +377,13 @@ void
|
|||||||
evdev_input_add_devices(struct wlsc_compositor *c,
|
evdev_input_add_devices(struct wlsc_compositor *c,
|
||||||
struct udev *udev, const char *seat);
|
struct udev *udev, const char *seat);
|
||||||
|
|
||||||
|
void
|
||||||
|
evdev_add_devices(struct udev *udev, struct wlsc_input_device
|
||||||
|
*input_base);
|
||||||
|
|
||||||
|
void
|
||||||
|
evdev_remove_devices(struct wlsc_input_device *input_base);
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_input_destroy(struct wlsc_input_device *input_base);
|
evdev_input_destroy(struct wlsc_input_device *input_base);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -434,7 +434,7 @@ device_removed(struct udev_device *udev_device, struct evdev_input *master)
|
|||||||
fprintf(stderr, "evdev input device: removed: %s\n", devnode);
|
fprintf(stderr, "evdev input device: removed: %s\n", devnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
evdev_add_devices(struct udev *udev, struct wlsc_input_device *input_base)
|
evdev_add_devices(struct udev *udev, struct wlsc_input_device *input_base)
|
||||||
{
|
{
|
||||||
struct evdev_input *input = (struct evdev_input *) input_base;
|
struct evdev_input *input = (struct evdev_input *) input_base;
|
||||||
@@ -538,7 +538,7 @@ evdev_input_add_devices(struct wlsc_compositor *c,
|
|||||||
c->input_device = &input->base.input_device;
|
c->input_device = &input->base.input_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
evdev_remove_devices(struct wlsc_input_device *input_base)
|
evdev_remove_devices(struct wlsc_input_device *input_base)
|
||||||
{
|
{
|
||||||
struct evdev_input *input = (struct evdev_input *) input_base;
|
struct evdev_input *input = (struct evdev_input *) input_base;
|
||||||
|
|||||||
Reference in New Issue
Block a user