[WIP] Add front buttons handling
This commit is contained in:
parent
c7fd12ca4c
commit
39b47de235
17
src/main.c
17
src/main.c
|
@ -76,11 +76,12 @@ init_input(void) {
|
||||||
in.kbd_fd = -1;
|
in.kbd_fd = -1;
|
||||||
in.mouse_fd = -1;
|
in.mouse_fd = -1;
|
||||||
|
|
||||||
in.kbd_fd = open(KBD_PATH, O_RDONLY | O_NONBLOCK);
|
// in.kbd_fd = open(KBD_PATH, O_RDONLY | O_NONBLOCK);
|
||||||
|
in.kbd_fd = open("/dev/input/event0", O_RDONLY | O_NONBLOCK);
|
||||||
if (in.kbd_fd == -1) {
|
if (in.kbd_fd == -1) {
|
||||||
// NOTE: Some applications may not require a keyboard so this is
|
// NOTE: Some applications may not require a keyboard so this is
|
||||||
// optional, but we are still displaying an error.
|
// optional, but we are still displaying an error.
|
||||||
// fprintf(stderr, "error: couldn't open keyboard %s: %s.\n", KBD_PATH, strerror(errno));
|
fprintf(stderr, "error: couldn't open keyboard %s: %s.\n", KBD_PATH, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
// in.mouse_fd = open(MOUSE_PATH, O_RDONLY | O_NONBLOCK);
|
// in.mouse_fd = open(MOUSE_PATH, O_RDONLY | O_NONBLOCK);
|
||||||
|
@ -158,7 +159,7 @@ poll_mouse(void) {
|
||||||
|
|
||||||
void
|
void
|
||||||
poll_input(void) {
|
poll_input(void) {
|
||||||
// poll_keyboard();
|
poll_keyboard();
|
||||||
poll_mouse();
|
poll_mouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +290,16 @@ handle_keyboard(void) {
|
||||||
case KEY_RIGHT: { rune = 0x80; } break;
|
case KEY_RIGHT: { rune = 0x80; } break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Nook overrides.
|
||||||
|
switch (key_code) {
|
||||||
|
case 156: { rune = 0x40; } break; // top left
|
||||||
|
case 139: { rune = 0x40; } break; // bottom left
|
||||||
|
case 151: { rune = 0x80; } break; // top right
|
||||||
|
case 158: { rune = 0x80; } break; // bottom right
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
if (rune) {
|
if (rune) {
|
||||||
controller_now |= rune;
|
controller_now |= rune;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue