aboutsummaryrefslogtreecommitdiff
path: root/platform/linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux.c')
-rw-r--r--platform/linux.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/platform/linux.c b/platform/linux.c
index 6793abc..78e74aa 100644
--- a/platform/linux.c
+++ b/platform/linux.c
@@ -58,17 +58,17 @@ void sound_play(unsigned char *buffer, unsigned int buffer_len)
return;
}
}
-
+
/* -1 means not-in-use channel */
Mix_PlayChannel(-1, loaded_chunk, 0);
}
-/*
+/*
* Uses XInput2 extensions to hook into the keyboard.
* Noticed this was possible when I used:
* $ xinput test-xi2 --root
* Resources used:
- * - https://github.com/freedesktop/xorg-xinput/blob/master/src/test_xi2.c
+ * - https://github.com/freedesktop/xorg-xinput/blob/master/src/test_xi2.c
* - https://cgit.freedesktop.org/xorg/proto/inputproto/commit/?id=f4f09d40e0fd94d267b280f2a82385dca1141347
*/
bool keyboard_hook(void)
@@ -84,7 +84,8 @@ bool keyboard_hook(void)
Window root_window = DefaultRootWindow(display);
int xi_event, xi_error;
- if (!XQueryExtension(display, "XInputExtension", &xi_opcode, &xi_event, &xi_error)) {
+ if (!XQueryExtension(display, "XInputExtension",
+ &xi_opcode, &xi_event, &xi_error)) {
printf("ERROR: Could not find XInputExtension.\n");
return false;
}
@@ -95,7 +96,7 @@ bool keyboard_hook(void)
XISetMask(mask, XI_RawKeyRelease);
XIEventMask event_mask = {
.deviceid = XIAllMasterDevices,
- .mask_len = sizeof(mask)/sizeof(mask[0]),
+ .mask_len = sizeof(mask) / sizeof(mask[0]),
.mask = mask,
};
XISelectEvents(display, root_window, &event_mask, 1);
@@ -123,7 +124,9 @@ void enter_idle(void)
while (running) {
XNextEvent(display, (XEvent *) &event);
/* XGenEventData fails if it isn't a XGenericEventCookie anyway */
- if (XGetEventData(display, &event) && event.type == GenericEvent && event.extension == xi_opcode) {
+ if (XGetEventData(display, &event)
+ && event.type == GenericEvent
+ && event.extension == xi_opcode) {
/* char *ur = event.evtype == XI_RawKeyPress ? "press" : "release"; */
/* unsigned int kc = ((XIDeviceEvent *) event.data)->detail; */
@@ -151,7 +154,7 @@ struct board *load_board(char *board_name)
printf("ERROR: Could not load board module.\n");
return false;
}
- // HACK: Cast to void function ptr then cast back, otherwise types are incompatible to the compiler.
+
fn_board_init board_init = dlsym(board_module, "board_init");
if (board_init == NULL) {
printf("ERROR: No board initialisation function could be loaded.\n");