| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- /* Mouse-cursor shapes and the NBCUR1 cursor bundle.
- *
- * Shared by the kernel (kernel/cursor.c loads the bundle and mouse.c draws
- * it), ring 3 (SYS_WIN_SET_CURSOR / SYS_WM_SET_CURSOR take a shape id, the
- * browser maps CSS `cursor` keywords) and the host tool tools/mkcursors.c,
- * which builds /ramfs/cursors/adwaita24.cur from assets/cursors/adwaita/.
- *
- * The shape names are the CSS / freedesktop cursor names. CURSOR_LIST is an
- * X-macro: X(ENUM_SUFFIX, "css-name", "theme-file"); the order is the shape
- * id and the order of the shapes in the bundle, so append only. */
- #ifndef CURSOR_ABI_H
- #define CURSOR_ABI_H
- #define CURSOR_LIST(X) \
- X(DEFAULT, "default", "default") \
- X(POINTER, "pointer", "pointer") \
- X(TEXT, "text", "text") \
- X(VERTICAL_TEXT, "vertical-text", "vertical-text") \
- X(WAIT, "wait", "wait") \
- X(PROGRESS, "progress", "progress") \
- X(HELP, "help", "help") \
- X(CONTEXT_MENU, "context-menu", "context-menu") \
- X(CELL, "cell", "cell") \
- X(CROSSHAIR, "crosshair", "crosshair") \
- X(MOVE, "move", "all-resize") \
- X(ALL_SCROLL, "all-scroll", "all-scroll") \
- X(GRAB, "grab", "grab") \
- X(GRABBING, "grabbing", "grabbing") \
- X(NOT_ALLOWED, "not-allowed", "not-allowed") \
- X(NO_DROP, "no-drop", "no-drop") \
- X(COPY, "copy", "copy") \
- X(ALIAS, "alias", "alias") \
- X(ZOOM_IN, "zoom-in", "zoom-in") \
- X(ZOOM_OUT, "zoom-out", "zoom-out") \
- X(COL_RESIZE, "col-resize", "col-resize") \
- X(ROW_RESIZE, "row-resize", "row-resize") \
- X(N_RESIZE, "n-resize", "n-resize") \
- X(E_RESIZE, "e-resize", "e-resize") \
- X(S_RESIZE, "s-resize", "s-resize") \
- X(W_RESIZE, "w-resize", "w-resize") \
- X(NE_RESIZE, "ne-resize", "ne-resize") \
- X(NW_RESIZE, "nw-resize", "nw-resize") \
- X(SE_RESIZE, "se-resize", "se-resize") \
- X(SW_RESIZE, "sw-resize", "sw-resize") \
- X(EW_RESIZE, "ew-resize", "ew-resize") \
- X(NS_RESIZE, "ns-resize", "ns-resize") \
- X(NESW_RESIZE, "nesw-resize", "nesw-resize") \
- X(NWSE_RESIZE, "nwse-resize", "nwse-resize") \
- X(ALL_RESIZE, "all-resize", "all-resize")
- #define CURSOR_ENUM_(e, css, file) CURSOR_##e,
- enum cursor_shape {
- CURSOR_LIST(CURSOR_ENUM_)
- CURSOR_COUNT
- };
- #undef CURSOR_ENUM_
- /* SYS_WM_SET_CURSOR: no WM override, use the window's own cursor. */
- #define CURSOR_NO_OVERRIDE (-1)
- /* Largest cursor image the kernel accepts (the software cursor's save
- * buffer and the hardware planes are sized for it). */
- #define CURSOR_MAX_DIM 32
- /* ---- NBCUR1 bundle ------------------------------------------------------
- * [struct cursor_file_hdr][count x struct cursor_file_shape][pixels]
- * Pixels are premultiplied ARGB8888 (0xAARRGGBB little-endian dwords, as in
- * Xcursor), w*h per frame, frames stored back to back starting at
- * `offset` (bytes from the start of the file). Every field is
- * little-endian. */
- #define CURSOR_FILE_MAGIC "NBCUR1\0\0"
- struct cursor_file_hdr {
- char magic[8];
- unsigned int count; /* number of shapes (CURSOR_COUNT when built) */
- unsigned int nominal; /* theme size in px, e.g. 24 */
- };
- struct cursor_file_shape {
- unsigned short w, h;
- unsigned short hot_x, hot_y;
- unsigned short frames; /* >= 1; > 1 animates */
- unsigned short delay_ms; /* per frame when animated */
- unsigned int offset; /* first frame's pixels */
- };
- #endif
|