about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-30 16:14:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-30 16:14:52 -0700
commit57a8a8e7186a32c59c2a9a19aa1868093ac87419 (patch)
tree032fc480fcdc5090a019f2ca18e842c0cdace8a7
parent132e84bb986db0f2d51828f60b7f804481216d0f (diff)
downloadmu-57a8a8e7186a32c59c2a9a19aa1868093ac87419.tar.gz
1897
-rw-r--r--edit.mu33
1 files changed, 20 insertions, 13 deletions
diff --git a/edit.mu b/edit.mu
index 7d1ac31d..692132bf 100644
--- a/edit.mu
+++ b/edit.mu
@@ -2597,7 +2597,7 @@ recipe event-loop [
         loop +next-event:label
       }
     }
-    # 'touch' event
+    # 'touch' event - send to both sides, see what picks it up
     {
       t:address:touch-event <- maybe-convert e:event, touch:variant
       break-unless t
@@ -2606,22 +2606,14 @@ recipe event-loop [
       touch-type:number <- get *t, type:offset
       is-left-click?:boolean <- equal touch-type, 65513/mouse-left
       loop-unless is-left-click?, +next-event:label
-      # on a sandbox delete icon? process delete
-      {
-        was-delete?:boolean <- delete-sandbox *t, env
-        break-unless was-delete?
-#?         trace [app], [delete clicked] #? 1
-        screen <- render-sandbox-side screen, env, 1/clear
-        update-cursor screen, recipes, current-sandbox, *sandbox-in-focus?
-        show-screen screen
-        loop +next-event:label
-      }
-      # if not, send to both editors
+      # later exceptions for non-editor touches will go here
+      +global-touch
+      # send to both editors
       _ <- move-cursor-in-editor screen, recipes, *t
       *sandbox-in-focus? <- move-cursor-in-editor screen, current-sandbox, *t
       jump +continue:label
     }
-    # if it's not global, send to appropriate editor
+    # if it's not global and not a touch event, send to appropriate editor
     {
       {
         break-if *sandbox-in-focus?
@@ -2758,6 +2750,8 @@ scenario run-and-show-results [
   ]
 ]
 
+# hook into event-loop recipe: read non-unicode keypress from k, process it if
+# necessary, then go to next level
 after +global-keypress [
   # F4? load all code and run all sandboxes.
   {
@@ -3003,6 +2997,19 @@ recipe render-screen [
   reply row/same-as-ingredient:4, screen/same-as-ingredient:0
 ]
 
+after +global-touch [
+  # on a sandbox delete icon? process delete
+  {
+    was-delete?:boolean <- delete-sandbox *t, env
+    break-unless was-delete?
+#?     trace [app], [delete clicked] #? 1
+    screen <- render-sandbox-side screen, env, 1/clear
+    update-cursor screen, recipes, current-sandbox, *sandbox-in-focus?
+    show-screen screen
+    loop +next-event:label
+  }
+]
+
 # was-deleted?:boolean <- delete-sandbox t:touch-event, env:address:programming-environment-data
 recipe delete-sandbox [
   local-scope
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292