Commit 59f62cb2 authored by Teemu Erkkola's avatar Teemu Erkkola

Fix nub click handling

parent 1f08fa73
......@@ -348,36 +348,25 @@ void handle(input_event const& e, unsigned int role) {
break;
case EV_KEY:
switch(e.code) {
case BTN_LEFT: // mouse click
case BTN_LEFT: // mouse click
if (role == ROLE_GPIO && global.settings.exportMouse) {
handleNubClick(global.settings.leftNubClickMode, e.value, global.mouse, global.gamepad, global.settings);
if (global.settings.exportGamepad) {
global.gamepad->send(EV_KEY, BTN_THUMBL, e.value);
global.gamepad->send(EV_SYN, 0, 0);
}
}
break;
case BTN_RIGHT:
case BTN_MIDDLE:
// TODO : configure this
if (role == ROLE_LEFT_NUB && global.settings.exportMouse)
global.mouse->device.send(EV_KEY, BTN_LEFT, e.value);
else if (role == ROLE_RIGHT_NUB && global.settings.exportMouse)
global.mouse->device.send(EV_KEY, BTN_RIGHT, e.value);
/*else
global.mouse->device.send(EV_KEY, e.code, e.value);*/
global.mouse->device.send(EV_SYN, 0, 0);
break;
case BTN_THUMBL:
case BTN_THUMBR:
if (role == ROLE_LEFT_NUB && global.settings.exportMouse) {
//std::cout << "left nub click\n";
handleNubClick(global.settings.leftNubClickMode, e.value, global.mouse, global.gamepad, global.settings);
if (global.settings.exportGamepad) {
global.gamepad->send(EV_KEY, BTN_THUMBL, e.value);
global.gamepad->send(EV_SYN, 0, 0);
}
} else if (role == ROLE_RIGHT_NUB && global.settings.exportMouse) {
//std::cout << "right nub click\n";
handleNubClick(global.settings.rightNubClickMode, e.value, global.mouse, global.gamepad, global.settings);
if (global.settings.exportGamepad) {
global.gamepad->send(EV_KEY, BTN_THUMBR, e.value);
global.gamepad->send(EV_SYN, 0, 0);
}
}
break;
if (role == ROLE_GPIO && global.settings.exportMouse) {
handleNubClick(global.settings.rightNubClickMode, e.value, global.mouse, global.gamepad, global.settings);
if (global.settings.exportGamepad) {
global.gamepad->send(EV_KEY, BTN_THUMBR, e.value);
global.gamepad->send(EV_SYN, 0, 0);
}
}
break;
default:
global.behaviors->handle(e.code, e.value);
global.keyboard->send(EV_SYN, 0, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment