]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.backend.cocoa.views: use queued-gesture for touchbar commands.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 19 Jan 2018 06:20:27 +0000 (22:20 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 19 Jan 2018 06:20:27 +0000 (22:20 -0800)
basis/ui/backend/cocoa/views/views.factor

index 5065dca02500b9d272201c3fbb2aba25e581f434..10ffc091c5ea043781ddde558617bbe3ce39394d 100644 (file)
@@ -169,9 +169,17 @@ CONSTANT: selector>action H{
         ] map-find
     ] [ f f ] if* ;
 
+TUPLE: send-touchbar-command target command ;
+
+M: send-touchbar-command send-queued-gesture
+    [ target>> ] [ command>> ] bi invoke-command ;
+
 : touchbar-invoke-command ( n -- )
-    [ touchbar-commands ] dip over
-    [ rot nth second invoke-command ] [ 3drop ] if ;
+    [ touchbar-commands ] dip over [
+        rot nth second
+        send-touchbar-command queue-gesture notify-ui-thread
+        yield
+    ] [ 3drop ] if ;
 
 <CLASS: FactorView < NSOpenGLView
     COCOA-PROTOCOL: NSTextInput