mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-12 08:21:02 -04: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);
|
term_kbd_focus_in(term);
|
||||||
seat->kbd_focus = term;
|
seat->kbd_focus = term;
|
||||||
seat->input_serial = serial;
|
seat->kbd.serial = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -773,7 +773,7 @@ const struct wl_keyboard_listener keyboard_listener = {
|
||||||
void
|
void
|
||||||
input_repeat(struct seat *seat, uint32_t key)
|
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
|
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 wl_window *win = wl_surface_get_user_data(surface);
|
||||||
struct terminal *term = win->term;
|
struct terminal *term = win->term;
|
||||||
|
|
||||||
|
seat->pointer.serial = serial;
|
||||||
|
|
||||||
LOG_DBG("pointer-enter: pointer=%p, serial=%u, surface = %p, new-moused = %p",
|
LOG_DBG("pointer-enter: pointer=%p, serial=%u, surface = %p, new-moused = %p",
|
||||||
wl_pointer, serial, surface, term);
|
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;
|
xkb_keycode_t key = button == BTN_BACK ? key_arrow_up : key_arrow_down;
|
||||||
|
|
||||||
for (int i = 0; i < amount; i++)
|
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->kbd.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_UP);
|
||||||
} else {
|
} else {
|
||||||
if (!term_mouse_grabbed(term, seat)) {
|
if (!term_mouse_grabbed(term, seat)) {
|
||||||
for (int i = 0; i < amount; i++) {
|
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) {
|
if (to_clipboard) {
|
||||||
char *copy = strdup(decoded);
|
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);
|
free(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_primary) {
|
if (to_primary) {
|
||||||
char *copy = strdup(decoded);
|
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);
|
free(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,8 +190,7 @@ osc_from_clipboard(struct terminal *term, const char *source)
|
||||||
switch (src) {
|
switch (src) {
|
||||||
case 'c':
|
case 'c':
|
||||||
text_from_clipboard(
|
text_from_clipboard(
|
||||||
seat, term, seat->input_serial,
|
seat, term, &from_clipboard_cb, &from_clipboard_done, ctx);
|
||||||
&from_clipboard_cb, &from_clipboard_done, ctx);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
|
|
|
||||||
|
|
@ -1087,7 +1087,7 @@ begin_receive_clipboard(struct terminal *term, int read_fd,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 (*cb)(const char *data, size_t size, void *user),
|
||||||
void (*done)(void *user), 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);
|
term_to_slave(term, "\033[200~", 6);
|
||||||
|
|
||||||
text_from_clipboard(
|
text_from_clipboard(
|
||||||
seat, term, serial, &from_clipboard_cb, &from_clipboard_done, term);
|
seat, term, &from_clipboard_cb, &from_clipboard_done, term);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ bool text_to_primary(
|
||||||
* point).
|
* point).
|
||||||
*/
|
*/
|
||||||
void text_from_clipboard(
|
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 (*cb)(const char *data, size_t size, void *user),
|
||||||
void (*done)(void *user), void *user);
|
void (*done)(void *user), void *user);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,8 @@ struct seat {
|
||||||
/* Keyboard state */
|
/* Keyboard state */
|
||||||
struct wl_keyboard *wl_keyboard;
|
struct wl_keyboard *wl_keyboard;
|
||||||
struct {
|
struct {
|
||||||
|
uint32_t serial;
|
||||||
|
|
||||||
struct xkb_context *xkb;
|
struct xkb_context *xkb;
|
||||||
struct xkb_keymap *xkb_keymap;
|
struct xkb_keymap *xkb_keymap;
|
||||||
struct xkb_state *xkb_state;
|
struct xkb_state *xkb_state;
|
||||||
|
|
@ -171,7 +173,6 @@ struct seat {
|
||||||
} mouse;
|
} mouse;
|
||||||
|
|
||||||
/* Clipboard */
|
/* Clipboard */
|
||||||
uint32_t input_serial;
|
|
||||||
struct wl_data_device *data_device;
|
struct wl_data_device *data_device;
|
||||||
struct zwp_primary_selection_device_v1 *primary_selection_device;
|
struct zwp_primary_selection_device_v1 *primary_selection_device;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue