mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-16 22:05:21 -05:00
seat: use separate 'enter' serials for keyboard and mouse
This commit is contained in:
parent
4e48d550ef
commit
71584aed38
5 changed files with 14 additions and 12 deletions
10
input.c
10
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++) {
|
||||
|
|
|
|||
7
osc.c
7
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':
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue