mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
wayland: remove all usages of wayl_terminal_from_surface()
Use the 'user data' pointer from the wayland surface instead.
This commit is contained in:
parent
43c0551806
commit
c917a74f48
3 changed files with 6 additions and 19 deletions
9
input.c
9
input.c
|
|
@ -88,9 +88,11 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
assert(surface != NULL);
|
assert(surface != NULL);
|
||||||
|
|
||||||
struct wayland *wayl = data;
|
struct wayland *wayl = data;
|
||||||
|
struct wl_window *win = wl_surface_get_user_data(surface);
|
||||||
|
struct terminal *term = win->term;
|
||||||
|
|
||||||
|
wayl->kbd_focus = term;
|
||||||
wayl->input_serial = serial;
|
wayl->input_serial = serial;
|
||||||
wayl->kbd_focus = wayl_terminal_from_surface(wayl, surface);
|
|
||||||
assert(wayl->kbd_focus != NULL);
|
|
||||||
|
|
||||||
term_kbd_focus_in(wayl->kbd_focus);
|
term_kbd_focus_in(wayl->kbd_focus);
|
||||||
term_xcursor_update(wayl->kbd_focus);
|
term_xcursor_update(wayl->kbd_focus);
|
||||||
|
|
@ -147,7 +149,8 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
assert(
|
assert(
|
||||||
wayl->kbd_focus == NULL ||
|
wayl->kbd_focus == NULL ||
|
||||||
surface == NULL || /* Seen on Sway 1.2 */
|
surface == NULL || /* Seen on Sway 1.2 */
|
||||||
wayl_terminal_from_surface(wayl, surface) == wayl->kbd_focus);
|
((const struct wl_window *)wl_surface_get_user_data(surface))->term == wayl->kbd_focus
|
||||||
|
);
|
||||||
|
|
||||||
struct terminal *old_focused = wayl->kbd_focus;
|
struct terminal *old_focused = wayl->kbd_focus;
|
||||||
wayl->kbd_focus = NULL;
|
wayl->kbd_focus = NULL;
|
||||||
|
|
|
||||||
13
wayland.c
13
wayland.c
|
|
@ -1150,19 +1150,6 @@ wayl_reload_cursor_theme(struct wayland *wayl, struct terminal *term)
|
||||||
return render_xcursor_set(term);
|
return render_xcursor_set(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct terminal *
|
|
||||||
wayl_terminal_from_surface(struct wayland *wayl, struct wl_surface *surface)
|
|
||||||
{
|
|
||||||
tll_foreach(wayl->terms, it) {
|
|
||||||
if (term_surface_kind(it->item, surface) != TERM_SURF_NONE)
|
|
||||||
return it->item;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(false);
|
|
||||||
LOG_WARN("surface %p doesn't map to a terminal", surface);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wayl_flush(struct wayland *wayl)
|
wayl_flush(struct wayland *wayl)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -205,8 +205,5 @@ void wayl_destroy(struct wayland *wayl);
|
||||||
void wayl_flush(struct wayland *wayl);
|
void wayl_flush(struct wayland *wayl);
|
||||||
void wayl_roundtrip(struct wayland *wayl);
|
void wayl_roundtrip(struct wayland *wayl);
|
||||||
|
|
||||||
struct terminal *wayl_terminal_from_surface(
|
|
||||||
struct wayland *wayl, struct wl_surface *surface);
|
|
||||||
|
|
||||||
struct wl_window *wayl_win_init(struct terminal *term);
|
struct wl_window *wayl_win_init(struct terminal *term);
|
||||||
void wayl_win_destroy(struct wl_window *win);
|
void wayl_win_destroy(struct wl_window *win);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue