diff options
Diffstat (limited to 'src/KeyboardDevice.cpp')
-rw-r--r-- | src/KeyboardDevice.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/KeyboardDevice.cpp b/src/KeyboardDevice.cpp new file mode 100644 index 0000000..22248f8 --- /dev/null +++ b/src/KeyboardDevice.cpp @@ -0,0 +1,18 @@ + +#include "KeyboardDevice.h" + +int KeyboardDevice::counter = 0; + +KeyboardDevice::KeyboardDevice(XDeviceInfo* dev, XConn* x11, Manager* manager) +{ + XDevice* d = XOpenDevice(x11->dpy, dev->id); + + if (!d) + throw new DeviceError(DeviceError::OPEN_FAILED); + this->x11 = x11; + this->kbdID = KeyboardDevice::counter++; + this->name = string(dev->name); + this->id = dev->id; + this->dev = d; + TRACE("Keyboard %d (%s) initialised\n", kbdID, dev->name); +} |