aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-09 09:20:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-09 09:20:46 +0000
commit71584aed388935908588686e5df7ec42855f3698 (patch)
tree45f18ee6e99049470da32290ebf18d745d7619ce
parentmulti-seat: improve handling of multiple (mouse) pointers (diff)
seat: use separate 'enter' serials for keyboard and mouse
-rw-r--r--input.c10
-rw-r--r--osc.c7
-rw-r--r--selection.c4
-rw-r--r--selection.h2
-rw-r--r--wayland.h3
5 files changed, 14 insertions, 12 deletions
diff --git a/input.c b/input.c
index f0024a0d..bc35ad56 100644
--- a/input.c
+++ b/input.c
@@ -306,7 +306,7 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
term_kbd_focus_in(term);
seat->kbd_focus = term;
- seat->input_serial = serial;
+ seat->kbd.serial = serial;
}
static bool
@@ -773,7 +773,7 @@ const struct wl_keyboard_listener keyboard_listener = {
void
input_repeat(struct seat *seat, uint32_t key)
{
- keyboard_key(seat, NULL, seat->input_serial, 0, key, XKB_KEY_DOWN);
+ keyboard_key(seat, NULL, seat->kbd.serial, 0, key, XKB_KEY_DOWN);
}
static bool
@@ -842,6 +842,8 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
struct wl_window *win = wl_surface_get_user_data(surface);
struct terminal *term = win->term;
+ seat->pointer.serial = serial;
+
LOG_DBG("pointer-enter: pointer=%p, serial=%u, surface = %p, new-moused = %p",
wl_pointer, serial, surface, term);
@@ -1297,8 +1299,8 @@ mouse_scroll(struct seat *seat, int amount)
xkb_keycode_t key = button == BTN_BACK ? key_arrow_up : key_arrow_down;
for (int i = 0; i < amount; i++)
- keyboard_key(seat, NULL, seat->input_serial, 0, key - 8, XKB_KEY_DOWN);
- keyboard_key(seat, NULL, seat->input_serial, 0, key - 8, XKB_KEY_UP);
+ keyboard_key(seat, NULL, seat->kbd.serial, 0, key - 8, XKB_KEY_DOWN);
+ keyboard_key(seat, NULL, seat->kbd.serial, 0, key - 8, XKB_KEY_UP);
} else {
if (!term_mouse_grabbed(term, seat)) {
for (int i = 0; i < amount; i++) {
diff --git a/osc.c b/osc.c
index 3183f196..42bef722 100644
--- a/osc.c
+++ b/osc.c
@@ -68,13 +68,13 @@ osc_to_clipboard(struct terminal *term, const char *target,
if (to_clipboard) {
char *copy = strdup(decoded);
- if (!text_to_clipboard(seat, term, copy, seat->input_serial))
+ if (!text_to_clipboard(seat, term, copy, seat->kbd.serial))
free(copy);
}
if (to_primary) {
char *copy = strdup(decoded);
- if (!text_to_primary(seat, term, copy, seat->input_serial))
+ if (!text_to_primary(seat, term, copy, seat->kbd.serial))
free(copy);
}
@@ -190,8 +190,7 @@ osc_from_clipboard(struct terminal *term, const char *source)
switch (src) {
case 'c':
text_from_clipboard(
- seat, term, seat->input_serial,
- &from_clipboard_cb, &from_clipboard_done, ctx);
+ seat, term, &from_clipboard_cb, &from_clipboard_done, ctx);
break;
case 's':
diff --git a/selection.c b/selection.c
index f097e37b..62f131b1 100644
--- a/selection.c
+++ b/selection.c
@@ -1087,7 +1087,7 @@ begin_receive_clipboard(struct terminal *term, int read_fd,
}
void
-text_from_clipboard(struct seat *seat, struct terminal *term, uint32_t serial,
+text_from_clipboard(struct seat *seat, struct terminal *term,
void (*cb)(const char *data, size_t size, void *user),
void (*done)(void *user), void *user)
{
@@ -1142,7 +1142,7 @@ selection_from_clipboard(struct seat *seat, struct terminal *term, uint32_t seri
term_to_slave(term, "\033[200~", 6);
text_from_clipboard(
- seat, term, serial, &from_clipboard_cb, &from_clipboard_done, term);
+ seat, term, &from_clipboard_cb, &from_clipboard_done, term);
}
bool
diff --git a/selection.h b/selection.h
index 52b0f1a3..bd995855 100644
--- a/selection.h
+++ b/selection.h
@@ -59,7 +59,7 @@ bool text_to_primary(
* point).
*/
void text_from_clipboard(
- struct seat *seat, struct terminal *term, uint32_t serial,
+ struct seat *seat, struct terminal *term,
void (*cb)(const char *data, size_t size, void *user),
void (*done)(void *user), void *user);
diff --git a/wayland.h b/wayland.h
index f703883e..0b136c04 100644
--- a/wayland.h
+++ b/wayland.h
@@ -106,6 +106,8 @@ struct seat {
/* Keyboard state */
struct wl_keyboard *wl_keyboard;
struct {
+ uint32_t serial;
+
struct xkb_context *xkb;
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
@@ -171,7 +173,6 @@ struct seat {
} mouse;
/* Clipboard */
- uint32_t input_serial;
struct wl_data_device *data_device;
struct zwp_primary_selection_device_v1 *primary_selection_device;