diff options
author | nerdopolis <bluescreen_avenger@verizon.net> | 2023-12-07 17:25:58 -0500 |
---|---|---|
committer | nerdopolis <bluescreen_avenger@verizon.net> | 2023-12-09 10:12:31 -0500 |
commit | 7215ab126958368020c768d6c1c58af986556fec (patch) | |
tree | 54f7300231cdad3889c14f66f0b5a935329ed0b0 | |
parent | 6f2c70c9e10d60e5d73991388da014a30376c876 (diff) |
ply-input-device: Handle the keyboard sequence to change VTs
-rw-r--r-- | src/libply-splash-core/ply-input-device.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libply-splash-core/ply-input-device.c b/src/libply-splash-core/ply-input-device.c index 02506090..81a0b7e5 100644 --- a/src/libply-splash-core/ply-input-device.c +++ b/src/libply-splash-core/ply-input-device.c @@ -36,6 +36,7 @@ #include "ply-input-device.h" #include "ply-list.h" #include "ply-logger.h" +#include "ply-terminal.h" #include "ply-trigger.h" #include "ply-utils.h" @@ -62,6 +63,7 @@ struct _ply_input_device struct libevdev *dev; + uint32_t kernel_has_vts : 1; uint32_t leds_state_invalid : 1; }; @@ -149,6 +151,17 @@ apply_key_to_input_buffer (ply_input_device_t *input_device, assert (character_size + 1 == sizeof(character_buf)); ply_buffer_append_bytes (input_buffer, character_buf, character_size); + } else { + xkb_keysym_t keysym; + + if (!input_device->kernel_has_vts) + break; + + keysym = xkb_state_key_get_one_sym (input_device->keyboard_state, keycode); + if (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12) { + int vt_number = keysym - XKB_KEY_XF86Switch_VT_1 + 1; + ply_change_to_vt (vt_number); + } } break; } @@ -339,6 +352,8 @@ ply_input_device_open (struct xkb_context *xkb_context, if (input_device->compose_table) input_device->compose_state = xkb_compose_state_new (input_device->compose_table, XKB_COMPOSE_STATE_NO_FLAGS); + input_device->kernel_has_vts = ply_character_device_exists ("/dev/tty0"); + return input_device; error: |