diff --git a/ffi/glfw-export.c b/ffi/glfw-export.c index 0fc3eb9..fe03b05 100644 --- a/ffi/glfw-export.c +++ b/ffi/glfw-export.c @@ -41,3 +41,8 @@ void swapBuffers(GLFWwindow *window) { glfwSwapBuffers(window); } +void setClipboardString (GLFWwindow *window, const char *copyString) { + glfwSetClipboardString(window, copyString); + printf("ddone yanking"); +} + diff --git a/ffi/glfw-import.sml b/ffi/glfw-import.sml index f24f27c..437c34e 100644 --- a/ffi/glfw-import.sml +++ b/ffi/glfw-import.sml @@ -22,4 +22,5 @@ struct val windowShouldClose = _import "windowShouldClose" public : window -> bool; val waitEvents = _import "waitEvents" public reentrant : unit -> unit; val swapBuffers = _import "swapBuffers" public : window -> unit; + val setClipboardString = _import "setClipboardString" public : window * string -> unit; end diff --git a/message-types/draw-msg.sml b/message-types/draw-msg.sml index 2b6c79c..9667d76 100644 --- a/message-types/draw-msg.sml +++ b/message-types/draw-msg.sml @@ -3,6 +3,7 @@ sig datatype t = REDRAW_TEXT of Real32.real vector | REDRAW_CURSOR of Real32.real vector + | YANK of string end structure DrawMsg :> DRAW_MSG = @@ -10,4 +11,5 @@ struct datatype t = REDRAW_TEXT of Real32.real vector | REDRAW_CURSOR of Real32.real vector + | YANK of string end diff --git a/shell/gl-draw.sml b/shell/gl-draw.sml index fbee559..90c2d88 100644 --- a/shell/gl-draw.sml +++ b/shell/gl-draw.sml @@ -164,6 +164,11 @@ struct () end + fun yank (shellState: t, str) = + ( Glfw.setClipboardString (#window shellState, str); + shellState + ) + fun consumeDrawEvent (shellState, msg) = let val @@ -178,6 +183,7 @@ struct case msg of REDRAW_TEXT textVec => uploadText (shellState, textVec) | REDRAW_CURSOR cursorVec => uploadCursor (shellState, cursorVec) + | YANK str => yank (shellState, str) end fun consumeDrawEvents (shellState as {drawMailbox, ...}: t) = diff --git a/shf b/shf index 7a7de49..b4a34b3 100755 Binary files a/shf and b/shf differ