aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-09-25 08:29:35 -0400
committerDrew DeVault <sir@cmpwn.com>2017-09-25 08:29:51 -0400
commitf4387b437f6fc9dce864f5aa639bf1f5ddd98043 (patch)
tree28a81b62a662ac53837946c4ab05cc5cb4a3c5b8 /examples
parent61e451ea1b36435341d02ae34548bd0ea3abdd57 (diff)
parent2330a6864373206a1359ec88bad2a8a714205e71 (diff)
Merge branch 'master' into rootston
Diffstat (limited to 'examples')
-rw-r--r--examples/compositor.c12
-rw-r--r--examples/output-layout.c3
-rw-r--r--examples/rotation.c3
-rw-r--r--examples/shared.c3
-rw-r--r--examples/shared.h2
5 files changed, 18 insertions, 5 deletions
diff --git a/examples/compositor.c b/examples/compositor.c
index f4377f23..8c1f9b09 100644
--- a/examples/compositor.c
+++ b/examples/compositor.c
@@ -121,6 +121,15 @@ static void example_set_focused_surface(struct sample_state *sample,
}
}
+ if (surface) {
+ // TODO: send array of currently pressed keys
+ struct wl_array keys;
+ wl_array_init(&keys);
+ wlr_seat_keyboard_enter(sample->wl_seat, surface->surface, keys);
+ } else {
+ wlr_seat_keyboard_clear_focus(sample->wl_seat);
+ }
+
sample->focused_surface = surface;
}
@@ -325,7 +334,8 @@ static void handle_output_frame(struct output_state *output,
}
static void handle_keyboard_key(struct keyboard_state *keyboard,
- uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
+ uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
+ uint64_t time_usec) {
struct compositor_state *state = keyboard->compositor;
struct sample_state *sample = state->data;
if (sym == XKB_KEY_Super_L || sym == XKB_KEY_Super_R) {
diff --git a/examples/output-layout.c b/examples/output-layout.c
index 759bf048..560a7113 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -157,7 +157,8 @@ static void update_velocities(struct compositor_state *state,
}
static void handle_keyboard_key(struct keyboard_state *kbstate,
- uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
+ uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
+ uint64_t time_usec) {
// NOTE: It may be better to simply refer to our key state during each frame
// and make this change in pixels/sec^2
// Also, key repeat
diff --git a/examples/rotation.c b/examples/rotation.c
index 4f8c7b45..d7892723 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -99,7 +99,8 @@ static void update_velocities(struct compositor_state *state,
}
static void handle_keyboard_key(struct keyboard_state *kbstate,
- uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
+ uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
+ uint64_t time_usec) {
// NOTE: It may be better to simply refer to our key state during each frame
// and make this change in pixels/sec^2
// Also, key repeat
diff --git a/examples/shared.c b/examples/shared.c
index 5814a20c..3fa7cd05 100644
--- a/examples/shared.c
+++ b/examples/shared.c
@@ -48,7 +48,8 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
key_state == WLR_KEY_PRESSED ? "pressed" : "released");
}
if (kbstate->compositor->keyboard_key_cb) {
- kbstate->compositor->keyboard_key_cb(kbstate, event->keycode, sym, key_state);
+ kbstate->compositor->keyboard_key_cb(kbstate, event->keycode, sym,
+ key_state, event->time_usec);
}
if (sym == XKB_KEY_Escape) {
wl_display_terminate(kbstate->compositor->display);
diff --git a/examples/shared.h b/examples/shared.h
index 7cf4db63..f564bffa 100644
--- a/examples/shared.h
+++ b/examples/shared.h
@@ -87,7 +87,7 @@ struct compositor_state {
struct output_state *s);
void (*keyboard_remove_cb)(struct keyboard_state *s);
void (*keyboard_key_cb)(struct keyboard_state *s, uint32_t keycode,
- xkb_keysym_t sym, enum wlr_key_state key_state);
+ xkb_keysym_t sym, enum wlr_key_state key_state, uint64_t time_usec);
void (*pointer_motion_cb)(struct pointer_state *s,
double d_x, double d_y);
void (*pointer_motion_absolute_cb)(struct pointer_state *s,