aboutsummaryrefslogtreecommitdiff
path: root/nk_pugl
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-01-09 22:16:15 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-01-09 22:16:15 +0100
commita7ac5c7dad92447bf715d431a88a05cd58c194dc (patch)
tree7ac3f6c44a806d434801ce5159a2070abe0ec1ba /nk_pugl
parentcae2710a16291cb65efdd425a6afbf9cbe770e05 (diff)
parent6af33b8a94c752fd30abf936a6b1acaee1bba823 (diff)
downloadsynthpod-a7ac5c7dad92447bf715d431a88a05cd58c194dc.tar.xz
Merge commit '6af33b8a94c752fd30abf936a6b1acaee1bba823'
Diffstat (limited to 'nk_pugl')
-rw-r--r--nk_pugl/nk_pugl.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/nk_pugl/nk_pugl.h b/nk_pugl/nk_pugl.h
index a261b290..78600c35 100644
--- a/nk_pugl/nk_pugl.h
+++ b/nk_pugl/nk_pugl.h
@@ -980,6 +980,25 @@ _nk_pugl_event_func(PuglView *view, const PuglEvent *e)
}
}
+static void
+_nk_pugl_editor_paste(nk_handle userdata, struct nk_text_edit* editor)
+{
+ nk_pugl_window_t *win = userdata.ptr;
+
+ size_t len;
+ const char *selection = nk_pugl_paste_from_clipboard(win, &len);
+ if(selection)
+ nk_textedit_paste(editor, selection, len);
+}
+
+static void
+_nk_pugl_editor_copy(nk_handle userdata, const char *buf, int len)
+{
+ nk_pugl_window_t *win = userdata.ptr;
+
+ nk_pugl_copy_to_clipboard(win, buf, len);
+}
+
NK_PUGL_API intptr_t
nk_pugl_init(nk_pugl_window_t *win)
{
@@ -1080,6 +1099,10 @@ nk_pugl_init(nk_pugl_window_t *win)
puglSetEventFunc(win->view, _nk_pugl_event_func);
nk_input_begin(&win->ctx);
+ win->ctx.clip.paste = _nk_pugl_editor_paste;
+ win->ctx.clip.copy = _nk_pugl_editor_copy;
+ win->ctx.clip.userdata.ptr = win;
+
win->widget = puglGetNativeWindow(win->view);
return win->widget;
}