Paste: Why does editor pass some handled gestures?

Author: Georg Simon
Mode: factor
Date: Tue, 18 Aug 2015 05:28:58
Plain Text |
USING:
    accessors io kernel sequences
    ui ui.gadgets.borders ui.gadgets.editors ui.gestures
    ;
IN: editor-gestures

TUPLE: main-gadget < border
    ;
M: main-gadget handle-gesture ( gesture gadget -- ? )
    drop gesture>string [ print flush ] when*
    t
    ;
M: main-gadget handles-gesture? ( gesture gadget -- ? )
    2drop t
    ;
: <main-gadget> ( child gap -- border )
    [ main-gadget new-border ] dip >>size
    ;
: main ( -- )
    [   <editor>
        "Why does editor pass some gestures like 'C+c' or 'C+v'"
        "on to it's parent although they were handled ?"
        "\n" glue over set-editor-string
        { 9 9 } <main-gadget> "" open-window
        ]
    with-ui
    ;
MAIN: main

Annotation: commented and without gesture>string

Author: Georg Simon
Mode: factor
Date: Wed, 19 Aug 2015 12:09:37
Plain Text |
! Look for gestures which editor passes to it's parent 
! and prettyprint them.
! On my Linux system
! - UP     is not handled and passed as I would expect
! - DELETE is handled and not passed as I would expect but
! - C+c    is handled and passed
USING:
    accessors io kernel prettyprint
    ui ui.gadgets.borders ui.gadgets.editors ui.gestures
    ;
IN: editor-gestures

TUPLE: main-gadget < border
    ;
M: main-gadget handle-gesture ( gesture gadget -- ? )
    drop
    dup key-down? [
        dup T{ key-down } = [
            drop ! modifier
        ] [
            . flush
            ] if
    ] [
        drop ! not key-down
        ] if
    t
    ;
M: main-gadget handles-gesture? ( gesture gadget -- ? )
    2drop t
    ;
: <main-gadget> ( child gap -- border )
    [ main-gadget new-border ] dip >>size
    ;
: main ( -- )
    [   <editor>
        "Try copy and paste here, DELETE, and UP."
        over set-editor-string
        { 9 9 } <main-gadget> "" open-window
        ]
    with-ui
    ;
MAIN: main

New Annotation

Summary:
Author:
Mode:
Body: