Fixed whitespace in SDL_evdev.c
authorSam Lantinga <slouken@libsdl.org>
Wed, 24 Jun 2015 17:55:38 -0700
changeset 97807f9b74280df6
parent 9779 49b5a975a238
child 9781 02273530b7bf
Fixed whitespace in SDL_evdev.c
src/core/linux/SDL_evdev.c
     1.1 --- a/src/core/linux/SDL_evdev.c	Wed Jun 24 17:54:39 2015 -0700
     1.2 +++ b/src/core/linux/SDL_evdev.c	Wed Jun 24 17:55:38 2015 -0700
     1.3 @@ -364,7 +364,7 @@
     1.4      
     1.5      /* Try a few consoles to see which one we have read access to */
     1.6      
     1.7 -    for( i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
     1.8 +    for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) {
     1.9          fd = open(EVDEV_consoles[i], O_RDONLY);
    1.10          if (fd >= 0) {
    1.11              if (IS_CONSOLE(fd)) return fd;
    1.12 @@ -374,7 +374,7 @@
    1.13      
    1.14      /* Try stdin, stdout, stderr */
    1.15      
    1.16 -    for( fd = 0; fd < 3; fd++) {
    1.17 +    for(fd = 0; fd < 3; fd++) {
    1.18          if (IS_CONSOLE(fd)) return fd;
    1.19      }
    1.20      
    1.21 @@ -468,7 +468,7 @@
    1.22          }
    1.23  
    1.24          /* Set up the udev callback */
    1.25 -        if ( SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
    1.26 +        if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) {
    1.27              SDL_EVDEV_Quit();
    1.28              return -1;
    1.29          }
    1.30 @@ -614,7 +614,7 @@
    1.31                      if (scan_code != SDL_SCANCODE_UNKNOWN) {
    1.32                          if (events[i].value == 0) {
    1.33                              SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
    1.34 -                        } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */ ) {
    1.35 +                        } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */) {
    1.36                              SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
    1.37  #ifdef SDL_INPUT_LINUXKD
    1.38                              if (_this->console_fd >= 0) {
    1.39 @@ -625,12 +625,12 @@
    1.40                                  kbe.kb_table = 0;
    1.41                                  
    1.42                                  /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */
    1.43 -                                kbe.kb_table |= -( (modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
    1.44 -                                kbe.kb_table |= -( (modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
    1.45 -                                kbe.kb_table |= -( (modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
    1.46 -                                kbe.kb_table |= -( (modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
    1.47 -                                kbe.kb_table |= -( (modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
    1.48 -                                kbe.kb_table |= -( (modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
    1.49 +                                kbe.kb_table |= -((modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
    1.50 +                                kbe.kb_table |= -((modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
    1.51 +                                kbe.kb_table |= -((modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
    1.52 +                                kbe.kb_table |= -((modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
    1.53 +                                kbe.kb_table |= -((modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
    1.54 +                                kbe.kb_table |= -((modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
    1.55  
    1.56                                  if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && 
    1.57                                      ((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER))) 
    1.58 @@ -641,8 +641,8 @@
    1.59                                       * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table 
    1.60                                       * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale!
    1.61                                       */
    1.62 -                                    if ( modstate & KMOD_CAPS && isalpha(kval) ) {
    1.63 -                                        if ( isupper(kval) ) {
    1.64 +                                    if (modstate & KMOD_CAPS && isalpha(kval)) {
    1.65 +                                        if (isupper(kval)) {
    1.66                                              kval = tolower(kval);
    1.67                                          } else {
    1.68                                              kval = toupper(kval);
    1.69 @@ -650,7 +650,7 @@
    1.70                                      }
    1.71                                       
    1.72                                      /* Convert to UTF-8 and send */
    1.73 -                                    end = SDL_UCS4ToUTF8( kval, keysym);
    1.74 +                                    end = SDL_UCS4ToUTF8(kval, keysym);
    1.75                                      *end = '\0';
    1.76                                      SDL_SendKeyboardText(keysym);
    1.77                                  }
    1.78 @@ -732,7 +732,7 @@
    1.79  
    1.80      /* Check to make sure it's not already in list. */
    1.81      for (item = _this->first; item != NULL; item = item->next) {
    1.82 -        if (strcmp(devpath, item->path) == 0) {
    1.83 +        if (SDL_strcmp(devpath, item->path) == 0) {
    1.84              return -1;  /* already have this one */
    1.85          }
    1.86      }
    1.87 @@ -779,7 +779,7 @@
    1.88  
    1.89      for (item = _this->first; item != NULL; item = item->next) {
    1.90          /* found it, remove it. */
    1.91 -        if ( strcmp(devpath, item->path) ==0 ) {
    1.92 +        if (SDL_strcmp(devpath, item->path) == 0) {
    1.93              if (prev != NULL) {
    1.94                  prev->next = item->next;
    1.95              } else {