mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: instantiate+destroy viewport for pointer surface
This commit is contained in:
parent
5a60bbc119
commit
e5989d81b9
1 changed files with 20 additions and 1 deletions
21
wayland.c
21
wayland.c
|
|
@ -293,13 +293,27 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
if (caps & WL_SEAT_CAPABILITY_POINTER) {
|
||||
if (seat->wl_pointer == NULL) {
|
||||
xassert(seat->pointer.surface.surf == NULL);
|
||||
seat->pointer.surface.surf = wl_compositor_create_surface(seat->wayl->compositor);
|
||||
seat->pointer.surface.surf =
|
||||
wl_compositor_create_surface(seat->wayl->compositor);
|
||||
|
||||
if (seat->pointer.surface.surf == NULL) {
|
||||
LOG_ERR("%s: failed to create pointer surface", seat->name);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
xassert(seat->pointer.surface.viewport == NULL);
|
||||
seat->pointer.surface.viewport = wp_viewporter_get_viewport(
|
||||
seat->wayl->viewporter, seat->pointer.surface.surf);
|
||||
|
||||
if (seat->pointer.surface.viewport == NULL) {
|
||||
LOG_ERR("%s: failed to create pointer viewport", seat->name);
|
||||
wl_surface_destroy(seat->pointer.surface.surf);
|
||||
seat->pointer.surface.surf = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
seat->wl_pointer = wl_seat_get_pointer(wl_seat);
|
||||
wl_pointer_add_listener(seat->wl_pointer, &pointer_listener, seat);
|
||||
}
|
||||
|
|
@ -308,6 +322,11 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
wl_pointer_release(seat->wl_pointer);
|
||||
wl_surface_destroy(seat->pointer.surface.surf);
|
||||
|
||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||
wp_viewport_destroy(seat->pointer.surface.viewport);
|
||||
seat->pointer.surface.viewport = NULL;
|
||||
#endif
|
||||
|
||||
if (seat->pointer.theme != NULL)
|
||||
wl_cursor_theme_destroy(seat->pointer.theme);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue