aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-11-05 11:18:03 +0100
committerdec05eba <dec05eba@protonmail.com>2022-11-05 11:18:03 +0100
commit3c4deef40ccb57e46e3da30c76dee1e5011d7fd7 (patch)
tree31a394355f7f9fe970f28401d5851982b41df6af /include
parent1d3eb88461165fcc7ab1d5efde022e6714050806 (diff)
Only allow text in mgl_window_get_clipboard_string
Diffstat (limited to 'include')
-rw-r--r--include/mgl/window/window.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h
index 34f8cbb..ed50dcb 100644
--- a/include/mgl/window/window.h
+++ b/include/mgl/window/window.h
@@ -56,12 +56,15 @@ typedef struct {
} mgl_window_create_params;
typedef enum {
- MGL_CLIPBOARD_TYPE_STRING,
- MGL_CLIPBOARD_TYPE_IMAGE_PNG,
- MGL_CLIPBOARD_TYPE_IMAGE_JPG,
- MGL_CLIPBOARD_TYPE_IMAGE_GIF,
+ MGL_CLIPBOARD_TYPE_STRING = 1 << 0,
+ MGL_CLIPBOARD_TYPE_IMAGE_PNG = 1 << 1,
+ MGL_CLIPBOARD_TYPE_IMAGE_JPG = 1 << 2,
+ MGL_CLIPBOARD_TYPE_IMAGE_GIF = 1 << 3,
} mgl_clipboard_type;
+#define MGL_CLIPBOARD_TYPE_ALL 0xFFFFFFFF
+#define MGL_CLIPBOARD_TYPE_IMAGE (MGL_CLIPBOARD_TYPE_IMAGE_PNG | MGL_CLIPBOARD_TYPE_IMAGE_JPG | MGL_CLIPBOARD_TYPE_IMAGE_GIF)
+
/*
Return true to continue. |mgl_window_get_clipboard| returns false if this returns false.
Note: |size| is the size of the current data, not the total data (if the callback only contains a part of the data).
@@ -115,7 +118,8 @@ void mgl_window_set_size(mgl_window *self, mgl_vec2i size);
void mgl_window_set_size_limits(mgl_window *self, mgl_vec2i minimum, mgl_vec2i maximum);
void mgl_window_set_clipboard(mgl_window *self, const char *str, size_t size);
-bool mgl_window_get_clipboard(mgl_window *self, mgl_clipboard_callback callback, void *userdata);
+/* clipboard_types should be a bit-or of mgl_clipboard_type */
+bool mgl_window_get_clipboard(mgl_window *self, mgl_clipboard_callback callback, void *userdata, uint32_t clipboard_types);
/*
A new string is allocated and the pointer is copied to |str| with the size returned in |size|.
|str| should be deallocated with |free| by the user.