diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-01-20 19:36:15 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-01-29 22:25:05 +0000 |
commit | f4305c11aa617e4151385af13bd9e7f7e7ceafb0 (patch) | |
tree | c5dbaab6ece902fa8b1d13b5f03eef817135f8dd /src/source.h | |
parent | 32bfa1535a467222b7e6c7cd775367c5184b334c (diff) | |
download | imv-f4305c11aa617e4151385af13bd9e7f7e7ceafb0.tar.gz |
imv_source: Use callbacks, not SDL to return async results
Diffstat (limited to 'src/source.h')
-rw-r--r-- | src/source.h | 20 |
1 files changed, 20 insertions, 0 deletions
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 <stdbool.h> #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; }; |