aboutsummaryrefslogtreecommitdiff
path: root/pugl/pugl_internal.h
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-07 19:49:51 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-07 19:49:51 +0100
commit0406d71d421e141802ca8c085bbd00125a4af961 (patch)
tree7379071879b7eeffb3b207911c3a72ede793eb0b /pugl/pugl_internal.h
parentc977ef2968f22d0379a857aa2fe1668547bb50c0 (diff)
downloadsynthpod-0406d71d421e141802ca8c085bbd00125a4af961.tar.xz
Implement clipboard
Diffstat (limited to 'pugl/pugl_internal.h')
-rw-r--r--pugl/pugl_internal.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h
index 4a3fc0ca..45084de3 100644
--- a/pugl/pugl_internal.h
+++ b/pugl/pugl_internal.h
@@ -40,6 +40,7 @@ struct PuglViewImpl {
PuglEventFunc eventFunc;
PuglInternals* impl;
+ char* selection;
char* windowClass;
PuglNativeWindow parent;
@@ -239,3 +240,34 @@ puglDispatchEvent(PuglView* view, const PuglEvent* event)
view->eventFunc(view, event);
}
}
+
+static void
+puglClearSelection(PuglView* view)
+{
+ if(view->selection) {
+ free(view->selection);
+ view->selection = NULL;
+ }
+}
+
+static void
+puglSetSelection(PuglView* view, const char *selection, size_t len)
+{
+ puglClearSelection(view);
+
+ if(selection) {
+ view->selection = (char*)malloc(len + 1);
+ if(view->selection) {
+ memcpy(view->selection, selection, len);
+ view->selection[len] = 0;
+ }
+ }
+}
+
+static const char*
+puglGetSelection(PuglView* view, size_t* len)
+{
+ if(len)
+ *len = view->selection ? strlen(view->selection) : 0;
+ return view->selection;
+}