Re: [Factor-talk] Why does editor pass some handled gestures?
Nice investigation. This should go in the docs somewhere, particularly that parents gadget must pass gestures to the parent for the actions to work. For example in http://docs.factorcode.org/content/article-action-gestures.html ? diff --git a/basis/ui/gestures/gestures-docs.factor b/basis/ui/gestures/gestures-docs.factor index a12ec35..f7e034f 100644 --- a/basis/ui/gestures/gestures-docs.factor +++ b/basis/ui/gestures/gestures-docs.factor @@ -430 +430 @@ ARTICLE: action-gestures Action gestures -The following keyboard gestures, if not handled directly, send action gestures: +The following keyboard gestures, if not handled directly by any gadget in the hierarchy until reaching the world, are re-sent as action gestures to the first gadget: Also, in worlds.factor: action-gestures [ [ [ { C+ } ] dip f key-down ] [ '[ _ send-action ] ] bi* ] H{ } assoc-map-as so macos has the some actions with the command keys from ./basis/ui/backend/cocoa/views/views.factor and also the actions from the control key resent by the world ? Maybe add a note for that describing the exact mechanism.. I haven't read the code and don't have a mac to confirm how it works, but is it something like Additionally, On Mac OS X, action gestures are directly sent when using the Command key or Menu Items ? Jon On Mon, Aug 24, 2015 at 12:08 PM, Georg Simon georg.si...@auge.de wrote: As far as I understand the answer to my question is as follows : editor passes C+c, C+s, and so on to it's parent. All parents should pass them too. In world waits a gesture-handler. It handles keypresses for which action gestures exist. The corresponding action gesture is sent to editor. editor either handles the action gesture or passes it to it's parent. http://paste.factorcode.org/paste?id=3608 -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does editor pass some handled gestures?
As far as I understand the answer to my question is as follows : editor passes C+c, C+s, and so on to it's parent. All parents should pass them too. In world waits a gesture-handler. It handles keypresses for which action gestures exist. The corresponding action gesture is sent to editor. editor either handles the action gesture or passes it to it's parent. http://paste.factorcode.org/paste?id=3608 -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does editor pass some handled gestures?
Thank you. Sorry for the wrong syntax. Now it seems to me that editor receives both C+c and copy-action when I type C+c. With http://paste.factorcode.org/paste?id=3590#1634 I see that - UP is not handled and passed to parent as I would expect - DELETE is handled and not passed to parent as I would expect but - C+cis handled AND passed to parent. The last behaviour is cumbersome and I do not understand it's purpose. Am Wed, 19 Aug 2015 09:42:30 +0200 schrieb Jon Harper jon.harpe...@gmail.com: Hi Georg, You have 2 problems in IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f First, see http://docs.factorcode.org/content/article-keyboard-gestures.html for the correct syntax: IN: scratchpad T{ key-down f { C+ } l } editor get-gesture-handler . [ \ select-line invoke-command ] Second, copy paste has a mechanism to work as C+c on linux/windows and Cmd+c on mac: see http://docs.factorcode.org/content/article-action-gestures.html and http://docs.factorcode.org/content/word-action-modifier,ui.gestures.html (The docs are a little light on this point though..) IN: scratchpad \ copy-action editor get-gesture-handler . [ \ com-copy invoke-command ] Hope that helps! Jon On Wed, Aug 19, 2015 at 7:01 AM, Georg Simon georg.si...@auge.de wrote: Thank you. What you describe is what I use. And I do not want an editor that always passes gestures. But now it comes to C+c, C+v, C+x, C+y, and C+z. There is no gesture-handler in editor for them: IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f But they work. They work as expected as copy, paste, cut, redo, and undo. And they are documented in http://docs.factorcode.org/content/article-gadgets-editors-commands.html How can I detect in my program that C+c works but for instance C+d not? Am Tue, 18 Aug 2015 07:37:24 -0700 schrieb John Benediktsson mrj...@gmail.com: If you look at the docs for handle-gesture, it says Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.. http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html I would guess it's because your editor is wrapped by a main-gadget and any actions that are ui.commands are handled by the editor and not passed to the parent gadget. https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425 So, left is handled (meaning ``f`` don't pass to parent): IN: scratchpad T{ key-down f f LEFT } editor get-gesture-handler . [ \ previous-character invoke-command ] IN: scratchpad T{ key-down f f LEFT } editor handle-gesture . f But, up is not (because it isn't a multiline-editor): IN: scratchpad T{ key-down f f UP } editor get-gesture-handler . f IN: scratchpad T{ key-down f f UP } editor handle-gesture . t If you want an editor that always passes gestures, then... TUPLE: my-editor editor ; : my-editor ( -- editor ) my-editor new-editor ; M: my-editor handle-gesture call-next-method drop t ; Hope that helps! On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de wrote: Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does editor pass some handled gestures?
Hi Georg, You have 2 problems in IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f First, see http://docs.factorcode.org/content/article-keyboard-gestures.html for the correct syntax: IN: scratchpad T{ key-down f { C+ } l } editor get-gesture-handler . [ \ select-line invoke-command ] Second, copy paste has a mechanism to work as C+c on linux/windows and Cmd+c on mac: see http://docs.factorcode.org/content/article-action-gestures.html and http://docs.factorcode.org/content/word-action-modifier,ui.gestures.html (The docs are a little light on this point though..) IN: scratchpad \ copy-action editor get-gesture-handler . [ \ com-copy invoke-command ] Hope that helps! Jon On Wed, Aug 19, 2015 at 7:01 AM, Georg Simon georg.si...@auge.de wrote: Thank you. What you describe is what I use. And I do not want an editor that always passes gestures. But now it comes to C+c, C+v, C+x, C+y, and C+z. There is no gesture-handler in editor for them: IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f But they work. They work as expected as copy, paste, cut, redo, and undo. And they are documented in http://docs.factorcode.org/content/article-gadgets-editors-commands.html How can I detect in my program that C+c works but for instance C+d not? Am Tue, 18 Aug 2015 07:37:24 -0700 schrieb John Benediktsson mrj...@gmail.com: If you look at the docs for handle-gesture, it says Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.. http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html I would guess it's because your editor is wrapped by a main-gadget and any actions that are ui.commands are handled by the editor and not passed to the parent gadget. https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425 So, left is handled (meaning ``f`` don't pass to parent): IN: scratchpad T{ key-down f f LEFT } editor get-gesture-handler . [ \ previous-character invoke-command ] IN: scratchpad T{ key-down f f LEFT } editor handle-gesture . f But, up is not (because it isn't a multiline-editor): IN: scratchpad T{ key-down f f UP } editor get-gesture-handler . f IN: scratchpad T{ key-down f f UP } editor handle-gesture . t If you want an editor that always passes gestures, then... TUPLE: my-editor editor ; : my-editor ( -- editor ) my-editor new-editor ; M: my-editor handle-gesture call-next-method drop t ; Hope that helps! On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de wrote: Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does editor pass some handled gestures?
Thank you. What you describe is what I use. And I do not want an editor that always passes gestures. But now it comes to C+c, C+v, C+x, C+y, and C+z. There is no gesture-handler in editor for them: IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler . f But they work. They work as expected as copy, paste, cut, redo, and undo. And they are documented in http://docs.factorcode.org/content/article-gadgets-editors-commands.html How can I detect in my program that C+c works but for instance C+d not? Am Tue, 18 Aug 2015 07:37:24 -0700 schrieb John Benediktsson mrj...@gmail.com: If you look at the docs for handle-gesture, it says Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.. http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html I would guess it's because your editor is wrapped by a main-gadget and any actions that are ui.commands are handled by the editor and not passed to the parent gadget. https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425 So, left is handled (meaning ``f`` don't pass to parent): IN: scratchpad T{ key-down f f LEFT } editor get-gesture-handler . [ \ previous-character invoke-command ] IN: scratchpad T{ key-down f f LEFT } editor handle-gesture . f But, up is not (because it isn't a multiline-editor): IN: scratchpad T{ key-down f f UP } editor get-gesture-handler . f IN: scratchpad T{ key-down f f UP } editor handle-gesture . t If you want an editor that always passes gestures, then... TUPLE: my-editor editor ; : my-editor ( -- editor ) my-editor new-editor ; M: my-editor handle-gesture call-next-method drop t ; Hope that helps! On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de wrote: Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] Why does editor pass some handled gestures?
If you look at the docs for handle-gesture, it says Outputs f if the gesture was handled, and t if the gesture should be passed on to the gadget's parent.. http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html I would guess it's because your editor is wrapped by a main-gadget and any actions that are ui.commands are handled by the editor and not passed to the parent gadget. https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425 So, left is handled (meaning ``f`` don't pass to parent): IN: scratchpad T{ key-down f f LEFT } editor get-gesture-handler . [ \ previous-character invoke-command ] IN: scratchpad T{ key-down f f LEFT } editor handle-gesture . f But, up is not (because it isn't a multiline-editor): IN: scratchpad T{ key-down f f UP } editor get-gesture-handler . f IN: scratchpad T{ key-down f f UP } editor handle-gesture . t If you want an editor that always passes gestures, then... TUPLE: my-editor editor ; : my-editor ( -- editor ) my-editor new-editor ; M: my-editor handle-gesture call-next-method drop t ; Hope that helps! On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de wrote: Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
[Factor-talk] Why does editor pass some handled gestures?
Ubuntu 14.04.2 LTS Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24 04:52:05 2014) [GCC 4.8.2] on linux In the test program http://paste.factorcode.org/paste?id=3590 BACKSPACE and DELETE don't appear in the terminal as they are handled by editor. UP and DOWN appear in the terminal as they are not handled by editor. But C+c and C+v appear in the terminal although they are handled by editor. In my application I can catch them separately when I know they are handled by editor. But is there a better way? -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk