Commit da1ddef4 authored by Hanspeter Portner's avatar Hanspeter Portner

Merge commit 'c0d9f70d'

parents 1c86140e c0d9f70d
Pipeline #15968770 passed with stages
in 11 minutes and 43 seconds
......@@ -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;
}
......
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