mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-26 01:40:12 -05:00
render: load cursor theme from XCURSOR_THEME and XCURSOR_SIZE
This commit is contained in:
parent
1947d33868
commit
1a341a56cc
4 changed files with 79 additions and 0 deletions
29
render.c
29
render.c
|
|
@ -3,6 +3,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <wayland-cursor.h>
|
||||
#include <xdg-shell.h>
|
||||
|
||||
#define LOG_MODULE "render"
|
||||
|
|
@ -530,3 +531,31 @@ render_set_title(struct terminal *term, const char *title)
|
|||
{
|
||||
xdg_toplevel_set_title(term->wl.xdg_toplevel, title);
|
||||
}
|
||||
|
||||
void
|
||||
render_update_cursor_surface(struct terminal *term)
|
||||
{
|
||||
if (term->wl.pointer.cursor == NULL)
|
||||
return;
|
||||
|
||||
//const int scale = backend->monitor->scale;
|
||||
const int scale = 1;
|
||||
|
||||
struct wl_cursor_image *image = term->wl.pointer.cursor->images[0];
|
||||
|
||||
wl_surface_set_buffer_scale(term->wl.pointer.surface, scale);
|
||||
|
||||
wl_surface_attach(
|
||||
term->wl.pointer.surface, wl_cursor_image_get_buffer(image), 0, 0);
|
||||
|
||||
wl_pointer_set_cursor(
|
||||
term->wl.pointer.pointer, term->wl.pointer.serial,
|
||||
term->wl.pointer.surface,
|
||||
image->hotspot_x / scale, image->hotspot_y / scale);
|
||||
|
||||
|
||||
wl_surface_damage_buffer(
|
||||
term->wl.pointer.surface, 0, 0, INT32_MAX, INT32_MAX);
|
||||
|
||||
wl_surface_commit(term->wl.pointer.surface);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue