diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 77ad150f62..713635cbe8 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -21,6 +21,7 @@ - get factor running on mac intel - constant branch folding - cocoa: starting the UI with +foo switches opens them as files +- pasting from clipboard on x11 + refactor style stack code so that nested styles are handled at a lower-level - in HTML, we can nest div tags, etc diff --git a/library/ui/cocoa/pasteboard-utils.factor b/library/ui/cocoa/pasteboard-utils.factor index de75257e9d..cb230e299d 100644 --- a/library/ui/cocoa/pasteboard-utils.factor +++ b/library/ui/cocoa/pasteboard-utils.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: cocoa -USING: arrays gadgets kernel objc objc-classes sequences ; +USING: arrays gadgets kernel namespaces objc objc-classes +sequences ; : NSStringPboardType "NSStringPboardType" ; @@ -27,3 +28,7 @@ M: pasteboard clipboard-contents ( pb -- str ) M: pasteboard set-clipboard-contents ( str pb -- ) pasteboard-handle set-pasteboard-string ; + +: init-clipboard ( -- ) + NSPasteboard -> generalPasteboard + clipboard set-global ; diff --git a/library/ui/cocoa/ui.factor b/library/ui/cocoa/ui.factor index 931ff348ad..d7fe2af810 100644 --- a/library/ui/cocoa/ui.factor +++ b/library/ui/cocoa/ui.factor @@ -26,6 +26,7 @@ namespaces objc sequences errors freetype ; reset-callbacks install-app-delegate register-services + init-clipboard default-main-menu ; : rect>NSRect diff --git a/library/ui/cocoa/view-utils.factor b/library/ui/cocoa/view-utils.factor index 62beae1260..ee37dcd239 100644 --- a/library/ui/cocoa/view-utils.factor +++ b/library/ui/cocoa/view-utils.factor @@ -85,8 +85,8 @@ opengl sequences ; [ -> deltaY 0 > ] 2keep mouse-location rot window send-wheel ; -: send-action ( view event class -- f ) - >r drop window r> handle-action f ; +: send-action ( view event gesture -- junk ) + -rot drop window world-focus handle-gesture drop f ; : add-resize-observer ( observer object -- ) >r "updateFactorGadgetSize:" @@ -163,15 +163,15 @@ opengl sequences ; } { "cut:" "id" { "id" "SEL" "id" } - [ nip send-action ] + [ nip T{ cut-action } send-action ] } { "copy:" "id" { "id" "SEL" "id" } - [ nip send-action ] + [ nip T{ copy-action } send-action ] } { "paste:" "id" { "id" "SEL" "id" } - [ nip send-action ] + [ nip T{ paste-action } send-action ] } { "updateFactorGadgetSize:" "void" { "id" "SEL" "id" } diff --git a/library/ui/gadgets/sliders.factor b/library/ui/gadgets/sliders.factor index eea254cfff..2e07a80791 100644 --- a/library/ui/gadgets/sliders.factor +++ b/library/ui/gadgets/sliders.factor @@ -49,7 +49,7 @@ TUPLE: slider-changed ; ] [ [ set-slider-value ] keep dup slider-elevator relayout-1 - handle-action + T{ slider-changed } swap handle-gesture drop ] if ; TUPLE: thumb ;