From 714561987e264c5f3e9fb01d9ebbf545225b35b7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 14 Sep 2024 01:57:00 +0200 Subject: Properly damage if moving cursor Only damage if cursor is inside the target area --- include/cursor.h | 2 +- include/damage.h | 8 ++++++-- include/egl.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/cursor.h b/include/cursor.h index 2f26dfd..323d098 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -24,7 +24,7 @@ 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); +bool gsr_cursor_on_event(gsr_cursor *self, XEvent *xev); void gsr_cursor_tick(gsr_cursor *self, Window relative_to); #endif /* GSR_CURSOR_H */ diff --git a/include/damage.h b/include/damage.h index 68cd0d2..2bf43d7 100644 --- a/include/damage.h +++ b/include/damage.h @@ -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); diff --git a/include/egl.h b/include/egl.h index 9e50ad0..61890b4 100644 --- a/include/egl.h +++ b/include/egl.h @@ -314,7 +314,7 @@ bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland, bool is_monitor_cap void gsr_egl_unload(gsr_egl *self); /* Returns true if an event is available */ -bool gsr_egl_update(gsr_egl *self); +bool gsr_egl_process_event(gsr_egl *self); /* Does opengl swap with egl or glx, depending on which one is active */ void gsr_egl_swap_buffers(gsr_egl *self); -- cgit v1.2.3