Fixed whitespace in SDL_evdev.c

This commit is contained in:
Sam Lantinga 2015-06-24 17:55:38 -07:00
parent 9f50d63dd5
commit 82eec4b630
1 changed files with 15 additions and 15 deletions

View File

@ -364,7 +364,7 @@ static int SDL_EVDEV_get_console_fd(void)
/* Try a few consoles to see which one we have read access to */ /* Try a few consoles to see which one we have read access to */
for( i = 0; i < SDL_arraysize(EVDEV_consoles); i++) { for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
fd = open(EVDEV_consoles[i], O_RDONLY); fd = open(EVDEV_consoles[i], O_RDONLY);
if (fd >= 0) { if (fd >= 0) {
if (IS_CONSOLE(fd)) return fd; if (IS_CONSOLE(fd)) return fd;
@ -374,7 +374,7 @@ static int SDL_EVDEV_get_console_fd(void)
/* Try stdin, stdout, stderr */ /* Try stdin, stdout, stderr */
for( fd = 0; fd < 3; fd++) { for(fd = 0; fd < 3; fd++) {
if (IS_CONSOLE(fd)) return fd; if (IS_CONSOLE(fd)) return fd;
} }
@ -468,7 +468,7 @@ SDL_EVDEV_Init(void)
} }
/* Set up the udev callback */ /* Set up the udev callback */
if ( SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) { if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
SDL_EVDEV_Quit(); SDL_EVDEV_Quit();
return -1; return -1;
} }
@ -614,7 +614,7 @@ SDL_EVDEV_Poll(void)
if (scan_code != SDL_SCANCODE_UNKNOWN) { if (scan_code != SDL_SCANCODE_UNKNOWN) {
if (events[i].value == 0) { if (events[i].value == 0) {
SDL_SendKeyboardKey(SDL_RELEASED, scan_code); SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
} else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */ ) { } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */) {
SDL_SendKeyboardKey(SDL_PRESSED, scan_code); SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
#ifdef SDL_INPUT_LINUXKD #ifdef SDL_INPUT_LINUXKD
if (_this->console_fd >= 0) { if (_this->console_fd >= 0) {
@ -625,12 +625,12 @@ SDL_EVDEV_Poll(void)
kbe.kb_table = 0; kbe.kb_table = 0;
/* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */ /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */
kbe.kb_table |= -( (modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL); kbe.kb_table |= -((modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
kbe.kb_table |= -( (modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL); kbe.kb_table |= -((modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
kbe.kb_table |= -( (modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT); kbe.kb_table |= -((modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
kbe.kb_table |= -( (modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT); kbe.kb_table |= -((modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
kbe.kb_table |= -( (modstate & KMOD_LALT) != 0) & (1 << KG_ALT); kbe.kb_table |= -((modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
kbe.kb_table |= -( (modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR); kbe.kb_table |= -((modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 &&
((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER))) ((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER)))
@ -641,8 +641,8 @@ SDL_EVDEV_Poll(void)
* because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table
* So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale! * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale!
*/ */
if ( modstate & KMOD_CAPS && isalpha(kval) ) { if (modstate & KMOD_CAPS && isalpha(kval)) {
if ( isupper(kval) ) { if (isupper(kval)) {
kval = tolower(kval); kval = tolower(kval);
} else { } else {
kval = toupper(kval); kval = toupper(kval);
@ -650,7 +650,7 @@ SDL_EVDEV_Poll(void)
} }
/* Convert to UTF-8 and send */ /* Convert to UTF-8 and send */
end = SDL_UCS4ToUTF8( kval, keysym); end = SDL_UCS4ToUTF8(kval, keysym);
*end = '\0'; *end = '\0';
SDL_SendKeyboardText(keysym); SDL_SendKeyboardText(keysym);
} }
@ -732,7 +732,7 @@ SDL_EVDEV_device_added(const char *devpath)
/* Check to make sure it's not already in list. */ /* Check to make sure it's not already in list. */
for (item = _this->first; item != NULL; item = item->next) { for (item = _this->first; item != NULL; item = item->next) {
if (strcmp(devpath, item->path) == 0) { if (SDL_strcmp(devpath, item->path) == 0) {
return -1; /* already have this one */ return -1; /* already have this one */
} }
} }
@ -779,7 +779,7 @@ SDL_EVDEV_device_removed(const char *devpath)
for (item = _this->first; item != NULL; item = item->next) { for (item = _this->first; item != NULL; item = item->next) {
/* found it, remove it. */ /* found it, remove it. */
if ( strcmp(devpath, item->path) ==0 ) { if (SDL_strcmp(devpath, item->path) == 0) {
if (prev != NULL) { if (prev != NULL) {
prev->next = item->next; prev->next = item->next;
} else { } else {