Pass input device and time in key_handler callback

Move the modifiers to a input device getter function.
dev
Kristian Høgsberg 14 years ago
parent 5029a13283
commit 67cac8a565
  1. 4
      clients/resizor.c
  2. 12
      clients/terminal.c
  3. 4
      clients/view.c
  4. 10
      clients/window.c
  5. 8
      clients/window.h

@ -128,8 +128,8 @@ keyboard_focus_handler(struct window *window,
} }
static void static void
key_handler(struct window *window, uint32_t key, uint32_t sym, key_handler(struct window *window, struct input *input, uint32_t time,
uint32_t state, uint32_t modifiers, void *data) uint32_t key, uint32_t sym, uint32_t state, void *data)
{ {
struct resizor *resizor = data; struct resizor *resizor = data;

@ -1872,13 +1872,21 @@ terminal_data(struct terminal *terminal, const char *data, size_t length)
} }
static void static void
key_handler(struct window *window, uint32_t key, uint32_t sym, static void
uint32_t state, uint32_t modifiers, void *data) key_handler(struct window *window, struct input *input, uint32_t time,
uint32_t key, uint32_t sym, uint32_t state, void *data)
{ {
struct terminal *terminal = data; struct terminal *terminal = data;
char ch[MAX_RESPONSE]; char ch[MAX_RESPONSE];
uint32_t modifiers;
int len = 0; int len = 0;
modifiers = input_get_modifiers(input);
if ((modifiers & WINDOW_MODIFIER_CONTROL) &&
(modifiers & WINDOW_MODIFIER_SHIFT) &&
state && handle_bound_key(terminal, input, sym, 0))
return;
switch (sym) { switch (sym) {
case XK_F11: case XK_F11:
if (!state) if (!state)

@ -110,8 +110,8 @@ redraw_handler(struct window *window, void *data)
} }
static void static void
key_handler(struct window *window, uint32_t key, uint32_t unicode, key_handler(struct window *window, struct input *input, uint32_t time,
uint32_t state, uint32_t modifiers, void *data) uint32_t key, uint32_t unicode, uint32_t state, void *data)
{ {
struct view *view = data; struct view *view = data;

@ -922,8 +922,8 @@ window_handle_key(void *data, struct wl_input_device *input_device,
input->modifiers &= ~d->xkb->map->modmap[code]; input->modifiers &= ~d->xkb->map->modmap[code];
if (window->key_handler) if (window->key_handler)
(*window->key_handler)(window, key, sym, state, (*window->key_handler)(window, input, time, key, sym, state,
input->modifiers, window->user_data); window->user_data);
} }
static void static void
@ -1014,6 +1014,12 @@ input_get_input_device(struct input *input)
return input->input_device; return input->input_device;
} }
uint32_t
input_get_modifiers(struct input *input)
{
return input->modifiers;
}
struct wl_drag * struct wl_drag *
window_create_drag(struct window *window) window_create_drag(struct window *window)
{ {

@ -110,8 +110,9 @@ typedef void (*window_resize_handler_t)(struct window *window,
void *data); void *data);
typedef void (*window_redraw_handler_t)(struct window *window, void *data); typedef void (*window_redraw_handler_t)(struct window *window, void *data);
typedef void (*window_frame_handler_t)(struct window *window, uint32_t frame, uint32_t timestamp, void *data); typedef void (*window_frame_handler_t)(struct window *window, uint32_t frame, uint32_t timestamp, void *data);
typedef void (*window_key_handler_t)(struct window *window, uint32_t key, uint32_t unicode, typedef void (*window_key_handler_t)(struct window *window, struct input *input,
uint32_t state, uint32_t modifiers, void *data); uint32_t time, uint32_t key, uint32_t unicode,
uint32_t state, void *data);
typedef void (*window_keyboard_focus_handler_t)(struct window *window, typedef void (*window_keyboard_focus_handler_t)(struct window *window,
struct input *device, void *data); struct input *device, void *data);
@ -236,6 +237,9 @@ window_activate_drag(struct wl_drag *drag, struct window *window,
void void
input_get_position(struct input *input, int32_t *x, int32_t *y); input_get_position(struct input *input, int32_t *x, int32_t *y);
uint32_t
input_get_modifiers(struct input *input);
struct wl_input_device * struct wl_input_device *
input_get_input_device(struct input *input); input_get_input_device(struct input *input);

Loading…
Cancel
Save