mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 12:35:41 +02:00
bar: do generic cursor stuff in bar, not in backend
This commit is contained in:
parent
0684aaaf95
commit
7f1567c973
2 changed files with 7 additions and 6 deletions
|
@ -156,6 +156,13 @@ static void
|
|||
set_cursor(struct bar *bar, const char *cursor)
|
||||
{
|
||||
struct private *b = bar->private;
|
||||
|
||||
if (b->cursor_name != NULL && strcmp(b->cursor_name, cursor) == 0)
|
||||
return;
|
||||
|
||||
free(b->cursor_name);
|
||||
b->cursor_name = strdup(cursor);
|
||||
|
||||
b->backend.iface->set_cursor(bar, cursor);
|
||||
}
|
||||
|
||||
|
|
|
@ -392,19 +392,13 @@ set_cursor(struct bar *_bar, const char *cursor)
|
|||
struct private *bar = _bar->private;
|
||||
struct xcb_backend *backend = bar->backend.data;
|
||||
|
||||
if (bar->cursor_name != NULL && strcmp(bar->cursor_name, cursor) == 0)
|
||||
return;
|
||||
|
||||
if (backend->cursor_ctx == NULL)
|
||||
return;
|
||||
|
||||
if (backend->cursor != 0) {
|
||||
xcb_free_cursor(backend->conn, backend->cursor);
|
||||
free(bar->cursor_name);
|
||||
bar->cursor_name = NULL;
|
||||
}
|
||||
|
||||
bar->cursor_name = strdup(cursor);
|
||||
backend->cursor = xcb_cursor_load_cursor(backend->cursor_ctx, cursor);
|
||||
xcb_change_window_attributes(
|
||||
backend->conn, backend->win, XCB_CW_CURSOR, &backend->cursor);
|
||||
|
|
Loading…
Add table
Reference in a new issue