From f4305c11aa617e4151385af13bd9e7f7e7ceafb0 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sun, 20 Jan 2019 19:36:15 +0000 Subject: imv_source: Use callbacks, not SDL to return async results --- src/source.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/source.h') diff --git a/src/source.h b/src/source.h index 6f051e3..80b1e81 100644 --- a/src/source.h +++ b/src/source.h @@ -4,6 +4,20 @@ #include #include "bitmap.h" +struct imv_source_message { + /* Pointer to sender of message */ + struct imv_source *source; + + /* User-supplied pointer */ + void *user_data; + + /* Receiver is responsible for destroying bitmap */ + struct imv_bitmap *bitmap; + + /* Error message if bitmap was NULL */ + const char *error; +}; + /* Generic source of one or more bitmaps. Essentially a single image file */ struct imv_source { /* usually the path of the image this is the source of */ @@ -41,6 +55,12 @@ struct imv_source { */ void (*free)(struct imv_source *src); + /* User-specified callback for returning messages */ + void (*callback)(struct imv_source_message *message); + + /* User-specified pointer, included in returned messages */ + void *user_data; + /* Implementation private data */ void *private; }; -- cgit v1.2.3