aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugin
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2026-05-20 08:10:47 +0200
committerdec05eba <dec05eba@protonmail.com>2026-05-20 08:10:47 +0200
commit280131585e07b6d5c8438af258b7de0afeff8266 (patch)
tree6c00853ef23141c0f3a7517e491a7f44502b20b5 /plugin
parentf9d6045b28c5ba71831896c1acc2db13f83c6825 (diff)
plugin: add is_damaged and clear_damage
Diffstat (limited to 'plugin')
-rw-r--r--plugin/examples/hello_triangle/triangle.c10
-rw-r--r--plugin/plugin.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/plugin/examples/hello_triangle/triangle.c b/plugin/examples/hello_triangle/triangle.c
index 194cf92..fd27a3d 100644
--- a/plugin/examples/hello_triangle/triangle.c
+++ b/plugin/examples/hello_triangle/triangle.c
@@ -62,6 +62,14 @@ static void draw(const gsr_plugin_draw_params *params, void *userdata) {
++triangle->counter;
}
+static bool is_damaged(void *userdata) {
+ return true;
+}
+
+static void clear_damage(void *userdata) {
+
+}
+
bool gsr_plugin_init(const gsr_plugin_init_params *params, gsr_plugin_init_return *ret) {
Triangle *triangle = calloc(1, sizeof(Triangle));
if(!triangle)
@@ -98,6 +106,8 @@ bool gsr_plugin_init(const gsr_plugin_init_params *params, gsr_plugin_init_retur
ret->version = 1;
ret->userdata = triangle;
ret->draw = draw;
+ ret->is_damaged = is_damaged;
+ ret->clear_damage = clear_damage;
return true;
}
diff --git a/plugin/plugin.h b/plugin/plugin.h
index 902d1d7..769a629 100644
--- a/plugin/plugin.h
+++ b/plugin/plugin.h
@@ -43,6 +43,12 @@ typedef struct {
/* Optional, called when the plugin is expected to draw something to the current framebuffer */
void (*draw)(const gsr_plugin_draw_params *params, void *userdata);
+ /* Optional, returns false if this function is NULL. If this function is defined then this should return true
+ if there is an update visually that the plugin wants to display. This is useful when used with the "content" framerate mode
+ which only captures a frame when the frame has changed */
+ bool (*is_damaged)(void *userdata);
+ /* Optional */
+ void (*clear_damage)(void *userdata);
} gsr_plugin_init_return;
/* The plugin is expected to implement these functions and export them: */