diff --git a/fcore/app-update.sml b/fcore/app-update.sml index dac196c..38d262e 100644 --- a/fcore/app-update.sml +++ b/fcore/app-update.sml @@ -19,6 +19,16 @@ struct (newApp, drawMsg) end + fun handleChr (app, chr) = + let + val chr = Char.toString chr ^ "\n" + val () = print chr + in + (app, []) + end + fun update (app, msg) = - case msg of RESIZE_EVENT (width, height) => resizeText (app, width, height) + case msg of + RESIZE_EVENT (width, height) => resizeText (app, width, height) + | CHAR_EVENT chr => handleChr (app, chr) end diff --git a/message-types/input-msg.sml b/message-types/input-msg.sml index 18ed832..6c2c8eb 100644 --- a/message-types/input-msg.sml +++ b/message-types/input-msg.sml @@ -2,10 +2,12 @@ signature INPUT_MSG = sig datatype t = RESIZE_EVENT of int * int + | CHAR_EVENT of char end structure InputMsg :> INPUT_MSG = struct datatype t = RESIZE_EVENT of int * int + | CHAR_EVENT of char end diff --git a/shell/shell.sml b/shell/shell.sml index a38d025..5922a6d 100644 --- a/shell/shell.sml +++ b/shell/shell.sml @@ -6,13 +6,12 @@ struct fun frameBufferSizeCallback inputMailbox (width, height) = Mailbox.send (inputMailbox, RESIZE_EVENT (width, height)) - fun charCallback word = + fun charCallback inputMailbox word = let val word = Word32.toInt word val chr = Char.chr word - val s = Char.toString chr ^ "\n" in - print s + Mailbox.send (inputMailbox, CHAR_EVENT chr) end fun registerCallbacks (inputMailbox, window) = @@ -21,6 +20,7 @@ struct val () = Input.exportFramebufferSizeCallback resizeCallback val () = Input.setFramebufferSizeCallback window + val charCallback = charCallback inputMailbox val () = Input.exportCharCallback charCallback val () = Input.setCharCallback window in diff --git a/shf b/shf index b5ef7eb..dbab214 100755 Binary files a/shf and b/shf differ