src/core/linux/SDL_evdev_kbd.c
changeset 12375 d9a16c76d8d1
parent 12284 fe9bafcd47ba
child 12503 806492103856
     1.1 --- a/src/core/linux/SDL_evdev_kbd.c	Wed Oct 31 10:18:05 2018 -0700
     1.2 +++ b/src/core/linux/SDL_evdev_kbd.c	Wed Oct 31 15:01:20 2018 -0700
     1.3 @@ -510,17 +510,19 @@
     1.4  
     1.5  static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
     1.6  {
     1.7 -    return ((kbd->ledflagstate >> flag) & 1);
     1.8 +    return (kbd->ledflagstate & flag) != 0;
     1.9  }
    1.10  
    1.11  static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
    1.12  {
    1.13 -    kbd->ledflagstate |= 1 << flag;
    1.14 +    kbd->ledflagstate |= flag;
    1.15 +    ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
    1.16  }
    1.17  
    1.18  static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
    1.19  {
    1.20 -    kbd->ledflagstate &= ~(1 << flag);
    1.21 +    kbd->ledflagstate &= ~flag;
    1.22 +    ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
    1.23  }
    1.24  
    1.25  static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag)
    1.26 @@ -535,7 +537,8 @@
    1.27  
    1.28  static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag)
    1.29  {
    1.30 -    kbd->ledflagstate ^= 1 << flag;
    1.31 +    kbd->ledflagstate ^= flag;
    1.32 +    ioctl(kbd->console_fd, KDSETLED, (unsigned long)(kbd->ledflagstate));
    1.33  }
    1.34  
    1.35  /*