Added JS_ key name
This commit is contained in:
parent
0b28737416
commit
ff0ff55f01
2 changed files with 16 additions and 0 deletions
9
README
9
README
|
@ -257,6 +257,15 @@ multiple keycodes might break the mapping from keysym to evdev code.
|
||||||
When you try to let a gamepad key send a keyboard event you might run
|
When you try to let a gamepad key send a keyboard event you might run
|
||||||
into trouble with Xorg, for possible fixes see the section further down.
|
into trouble with Xorg, for possible fixes see the section further down.
|
||||||
|
|
||||||
|
For joystick buttons there is in addition to the BTN_JOYSTICK, BTN_X,
|
||||||
|
etc. macros the special name JS_$NUM, which sets the given button to
|
||||||
|
the $NUMS joystick button, i.e.:
|
||||||
|
|
||||||
|
% xboxdrv --ui-clear --ui-buttonmap A=JS_0,B=JS_1
|
||||||
|
|
||||||
|
Note that this will only work if no other joystick button ids are in
|
||||||
|
the way
|
||||||
|
|
||||||
In addition to just the event you can also pass additional
|
In addition to just the event you can also pass additional
|
||||||
configuration parameter seperated by colons, the exact parameter
|
configuration parameter seperated by colons, the exact parameter
|
||||||
differ on the type of event, everything but the first parameter is
|
differ on the type of event, everything but the first parameter is
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -683,6 +684,12 @@ bool str2event(const std::string& name, int& type, int& code)
|
||||||
code = xkeysym2keycode(name);
|
code = xkeysym2keycode(name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (name.compare(0, 2, "JS") == 0)
|
||||||
|
{
|
||||||
|
type = EV_KEY;
|
||||||
|
code = BTN_JOYSTICK + boost::lexical_cast<int>(name.substr(3));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (name.compare(0, 3, "KEY") == 0 ||
|
else if (name.compare(0, 3, "KEY") == 0 ||
|
||||||
name.compare(0, 3, "BTN") == 0)
|
name.compare(0, 3, "BTN") == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue