Properly damage if moving cursor

Only damage if cursor is inside the target area
This commit is contained in:
dec05eba
2024-09-14 01:57:00 +02:00
parent 8acb346382
commit 714561987e
9 changed files with 79 additions and 16 deletions

View File

@@ -21,13 +21,16 @@ typedef struct {
int damage_event;
int damage_error;
uint64_t window;
uint64_t damage;
bool damaged;
int randr_event;
int randr_error;
uint64_t window;
//vec2i window_pos;
vec2i window_size;
vec2i cursor_position; /* Relative to |window| */
gsr_monitor monitor;
char monitor_name[32];
@@ -38,7 +41,8 @@ void gsr_damage_deinit(gsr_damage *self);
bool gsr_damage_set_target_window(gsr_damage *self, uint64_t window);
bool gsr_damage_set_target_monitor(gsr_damage *self, const char *monitor_name);
void gsr_damage_update(gsr_damage *self, XEvent *xev);
void gsr_damage_on_event(gsr_damage *self, XEvent *xev);
void gsr_damage_tick(gsr_damage *self);
/* Also returns true if damage tracking is not available */
bool gsr_damage_is_damaged(gsr_damage *self);
void gsr_damage_clear(gsr_damage *self);