aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-06 23:55:43 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-06 23:55:43 +0200
commit8158a809b77726c33560b2159ccdd49a97f85dcd (patch)
tree855079ee55cda9f8592868a0d80939f38fcd17d8 /include
parent3446f864e3418d75fa55298bc7984b264e7167d6 (diff)
Move damage tracking to separate file
Diffstat (limited to 'include')
-rw-r--r--include/damage.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/damage.h b/include/damage.h
new file mode 100644
index 0000000..8f89e1d
--- /dev/null
+++ b/include/damage.h
@@ -0,0 +1,27 @@
+#ifndef GSR_DAMAGE_H
+#define GSR_DAMAGE_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+typedef struct _XDisplay Display;
+typedef union _XEvent XEvent;
+
+typedef struct {
+ Display *display;
+ int damage_event;
+ int damage_error;
+ uint64_t damage;
+ bool damaged;
+} gsr_damage;
+
+bool gsr_damage_init(gsr_damage *self, Display *display);
+void gsr_damage_deinit(gsr_damage *self);
+
+bool gsr_damage_set_target_window(gsr_damage *self, uint64_t window);
+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);
+void gsr_damage_clear(gsr_damage *self);
+
+#endif /* GSR_DAMAGE_H */