Browse Source

support ISO_Level5_Shift (Thanks roland)

master
Michael Stapelberg 13 years ago
parent
commit
2dd03ce7db
  1. 17
      i3lock.c

17
i3lock.c

@ -55,6 +55,7 @@ static int input_position = 0;
static char password[512]; static char password[512];
static bool modeswitch_active = false; static bool modeswitch_active = false;
static bool iso_level3_shift_active = false; static bool iso_level3_shift_active = false;
static bool iso_level5_shift_active = false;
static int modeswitchmask; static int modeswitchmask;
static int numlockmask; static int numlockmask;
static bool beep = false; static bool beep = false;
@ -364,8 +365,8 @@ static void input_done() {
* *
*/ */
static void handle_key_release(xcb_key_release_event_t *event) { static void handle_key_release(xcb_key_release_event_t *event) {
DEBUG("releasing key %d, state raw = %d, modeswitch_active = %d, iso_level3_shift_active = %d\n", DEBUG("releasing key %d, state raw = %d, modeswitch_active = %d, iso_level3_shift_active = %d, iso_level5_shift_active = %d\n",
event->detail, event->state, modeswitch_active, iso_level3_shift_active); event->detail, event->state, modeswitch_active, iso_level3_shift_active, iso_level5_shift_active);
/* We don’t care about the column here and just use the first symbol. Since /* We don’t care about the column here and just use the first symbol. Since
* we only check for Mode_switch and ISO_Level3_Shift, this *should* work. * we only check for Mode_switch and ISO_Level3_Shift, this *should* work.
@ -377,9 +378,11 @@ static void handle_key_release(xcb_key_release_event_t *event) {
modeswitch_active = false; modeswitch_active = false;
} else if (sym == XK_ISO_Level3_Shift) { } else if (sym == XK_ISO_Level3_Shift) {
iso_level3_shift_active = false; iso_level3_shift_active = false;
} else if (sym == XK_ISO_Level5_Shift) {
iso_level5_shift_active = false;
} }
DEBUG("release done. modeswitch_active = %d, iso_level3_shift_active = %d\n", DEBUG("release done. modeswitch_active = %d, iso_level3_shift_active = %d, iso_level5_shift_active = %d\n",
modeswitch_active, iso_level3_shift_active); modeswitch_active, iso_level3_shift_active, iso_level5_shift_active);
} }
static void redraw_timeout(EV_P_ ev_timer *w, int revents) { static void redraw_timeout(EV_P_ ev_timer *w, int revents) {
@ -433,6 +436,8 @@ static void handle_key_press(xcb_key_press_event_t *event) {
base_column = 2; base_column = 2;
if (iso_level3_shift_active) if (iso_level3_shift_active)
base_column = 4; base_column = 4;
if (iso_level5_shift_active)
base_column = 6;
sym0 = xcb_key_press_lookup_keysym(symbols, event, base_column); sym0 = xcb_key_press_lookup_keysym(symbols, event, base_column);
sym1 = xcb_key_press_lookup_keysym(symbols, event, base_column + 1); sym1 = xcb_key_press_lookup_keysym(symbols, event, base_column + 1);
switch (sym0) { switch (sym0) {
@ -444,6 +449,10 @@ static void handle_key_press(xcb_key_press_event_t *event) {
DEBUG("ISO_Level3_Shift enabled\n"); DEBUG("ISO_Level3_Shift enabled\n");
iso_level3_shift_active = true; iso_level3_shift_active = true;
return; return;
case XK_ISO_Level5_Shift:
DEBUG("ISO_Level5_Shift enabled\n");
iso_level5_shift_active = true;
return;
case XK_Return: case XK_Return:
case XK_KP_Enter: case XK_KP_Enter:
input_done(); input_done();

Loading…
Cancel
Save