bar: let backend check if xcursor should be updated or not

This allows the backend to support multi-seat "properly", by checking
against the correct seat. Before this, when we used a single, global
xcursor value, a seat whose pointer needed to be updated would not be
updated.
This commit is contained in:
Daniel Eklöf 2020-07-09 19:02:02 +02:00
parent 5884e665a4
commit f04b1e806c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 24 additions and 40 deletions

View file

@ -32,6 +32,7 @@ struct xcb_backend {
xcb_gc_t gc;
xcb_cursor_context_t *cursor_ctx;
xcb_cursor_t cursor;
const char *xcursor;
uint8_t depth;
void *client_pixmap;
@ -280,9 +281,6 @@ cleanup(struct bar *_bar)
if (backend->cursor_ctx != NULL)
xcb_cursor_context_free(backend->cursor_ctx);
/* TODO: move to bar.c */
free(bar->cursor_name);
if (backend->pix != NULL)
pixman_image_unref(backend->pix);
free(backend->client_pixmap);
@ -432,6 +430,9 @@ set_cursor(struct bar *_bar, const char *cursor)
if (backend->cursor_ctx == NULL)
return;
if (backend->xcursor != NULL && strcmp(backend->xcursor, cursor) == 0)
return;
if (backend->cursor != 0)
xcb_free_cursor(backend->conn, backend->cursor);