<key id="a" mapto="up" flags="mr" />
<key id="b" mapto="down" flags="mr" />
</device>
- <key id="KEY_UP" mapto="up" flags="mr" />
- <key id="KEY_DOWN" mapto="down" flags="mr" />
+ <key id="KEY_UP" mapto="moveUp" flags="mr" />
+ <key id="KEY_DOWN" mapto="moveDown" flags="mr" />
<key id="1" mapto="moveUp" flags="mr" />
<key id="2" mapto="moveDown" flags="mr" />
</map>
id = x.getAttribute("id")
flags = x.getAttribute("flags")
- flag_ascii_to_id = lambda x: {'m':1,'r':2,'b':4}[x]
+ flag_ascii_to_id = lambda x: {'m':1,'b':2,'r':4}[x]
# try:
flags = sum(map(flag_ascii_to_id, flags))
raise "key id '" + str(id) + "' is illegal"
print context + "::" + mapto + " -> " + device + "." + hex(keyid)
- p.bindKey(device, keyid, 7, context, mapto)
+ p.bindKey(device, keyid, flags, context, mapto)
parseKeys("generic", cmap)
if (
// (k->second.m_device == m_device) &&
(k->second.m_key == key) &&
- ((k->second.m_flags & flags)==flags))
+ (k->second.m_flags & (1<<flags)))
{
if (i->second.m_widget->event(eWidget::evtAction, 0, (void*)k->second.m_action))
return;
if (
// (k->second.m_device == m_device) &&
(k->second.m_key == key) &&
- ((k->second.m_flags & flags)==flags))
+ (k->second.m_flags & (1<<flags)))
{
PyObject *pArgs = PyTuple_New(2);
PyTuple_SetItem(pArgs, 0, PyString_FromString(k->first.c_str()));
class eInputDeviceInit
{
- eRCInputEventDriver driver;
- eRCDeviceInputDev deviceInputDev;
+ ePtrList<eRCInputEventDriver> m_drivers;
+ ePtrList<eRCDeviceInputDev> m_devices;
public:
- eInputDeviceInit(): driver("/dev/input/event0"), deviceInputDev(&driver)
+ eInputDeviceInit()
{
+ int i = 0;
+ while (1)
+ {
+ struct stat s;
+ char filename[128];
+ sprintf(filename, "/dev/input/event%d", i);
+ if (stat(filename, &s))
+ break;
+ eRCInputEventDriver *p;
+ m_drivers.push_back(p = new eRCInputEventDriver(filename));
+ m_devices.push_back(new eRCDeviceInputDev(p));
+ ++i;
+ }
+ eDebug("Found %d input devices!", i);
+ }
+
+ ~eInputDeviceInit()
+ {
+ while (m_drivers.size())
+ {
+ delete m_devices.back();
+ m_devices.pop_back();
+ delete m_drivers.back();
+ m_drivers.pop_back();
+ }
}
};