x11: Add virtual Device{Added, Removed} events
This commit is contained in:
parent
cc6225ce21
commit
94b3ce8e6f
|
@ -610,6 +610,27 @@ impl X11Inner {
|
||||||
where
|
where
|
||||||
F: FnMut(X11Event, &mut ()),
|
F: FnMut(X11Event, &mut ()),
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
let mut inner = inner.lock().unwrap();
|
||||||
|
if !inner.windows.is_empty() && !inner.devices {
|
||||||
|
callback(
|
||||||
|
Input(InputEvent::DeviceAdded {
|
||||||
|
device: X11VirtualDevice,
|
||||||
|
}),
|
||||||
|
&mut (),
|
||||||
|
);
|
||||||
|
inner.devices = true;
|
||||||
|
} else if inner.windows.is_empty() && inner.devices {
|
||||||
|
callback(
|
||||||
|
Input(InputEvent::DeviceRemoved {
|
||||||
|
device: X11VirtualDevice,
|
||||||
|
}),
|
||||||
|
&mut (),
|
||||||
|
);
|
||||||
|
inner.devices = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use self::X11Event::Input;
|
use self::X11Event::Input;
|
||||||
|
|
||||||
// If X11 is deadlocking somewhere here, make sure you drop your mutex guards.
|
// If X11 is deadlocking somewhere here, make sure you drop your mutex guards.
|
||||||
|
|
Loading…
Reference in New Issue