aboutsummaryrefslogtreecommitdiff
path: root/include/damage.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-14 01:15:01 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-14 01:15:01 +0200
commit8acb34638212ab8dba0d48a57dd40721203a7a44 (patch)
tree7f1942c56fa2700f2f5fe2d623e9e1c94fb23324 /include/damage.h
parent992792fb1f35546b9d66c3f69aa3d0f5adb94ef6 (diff)
Set update fps to video fps, on x11 sync video to damage tracking
Diffstat (limited to 'include/damage.h')
-rw-r--r--include/damage.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/damage.h b/include/damage.h
index 8f89e1d..68cd0d2 100644
--- a/include/damage.h
+++ b/include/damage.h
@@ -1,24 +1,43 @@
#ifndef GSR_DAMAGE_H
#define GSR_DAMAGE_H
+#include "utils.h"
#include <stdbool.h>
#include <stdint.h>
typedef struct _XDisplay Display;
typedef union _XEvent XEvent;
+typedef enum {
+ GSR_DAMAGE_TRACK_NONE,
+ GSR_DAMAGE_TRACK_WINDOW,
+ GSR_DAMAGE_TRACK_MONITOR
+} gsr_damage_track_type;
+
typedef struct {
- Display *display;
+ gsr_egl *egl;
+ bool track_cursor;
+ gsr_damage_track_type track_type;
+
int damage_event;
int damage_error;
+ uint64_t window;
uint64_t damage;
bool damaged;
+
+ int randr_event;
+ int randr_error;
+
+ vec2i cursor_position; /* Relative to |window| */
+ gsr_monitor monitor;
+ char monitor_name[32];
} gsr_damage;
-bool gsr_damage_init(gsr_damage *self, Display *display);
+bool gsr_damage_init(gsr_damage *self, gsr_egl *egl, bool track_cursor);
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);
/* Also returns true if damage tracking is not available */
bool gsr_damage_is_damaged(gsr_damage *self);