master ohmu/nosferatu / source / hevelcursor.c
ohmu  ·  2026-11-23
 1/*
 2 * hevel.c
 3 *
 4 * borrowed code from
 5 * sr.ht/~dlm/hevel
 6 */ 
 7
 8#include <swc.h>
 9
10#include "hevelcursor.h"
11#include "nein_cursor.h"
12
13void maybe_enable_nein_cursor_theme(void);
14
15void
16maybe_enable_nein_cursor_theme(void)
17{
18  const struct nein_cursor_meta *arrow =
19      &nein_cursor_metadata[NEIN_CURSOR_WHITEARROW];
20  const struct nein_cursor_meta *box =
21      &nein_cursor_metadata[NEIN_CURSOR_BOXCURSOR];
22  const struct nein_cursor_meta *cross =
23      &nein_cursor_metadata[NEIN_CURSOR_CROSSCURSOR];
24  const struct nein_cursor_meta *sight =
25      &nein_cursor_metadata[NEIN_CURSOR_SIGHTCURSOR];
26  const struct nein_cursor_meta *up = &nein_cursor_metadata[NEIN_CURSOR_T];
27  const struct nein_cursor_meta *down = &nein_cursor_metadata[NEIN_CURSOR_B];
28
29  swc_set_cursor_mode(SWC_CURSOR_MODE_COMPOSITOR);
30  swc_set_cursor_image(SWC_CURSOR_DEFAULT, &nein_cursor_data[arrow->offset],
31                       arrow->width, arrow->height, arrow->hotspot_x,
32                       arrow->hotspot_y);
33  swc_set_cursor_image(SWC_CURSOR_BOX, &nein_cursor_data[box->offset],
34                       box->width, box->height, box->hotspot_x, box->hotspot_y);
35  swc_set_cursor_image(SWC_CURSOR_CROSS, &nein_cursor_data[cross->offset],
36                       cross->width, cross->height, cross->hotspot_x,
37                       cross->hotspot_y);
38  swc_set_cursor_image(SWC_CURSOR_SIGHT, &nein_cursor_data[sight->offset],
39                       sight->width, sight->height, sight->hotspot_x,
40                       sight->hotspot_y);
41  swc_set_cursor_image(SWC_CURSOR_UP, &nein_cursor_data[up->offset], up->width,
42                       up->height, up->hotspot_x, up->hotspot_y);
43  swc_set_cursor_image(SWC_CURSOR_DOWN, &nein_cursor_data[down->offset],
44                       down->width, down->height, down->hotspot_x,
45                       down->hotspot_y);
46
47  /* we dont need update_cursor, we directly set mouse mode in nosferatu.c */
48}