feat(backend): 添加光标支持

This commit is contained in:
2026-06-19 17:12:08 +08:00
parent 090266baa5
commit 7a47f4d44d
7 changed files with 99 additions and 2 deletions

View File

@@ -3,10 +3,12 @@
#include <stddef.h>
#include <stdint.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xproto.h>
#include "backend/x11/cursor.h"
#include "base/macros.h"
#include "base/memory.h"
#include "core/backend.h"
@@ -451,3 +453,13 @@ visual_t *window_get_visual(backend_t *backend, bool prefer_alpha) {
return visual;
}
void window_change_cursor(
backend_t *backend,
xcb_window_t window,
cursor_t cursor
) {
auto conn = backend->conn;
xcb_params_cw_t params = {.cursor = cursor_get_xcb_cursor(backend, cursor)};
xcb_aux_change_window_attributes(conn, window, XCB_CW_CURSOR, &params);
}