mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-03 07:15:29 -04:00
wayland: store pointer to window instance in all surfaces
This commit is contained in:
parent
1091d1c078
commit
43c0551806
3 changed files with 10 additions and 1 deletions
8
input.c
8
input.c
|
|
@ -676,7 +676,8 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
|
||||||
assert(surface != NULL);
|
assert(surface != NULL);
|
||||||
|
|
||||||
struct wayland *wayl = data;
|
struct wayland *wayl = data;
|
||||||
struct terminal *term = wayl_terminal_from_surface(wayl, surface);
|
struct wl_window *win = wl_surface_get_user_data(surface);
|
||||||
|
struct terminal *term = win->term;
|
||||||
|
|
||||||
LOG_DBG("pointer-enter: surface = %p, new-moused = %p", surface, term);
|
LOG_DBG("pointer-enter: surface = %p, new-moused = %p", surface, term);
|
||||||
|
|
||||||
|
|
@ -743,6 +744,11 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
|
||||||
"compositor sent pointer_leave event without a pointer_enter "
|
"compositor sent pointer_leave event without a pointer_enter "
|
||||||
"event: surface=%p", surface);
|
"event: surface=%p", surface);
|
||||||
} else {
|
} else {
|
||||||
|
if (surface != NULL) {
|
||||||
|
/* Sway 1.4 sends this event with a NULL surface when we destroy the window */
|
||||||
|
const struct wl_window *win = wl_surface_get_user_data(surface);
|
||||||
|
assert(old_moused == win->term);
|
||||||
|
}
|
||||||
old_moused->active_surface = TERM_SURF_NONE;
|
old_moused->active_surface = TERM_SURF_NONE;
|
||||||
term_xcursor_update(old_moused);
|
term_xcursor_update(old_moused);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
search.c
2
search.c
|
|
@ -75,6 +75,8 @@ search_begin(struct terminal *term)
|
||||||
struct wl_window *win = term->window;
|
struct wl_window *win = term->window;
|
||||||
struct wayland *wayl = term->wl;
|
struct wayland *wayl = term->wl;
|
||||||
win->search_surface = wl_compositor_create_surface(wayl->compositor);
|
win->search_surface = wl_compositor_create_surface(wayl->compositor);
|
||||||
|
wl_surface_set_user_data(win->search_surface, term->window);
|
||||||
|
|
||||||
win->search_sub_surface = wl_subcompositor_get_subsurface(
|
win->search_sub_surface = wl_subcompositor_get_subsurface(
|
||||||
wayl->sub_compositor, win->search_surface, win->surface);
|
wayl->sub_compositor, win->search_surface, win->surface);
|
||||||
wl_subsurface_set_desync(win->search_sub_surface);
|
wl_subsurface_set_desync(win->search_sub_surface);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ csd_instantiate(struct wl_window *win)
|
||||||
wayl->sub_compositor, win->csd.surface[i], win->surface);
|
wayl->sub_compositor, win->csd.surface[i], win->surface);
|
||||||
|
|
||||||
wl_subsurface_set_sync(win->csd.sub_surface[i]);
|
wl_subsurface_set_sync(win->csd.sub_surface[i]);
|
||||||
|
wl_surface_set_user_data(win->csd.surface[i], win);
|
||||||
wl_surface_commit(win->csd.surface[i]);
|
wl_surface_commit(win->csd.surface[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue