Commit c0d9f70d authored by Hanspeter Portner's avatar Hanspeter Portner

Squashed 'nk_pugl/' changes from 7a0c32e..5a18318

5a18318 add default editor copy/paste handlers.

git-subtree-dir: nk_pugl
git-subtree-split: 5a18318af17489cdc614ceef1cae11e43bc91f4b
parent 4f224a38
......@@ -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);
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);
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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment