Started X11 clipboard copy

slava 2006-07-23 22:51:25 +00:00
parent f7820c999c
commit 2de4c86f8c
6 changed files with 53 additions and 11 deletions

View File

@ -56,17 +56,38 @@
- prettyprinter's highlighting of non-leaves doesn't really work - prettyprinter's highlighting of non-leaves doesn't really work
- rollover is not updated on window focus changes - rollover is not updated on window focus changes
- x11 input methods - x11 input methods
- new browser:
- browse generic words and classes
- need actions for reloading the source file and opening word in jEdit
- highlight showing panes in originating list
- reimplement tab completion
- cocoa: - cocoa:
- horizontal wheel scrolling - horizontal wheel scrolling
- polish OS X menu bar code - polish OS X menu bar code
- variable width word wrap - variable width word wrap
- slider needs to be modelized - slider needs to be modelized
+ module system:
- 'see' should show tuple constructors
- forgetting a class should remove its methods from all generic words
- forgetting a tuple class should forget the constructor
- seeing a tuple class should show the constructor
- C types should be words
- TYPEDEF: float { ... } { ... } ; ==> \ float T{ c-type ... } "c-type" swp
- TYPEDEF: float FTFloat ; ==> \ float \ FTFloat "c-type" swp
- make typedef aliasing explicit
- seeing a C struct word should show its def
- see by itself only shows the G: def
- { class generic } see supports forms:
{ f generic } to show all methods
{ class f } to show all methods
- modularize core
- TUPLE: module files tests articles article main ;
- methods: remember their file/line
- { class generic } jedit, reload DTRT
- requesting a list of assets loaded from a specific file
- T{ link f "foo" "bar" } see
- T{ link f "foo" "bar" } jedit
- T{ link f "foo" "bar" } reload
- file out
- make 'forget' generic
+ compiler/ffi: + compiler/ffi:
- mac intel: struct returns from objc methods - mac intel: struct returns from objc methods

View File

@ -25,9 +25,13 @@ C: clipboard "" over set-clipboard-contents ;
GENERIC: paste-clipboard ( gadget clipboard -- ) GENERIC: paste-clipboard ( gadget clipboard -- )
M: object paste-clipboard ( gadget clipboard -- ) M: object paste-clipboard
clipboard-contents dup [ swap user-input ] [ 2drop ] if ; clipboard-contents dup [ swap user-input ] [ 2drop ] if ;
GENERIC: copy-clipboard ( string gadget clipboard -- )
M: object copy-clipboard nip set-clipboard-contents ;
SYMBOL: clipboard SYMBOL: clipboard
SYMBOL: selection SYMBOL: selection

View File

@ -15,7 +15,7 @@ sequences ;
: editor-copy ( editor clipboard -- ) : editor-copy ( editor clipboard -- )
over editor-selection? [ over editor-selection? [
>r editor-selection r> set-clipboard-contents >r [ editor-selection ] keep r> copy-clipboard
] [ ] [
2drop 2drop
] if ; ] if ;

View File

@ -27,7 +27,17 @@ IN: x11
r> selection-property 1 window-property r> selection-property 1 window-property
] if ; ] if ;
TUPLE: x-clipboard atom ; : own-selection ( prop win -- )
dpy get -rot CurrentTime XSetSelectionOwner drop ;
TUPLE: x-clipboard atom contents ;
: x-clipboard@ ( gadget clipboard -- prop win )
x-clipboard-atom swap find-world world-handle first ;
M: x-clipboard copy-clipboard ( string gadget clipboard -- )
[ x-clipboard@ own-selection ] keep
set-x-clipboard-contents ;
M: x-clipboard paste-clipboard ( gadget clipboard -- ) M: x-clipboard paste-clipboard ( gadget clipboard -- )
>r find-world world-handle first r> x-clipboard-atom >r find-world world-handle first r> x-clipboard-atom

View File

@ -28,7 +28,9 @@ GENERIC: focus-in-event ( event window -- )
GENERIC: focus-out-event ( event window -- ) GENERIC: focus-out-event ( event window -- )
GENERIC: selection-event ( event window -- ) GENERIC: selection-notify-event ( event window -- )
GENERIC: selection-request-event ( event window -- )
GENERIC: client-event ( event window -- ) GENERIC: client-event ( event window -- )
@ -65,7 +67,8 @@ GENERIC: client-event ( event window -- )
{ [ dup KeyRelease = ] [ drop key-up-event ] } { [ dup KeyRelease = ] [ drop key-up-event ] }
{ [ dup FocusIn = ] [ drop focus-in-event ] } { [ dup FocusIn = ] [ drop focus-in-event ] }
{ [ dup FocusOut = ] [ drop focus-out-event ] } { [ dup FocusOut = ] [ drop focus-out-event ] }
{ [ dup SelectionNotify = ] [ drop selection-event ] } { [ dup SelectionNotify = ] [ drop selection-notify-event ] }
{ [ dup SelectionRequest = ] [ drop selection-request-event ] }
{ [ dup ClientMessage = ] [ drop client-event ] } { [ dup ClientMessage = ] [ drop client-event ] }
{ [ t ] [ 3drop ] } { [ t ] [ 3drop ] }
} cond ; } cond ;

View File

@ -102,10 +102,14 @@ M: world focus-in-event ( event world -- ) nip focus-world ;
M: world focus-out-event ( event world -- ) nip unfocus-world ; M: world focus-out-event ( event world -- ) nip unfocus-world ;
M: world selection-event ( event world -- ) M: world selection-notify-event ( event world -- )
[ world-handle first selection-from-event ] keep [ world-handle first selection-from-event ] keep
world-focus user-input ; world-focus user-input ;
M: world selection-request-event ( event world -- )
USE: io
global [ "Hi" print flush ] bind ;
: close-box? ( event -- ? ) : close-box? ( event -- ? )
dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom = dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom =
swap XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom = swap XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom =