diff --git a/basis/x11/clipboard/clipboard.factor b/basis/x11/clipboard/clipboard.factor index c08ff1d176..496b9d688c 100644 --- a/basis/x11/clipboard/clipboard.factor +++ b/basis/x11/clipboard/clipboard.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2006, 2007 Slava Pestov +! Copyright (C) 2006, 2010 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien.c-types alien.strings classes.struct io.encodings.utf8 kernel namespaces sequences @@ -10,8 +10,10 @@ IN: x11.clipboard ! and http://common-lisp.net/~crhodes/clx/demo/clipboard.lisp. : XA_CLIPBOARD ( -- atom ) "CLIPBOARD" x-atom ; - : XA_UTF8_STRING ( -- atom ) "UTF8_STRING" x-atom ; +: XA_TARGETS ( -- atom ) "TARGETS" x-atom ; +: XA_TIMESTAMP ( -- atom ) "TIMESTAMP" x-atom ; +: XA_TEXT ( -- atom ) "TEXT" x-atom ; TUPLE: x-clipboard atom contents ; @@ -43,16 +45,14 @@ TUPLE: x-clipboard atom contents ; : set-targets-prop ( evt -- ) [ dpy get ] dip [ requestor>> ] [ property>> ] bi - "TARGETS" x-atom 32 PropModeReplace - { - "UTF8_STRING" "STRING" "TARGETS" "TIMESTAMP" - } [ x-atom ] int-array{ } map-as + XA_TARGETS 32 PropModeReplace + XA_UTF8_STRING XA_STRING XA_TARGETS XA_TIMESTAMP int-array{ } 4sequence 4 XChangeProperty drop ; : set-timestamp-prop ( evt -- ) [ dpy get ] dip [ requestor>> ] - [ property>> "TIMESTAMP" x-atom 32 PropModeReplace ] + [ property>> XA_TIMESTAMP 32 PropModeReplace ] [ time>> ] tri 1 XChangeProperty drop ; diff --git a/basis/x11/events/events.factor b/basis/x11/events/events.factor index 1a5b94c241..949c751de5 100644 --- a/basis/x11/events/events.factor +++ b/basis/x11/events/events.factor @@ -1,7 +1,8 @@ -! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov +! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays classes.struct combinators kernel -math.order namespaces x11 x11.xlib ; +USING: accessors arrays classes.struct combinators +combinators.short-circuit kernel math.order namespaces +x11 x11.xlib ; IN: x11.events GENERIC: expose-event ( event window -- ) @@ -75,7 +76,11 @@ GENERIC: client-event ( event window -- ) : event-dim ( event -- dim ) [ width>> ] [ height>> ] bi 2array ; +: XA_WM_PROTOCOLS ( -- atom ) "WM_PROTOCOLS" x-atom ; +: XA_WM_DELETE_WINDOW ( -- atom ) "WM_DELETE_WINDOW" x-atom ; + : close-box? ( event -- ? ) - [ message_type>> "WM_PROTOCOLS" x-atom = ] - [ data0>> "WM_DELETE_WINDOW" x-atom = ] - bi and ; + { + [ message_type>> XA_WM_PROTOCOLS = ] + [ data0>> XA_WM_DELETE_WINDOW = ] + } 1&& ; diff --git a/basis/x11/windows/platforms.txt b/basis/x11/windows/platforms.txt deleted file mode 100644 index 509143d863..0000000000 --- a/basis/x11/windows/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -unix diff --git a/basis/x11/windows/windows.factor b/basis/x11/windows/windows.factor index fb267ef4bb..1becb30f45 100644 --- a/basis/x11/windows/windows.factor +++ b/basis/x11/windows/windows.factor @@ -1,8 +1,9 @@ -! Copyright (C) 2005, 2006 Eduardo Cavazos and Slava Pestov +! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel math math.bitwise math.vectors -namespaces sequences x11 x11.xlib x11.constants x11.glx arrays -fry classes.struct literals ; +namespaces sequences arrays fry classes.struct literals +x11 x11.xlib x11.constants x11.events +x11.glx ; IN: x11.windows CONSTANT: create-window-mask @@ -78,7 +79,7 @@ CONSTANT: event-mask dpy get swap XDestroyWindow drop ; : set-closable ( win -- ) - dpy get swap "WM_DELETE_WINDOW" x-atom 1 + dpy get swap XA_WM_DELETE_WINDOW 1 XSetWMProtocols drop ; : map-window ( win -- ) dpy get swap XMapWindow drop ;