Cloudef / wlc

High-level Wayland compositor library
MIT License
330 stars 58 forks source link

tty switching when target tty is more than 12 #137

Closed ammen99 closed 8 years ago

ammen99 commented 8 years ago

I noticed that the code which handles tty switching is in compositor/seat/seat.c Currently wlc uses hard-coded codes for the tty switching. But I think there is something you maybe don't want - the if below (at compositor/seat/seat.c around line 118) would switch to a different tty even when I press ctrl-alt-kp_1-9(the keypad) for example, which sends the user to non-existing tty(black screen with blinking cursor). Maybe you can change it so that it checks for ev->key.code <= 71 which are only the keys f1-f12. I can send a pull request if you want me to do so. Relevant code:

if (seat->keyboard.modifiers.mods == (WLC_BIT_MOD_CTRL | WLC_BIT_MOD_ALT) && ev->key.code >= 59 && ev->key.code <= 88) {                                         
   const int vt = (ev->key.code - 59) + 1;                                                                                                                       
   if (ev->key.state == WL_KEYBOARD_KEY_STATE_PRESSED && wlc_tty_get_vt() != vt) {                                                                               
      struct wlc_activate_event aev = { .active = false, .vt = vt };                                                                                             
      wl_signal_emit(&wlc_system_signals()->activate, &aev);                                                                                                     }
Cloudef commented 8 years ago

Instead of key codes, we probably want to use the symbols here hmm..