aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-16 10:56:52 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-16 10:56:52 +0100
commiteba962c3e353b3fd3f11e30a7d6f48585e3a153c (patch)
treea5b93bb2c4d5af7db63ab9d1e07e1ce7b0efddd1 /tests
parent8df2299beba0f1465c3167edb67dd593c5c9e8db (diff)
Window: add set/get clipboard
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/main.c b/tests/main.c
index 51487dc..a9aebec 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -255,6 +255,17 @@ int main(int argc, char **argv) {
break;
}
case MGL_EVENT_KEY_PRESSED: {
+ if(event.key.code == MGL_KEY_C) {
+ mgl_window_set_clipboard(&window, "hello", 5);
+ fprintf(stderr, "Copied 'hello' to the clipboard\n");
+ } else if(event.key.code == MGL_KEY_V) {
+ char *str;
+ size_t size;
+ if(mgl_window_get_clipboard(&window, &str, &size)) {
+ fprintf(stderr, "Copied '%s' from the clipboard\n", str);
+ free(str);
+ }
+ }
fprintf(stderr, "key press event, code: %u\n", event.key.code);
break;
}