]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/gestures/gestures.factor
The use of factor.com does not fix the issue with missing stdout on Github
[factor.git] / basis / ui / gestures / gestures.factor
index edabf341f658e635e99fc51a6ad2fd2337a89382..5e5b6c2231793bf41fc5b712f457e1366af19020 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
+! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays ascii assocs boxes calendar classes columns
-combinators combinators.short-circuit deques fry kernel make math
+combinators combinators.short-circuit deques kernel make math
 math.order math.parser math.vectors namespaces sequences sets system
 timers ui.gadgets ui.gadgets.private words ;
 IN: ui.gestures
@@ -18,7 +18,7 @@ M: object handle-gesture
 
 GENERIC: handles-gesture? ( gesture gadget -- ? )
 
-M: object handles-gesture? ( gesture gadget -- ? )
+M: object handles-gesture?
     get-gesture-handler >boolean ;
 
 : parents-handle-gesture? ( gesture gadget -- ? )
@@ -57,14 +57,16 @@ M: propagate-gesture-tuple send-queued-gesture
 TUPLE: propagate-key-gesture-tuple gesture world ;
 
 : world-focus ( world -- gadget )
-    dup focus>> [ world-focus ] [ ] ?if ;
+    [ focus>> ] [ world-focus ] ?when ;
 
 M: propagate-key-gesture-tuple send-queued-gesture
     [ gesture>> ] [ world>> world-focus ] bi
     [ handle-gesture ] with each-parent drop ;
 
-: propagate-key-gesture ( gesture world -- )
-    \ propagate-key-gesture-tuple queue-gesture ;
+:: propagate-key-gesture ( gesture world -- )
+    world world-focus preedit? [
+        gesture world \ propagate-key-gesture-tuple queue-gesture
+    ] unless ;
 
 TUPLE: user-input-tuple string world ;
 
@@ -145,7 +147,7 @@ TUPLE: key-up < key-gesture ;
 
 ! Note that these are only really useful inside an event
 ! handler, and that the locations hand-loc and hand-click-loc
-! are in the co-ordinate system of the world which contains
+! are in the coordinate system of the world which contains
 ! the gadget in question.
 SYMBOL: hand-gadget
 SYMBOL: hand-world
@@ -321,8 +323,8 @@ HOOK: modifiers>string os ( modifiers -- string )
 M: macosx modifiers>string
     [
         {
-            { A+ [ "\u002318" ] }
-            { M+ [ "\u002325" ] }
+            { M+ [ "\u002318" ] }
+            { A+ [ "\u002325" ] }
             { S+ [ "\u0021e7" ] }
             { C+ [ "\u002303" ] }
         } case
@@ -360,6 +362,8 @@ M: button-down gesture>string
         #>> [ " " % # ] when*
     ] "" make ;
 
+M: file-drop gesture>string drop "Drop files" ;
+
 M: left-action gesture>string drop "Swipe left" ;
 
 M: right-action gesture>string drop "Swipe right" ;
@@ -375,7 +379,7 @@ M: zoom-out-action gesture>string drop "Zoom out (pinch)" ;
 HOOK: action-modifier os ( -- mod )
 
 M: object action-modifier C+ ;
-M: macosx action-modifier A+ ;
+M: macosx action-modifier M+ ;
 
 M: action gesture>string
     action-gestures value-at