aboutsummaryrefslogtreecommitdiff
path: root/include/cursor.h
blob: 2f26dfd14bb002f15fc91ac292141d9faa517e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef GSR_CURSOR_H
#define GSR_CURSOR_H

#include "egl.h"
#include "vec2.h"

typedef struct {
    gsr_egl *egl;
    Display *display;
    int x_fixes_event_base;
    int xi_opcode;

    unsigned int texture_id;
    vec2i size;
    vec2i hotspot;
    vec2i position;

    bool cursor_image_set;
    bool visible;
    bool cursor_moved;
} gsr_cursor;

int gsr_cursor_init(gsr_cursor *self, gsr_egl *egl, Display *display);
void gsr_cursor_deinit(gsr_cursor *self);

/* Returns true if the cursor image has updated or if the cursor has moved */
bool gsr_cursor_update(gsr_cursor *self, XEvent *xev);
void gsr_cursor_tick(gsr_cursor *self, Window relative_to);

#endif /* GSR_CURSOR_H */