git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/translations' into experimental
[enigma2.git]
/
lib
/
driver
/
rc.cpp
diff --git
a/lib/driver/rc.cpp
b/lib/driver/rc.cpp
index 1a2cc1d8f3754f489d529cae1800eec307281093..c56fde448cd396ea72af4be94b4655e368b5e9bb 100644
(file)
--- a/
lib/driver/rc.cpp
+++ b/
lib/driver/rc.cpp
@@
-79,9
+79,8
@@
eRCShortDriver::eRCShortDriver(const char *filename): eRCDriver(eRCInput::getIns
sn=0;
} else
{
sn=0;
} else
{
- sn=
new eSocketNotifier
(eApp, handle, eSocketNotifier::Read);
+ sn=
eSocketNotifier::create
(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCShortDriver::keyPressed);
CONNECT(sn->activated, eRCShortDriver::keyPressed);
- eRCInput::getInstance()->setFile(handle);
}
}
}
}
@@
-89,8
+88,6
@@
eRCShortDriver::~eRCShortDriver()
{
if (handle>=0)
close(handle);
{
if (handle>=0)
close(handle);
- if (sn)
- delete sn;
}
void eRCInputEventDriver::keyPressed(int)
}
void eRCInputEventDriver::keyPressed(int)
@@
-102,7
+99,7
@@
void eRCInputEventDriver::keyPressed(int)
break;
if (enabled && !input->islocked())
for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i)
break;
if (enabled && !input->islocked())
for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i)
- (*i)->handleCode((
int
)&ev);
+ (*i)->handleCode((
long
)&ev);
}
}
}
}
@@
-115,9
+112,8
@@
eRCInputEventDriver::eRCInputEventDriver(const char *filename): eRCDriver(eRCInp
sn=0;
} else
{
sn=0;
} else
{
- sn=
new eSocketNotifier
(eApp, handle, eSocketNotifier::Read);
+ sn=
eSocketNotifier::create
(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCInputEventDriver::keyPressed);
CONNECT(sn->activated, eRCInputEventDriver::keyPressed);
- eRCInput::getInstance()->setFile(handle);
}
}
}
}
@@
-129,12
+125,20
@@
std::string eRCInputEventDriver::getDeviceName()
return name;
}
return name;
}
+void eRCInputEventDriver::setExclusive(bool b)
+{
+ if (handle >= 0)
+ {
+ int grab = b;
+ if (::ioctl(handle, EVIOCGRAB, grab) < 0)
+ perror("EVIOCGRAB");
+ }
+}
+
eRCInputEventDriver::~eRCInputEventDriver()
{
if (handle>=0)
close(handle);
eRCInputEventDriver::~eRCInputEventDriver()
{
if (handle>=0)
close(handle);
- if (sn)
- delete sn;
}
eRCConfig::eRCConfig()
}
eRCConfig::eRCConfig()
@@
-169,9
+173,8
@@
eRCInput::eRCInput()
{
ASSERT( !instance);
instance=this;
{
ASSERT( !instance);
instance=this;
- handle = -1;
locked = 0;
locked = 0;
- keyboardMode = km
All
;
+ keyboardMode = km
None
;
}
eRCInput::~eRCInput()
}
eRCInput::~eRCInput()
@@
-187,21
+190,18
@@
bool eRCInput::open()
return false;
}
return false;
}
-
int
eRCInput::lock()
+
void
eRCInput::lock()
{
locked=1;
{
locked=1;
- return handle;
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ i->second->setExclusive(false);
}
void eRCInput::unlock()
{
}
void eRCInput::unlock()
{
- if (locked)
- locked=0;
-}
-
-void eRCInput::setFile(int newh)
-{
- handle=newh;
+ locked=0;
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ i->second->setExclusive(true);
}
void eRCInput::addDevice(const std::string &id, eRCDevice *dev)
}
void eRCInput::addDevice(const std::string &id, eRCDevice *dev)
@@
-220,7
+220,7
@@
eRCDevice *eRCInput::getDevice(const std::string &id)
if (i == devices.end())
{
eDebug("failed, possible choices are:");
if (i == devices.end())
{
eDebug("failed, possible choices are:");
- for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
eDebug("%s", i->first.c_str());
return 0;
}
eDebug("%s", i->first.c_str());
return 0;
}