Use libxkbcommon #defines for modifiers

dev
Kristian Høgsberg 14 years ago
parent 58eec36f68
commit 23c03ad981
  1. 16
      clients/terminal.c
  2. 2
      clients/window.c
  3. 9
      clients/window.h

@ -273,9 +273,9 @@ function_key_response(char escape, int num, uint32_t modifiers,
int mod_num = 0;
int len;
if (modifiers & WINDOW_MODIFIER_SHIFT) mod_num |= 1;
if (modifiers & WINDOW_MODIFIER_ALT) mod_num |= 2;
if (modifiers & WINDOW_MODIFIER_CONTROL) mod_num |= 4;
if (modifiers & XKB_COMMON_SHIFT_MASK) mod_num |= 1;
if (modifiers & XKB_COMMON_MOD1_MASK) mod_num |= 2;
if (modifiers & XKB_COMMON_CONTROL_MASK) mod_num |= 4;
if (mod_num != 0)
len = snprintf(response, MAX_RESPONSE, "\e[%d;%d%c",
@ -1969,8 +1969,8 @@ key_handler(struct window *window, struct input *input, uint32_t time,
int len = 0;
modifiers = input_get_modifiers(input);
if ((modifiers & WINDOW_MODIFIER_CONTROL) &&
(modifiers & WINDOW_MODIFIER_SHIFT) &&
if ((modifiers & XKB_COMMON_CONTROL_MASK) &&
(modifiers & XKB_COMMON_SHIFT_MASK) &&
state && handle_bound_key(terminal, input, sym, 0))
return;
@ -2065,7 +2065,7 @@ key_handler(struct window *window, struct input *input, uint32_t time,
len = apply_key_map(terminal->key_mode, sym, modifiers, ch);
if (len != 0) break;
if (modifiers & WINDOW_MODIFIER_CONTROL) {
if (modifiers & XKB_COMMON_CONTROL_MASK) {
if (sym >= '3' && sym <= '7')
sym = (sym & 0x1f) + 8;
@ -2076,10 +2076,10 @@ key_handler(struct window *window, struct input *input, uint32_t time,
else if (sym == '/') sym = 0x1F;
else if (sym == '8' || sym == '?') sym = 0x7F;
} else if ((terminal->mode & MODE_ALT_SENDS_ESC) &&
(modifiers & WINDOW_MODIFIER_ALT))
(modifiers & XKB_COMMON_MOD1_MASK))
{
ch[len++] = 0x1b;
} else if (modifiers & WINDOW_MODIFIER_ALT) {
} else if (modifiers & XKB_COMMON_MOD1_MASK) {
sym = sym | 0x80;
}

@ -911,7 +911,7 @@ window_handle_key(void *data, struct wl_input_device *input_device,
return;
level = 0;
if (input->modifiers & WINDOW_MODIFIER_SHIFT &&
if (input->modifiers & XKB_COMMON_SHIFT_MASK &&
XkbKeyGroupWidth(d->xkb, code, 0) > 1)
level = 1;

@ -23,6 +23,7 @@
#ifndef _WINDOW_H_
#define _WINDOW_H_
#include <X11/extensions/XKBcommon.h>
#include <glib.h>
#include <wayland-client.h>
@ -85,14 +86,6 @@ display_flush_cairo_device(struct display *display);
void
display_run(struct display *d);
enum {
WINDOW_MODIFIER_SHIFT = 0x01,
WINDOW_MODIFIER_LOCK = 0x02,
WINDOW_MODIFIER_CONTROL = 0x04,
WINDOW_MODIFIER_ALT = 0x08,
WINDOW_MODIFIER_MOD2 = 0x10,
};
enum pointer_type {
POINTER_BOTTOM_LEFT,
POINTER_BOTTOM_RIGHT,

Loading…
Cancel
Save