Only grab left alt, to allow altgr+z to be used for keyboard that type ż with it

This commit is contained in:
dec05eba
2025-01-05 03:22:38 +01:00
parent 52ce22ae22
commit fa5b7a0c75
6 changed files with 29 additions and 19 deletions

View File

@@ -165,7 +165,8 @@ static void keyboard_event_process_input_event_data(keyboard_event *self, event_
default: {
const bool shift_pressed = self->lshift_button_state == KEYBOARD_BUTTON_PRESSED || self->rshift_button_state == KEYBOARD_BUTTON_PRESSED;
const bool ctrl_pressed = self->lctrl_button_state == KEYBOARD_BUTTON_PRESSED || self->rctrl_button_state == KEYBOARD_BUTTON_PRESSED;
const bool alt_pressed = self->lalt_button_state == KEYBOARD_BUTTON_PRESSED || self->ralt_button_state == KEYBOARD_BUTTON_PRESSED;
const bool lalt_pressed = self->lalt_button_state == KEYBOARD_BUTTON_PRESSED;
const bool ralt_pressed = self->ralt_button_state == KEYBOARD_BUTTON_PRESSED;
const bool meta_pressed = self->lmeta_button_state == KEYBOARD_BUTTON_PRESSED || self->rmeta_button_state == KEYBOARD_BUTTON_PRESSED;
//fprintf(stderr, "pressed key: %d, state: %d, shift: %s, ctrl: %s, alt: %s, meta: %s\n", event.code, event.value,
// shift_pressed ? "yes" : "no", ctrl_pressed ? "yes" : "no", alt_pressed ? "yes" : "no", meta_pressed ? "yes" : "no");
@@ -174,8 +175,10 @@ static void keyboard_event_process_input_event_data(keyboard_event *self, event_
modifiers |= KEYBOARD_MODKEY_SHIFT;
if(ctrl_pressed)
modifiers |= KEYBOARD_MODKEY_CTRL;
if(alt_pressed)
modifiers |= KEYBOARD_MODKEY_ALT;
if(lalt_pressed)
modifiers |= KEYBOARD_MODKEY_LALT;
if(ralt_pressed)
modifiers |= KEYBOARD_MODKEY_RALT;
if(meta_pressed)
modifiers |= KEYBOARD_MODKEY_SUPER;

View File

@@ -18,10 +18,11 @@
#define MAX_EVENT_POLLS 32
typedef enum {
KEYBOARD_MODKEY_ALT = 1 << 0,
KEYBOARD_MODKEY_SUPER = 1 << 1,
KEYBOARD_MODKEY_CTRL = 1 << 2,
KEYBOARD_MODKEY_SHIFT = 1 << 3
KEYBOARD_MODKEY_LALT = 1 << 0,
KEYBOARD_MODKEY_RALT = 1 << 2,
KEYBOARD_MODKEY_SUPER = 1 << 3,
KEYBOARD_MODKEY_CTRL = 1 << 4,
KEYBOARD_MODKEY_SHIFT = 1 << 5
} keyboard_modkeys;
typedef enum {

View File

@@ -16,12 +16,12 @@ typedef struct {
#define NUM_GLOBAL_HOTKEYS 6
static global_hotkey global_hotkeys[NUM_GLOBAL_HOTKEYS] = {
{ .key = KEY_Z, .modifiers = KEYBOARD_MODKEY_ALT, .action = "show_hide" },
{ .key = KEY_F9, .modifiers = KEYBOARD_MODKEY_ALT, .action = "record" },
{ .key = KEY_F7, .modifiers = KEYBOARD_MODKEY_ALT, .action = "pause" },
{ .key = KEY_F8, .modifiers = KEYBOARD_MODKEY_ALT, .action = "stream" },
{ .key = KEY_F10, .modifiers = KEYBOARD_MODKEY_ALT | KEYBOARD_MODKEY_SHIFT, .action = "replay_start" },
{ .key = KEY_F10, .modifiers = KEYBOARD_MODKEY_ALT, .action = "replay_save" }
{ .key = KEY_Z, .modifiers = KEYBOARD_MODKEY_LALT, .action = "show_hide" },
{ .key = KEY_F9, .modifiers = KEYBOARD_MODKEY_LALT, .action = "record" },
{ .key = KEY_F7, .modifiers = KEYBOARD_MODKEY_LALT, .action = "pause" },
{ .key = KEY_F8, .modifiers = KEYBOARD_MODKEY_LALT, .action = "stream" },
{ .key = KEY_F10, .modifiers = KEYBOARD_MODKEY_LALT | KEYBOARD_MODKEY_SHIFT, .action = "replay_start" },
{ .key = KEY_F10, .modifiers = KEYBOARD_MODKEY_LALT, .action = "replay_save" }
};
static bool on_key_callback(uint32_t key, uint32_t modifiers, int press_status, void *userdata) {

View File

@@ -50,6 +50,7 @@ static void usage(void) {
printf(" toggle-stream Start/stop streaming.\n");
printf(" toggle-replay Start/stop replay.\n");
printf(" replay-save Save replay.\n");
printf("\n");
printf("EXAMPLES:\n");
printf(" gsr-ui-cli toggle-show\n");
printf(" gsr-ui-cli toggle-record\n");