• Can Tk 9.0 handle touch events of a touch display?

    From Robert Csok@robert.csok@gmx.de to comp.lang.tcl on Sat Dec 21 13:57:54 2024
    From Newsgroup: comp.lang.tcl

    Hello everyone,

    While reading through the “Highlights of Tk 9.0” I noticed the point “Platform Features and Conventions: many improvements, including
    two-finger gesture support where available”. I was initially pleased
    because I thought that Tcl 9 could react to touch events of a touch
    display. This function would make it easier to operate our cadastre application on devices with a touch-capable display (“Pinch To Zoom” etc.).

    However, I had to realize that this message probably refers more to the possibility of scrolling with two fingers on a touchpad (new event type “TouchpadScroll”). I also came across TIP 570, which describes the
    desired feature:

    https://core.tcl-lang.org/tips/doc/trunk/tip/570.md

    The proposal has been in a draft state since 2020.

    Can anyone give a hint on a possibility, trick or workaround to react to
    touch events of a touch display in a Tk application under Linux?

    Best regards

    Robert
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Sat Dec 21 17:45:39 2024
    From Newsgroup: comp.lang.tcl

    Robert,

    I have authored the TIP in 2020 and the described knowledge there has
    not changed.
    As it is clear that this in an important feature, there was never any
    movement here.
    Eventually, undrowish by Christian Werner has some support on Linux.

    On Windows, we only have the button press emulation, that's all.

    And the branch by Peter Sputh did not get any love since 2022.
    Aparently, Peters work also has some Mac aspects.

    Any initiative appreciated - we need that !

    Take care,
    Harald

    Am 21.12.2024 um 13:57 schrieb Robert Csok:
    Hello everyone,

    While reading through the “Highlights of Tk 9.0” I noticed the point “Platform Features and Conventions: many improvements, including two- finger gesture support where available”. I was initially pleased because
    I thought that Tcl 9 could react to touch events of a touch display.
    This function would make it easier to operate our cadastre application
    on devices with a touch-capable display (“Pinch To Zoom” etc.).

    However, I had to realize that this message probably refers more to the possibility of scrolling with two fingers on a touchpad (new event type “TouchpadScroll”). I also came across TIP 570, which describes the desired feature:

    https://core.tcl-lang.org/tips/doc/trunk/tip/570.md

    The proposal has been in a draft state since 2020.

    Can anyone give a hint on a possibility, trick or workaround to react to touch events of a touch display in a Tk application under Linux?

    Best regards

    Robert

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From undroidwish@undroidwish@googlemail.com to comp.lang.tcl on Sat Dec 21 22:29:40 2024
    From Newsgroup: comp.lang.tcl

    On 12/21/24 17:45, Harald Oehlmann wrote:

    And the branch by Peter Sputh did not get any love since 2022.
    Indeed is it part of vanillawish for Win32 since this check in

    https://www.androwish.org/home/info/35d71c4ec8

    Thus, it can be played with, tested, weight, and found to be
    too light or too heavy.

    Due to sheer LUCK, a current vanillawish isn't that far away
    for one's fingertips and mouse clicks. Read more in

    https://wiki.tcl-lang.org/page/LUCK

    Cheers,
    Christian
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From undroidwish@undroidwish@googlemail.com to comp.lang.tcl on Sat Dec 21 22:35:34 2024
    From Newsgroup: comp.lang.tcl

    On 12/21/24 22:29, undroidwish wrote:

    Due to sheer LUCK, a current vanillawish isn't that far away
    for one's fingertips and mouse clicks. Read more in

      https://wiki.tcl-lang.org/page/LUCK

    Aah, reading the OP thorougly I should have seen Linux. My bad.
    Then play with undroidwish which should have touch support by
    SDL2's design. And is part of LUCK, too.

    Cheers,
    Christian
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Robert Csok@robert.csok@gmx.de to comp.lang.tcl on Sat Mar 1 00:41:20 2025
    From Newsgroup: comp.lang.tcl

    Hello Harald,
    hello Christian,

    Thank you very much for your answers. I wanted to get back to you with
    some new information. First of all, I came across the Touchégg tool (https://github.com/JoseExposito/touchegg), but this tool is
    insufficient as it does not provide coordinates. It is more suitable for indirect touch devices such as touchpads, but not for touch-enabled
    displays. Then I tried to develop a solution that does not require any modification of Tk, and this solution works surprisingly well. Maybe I
    can make the code available. But perhaps the following hints are already useful for some of you:

    So the idea is (a bit similar to Touchégg) to start a helper program
    (e.g. "touchHelper") in the background for each window/widget that needs
    touch events. Within a Tk application, the window could be a canvas with
    a map, for example. The "touchHelper" acts as an additional X client
    that selects for touch events on a specific window and forwards them to
    the associated Tk application using Tk_SendObjCmd(), i.e. Tk's send command.

    The "touchHelper" uses libXi to select for the touch events (see XISelectEvents() from X11/extensions/XInput2.h). The events
    XI_TouchBegin, XI_TouchUpdate and XI_TouchEnd are selected on the
    specific window (ID) of the Tk application (determined by [winfo id
    window] in the Tk application and passed as a command line argument to
    the "touchHelper" together with [tk appname]). On the basis of these
    three events, a gesture recognition (swipe, pinch-to-zoom etc.) can be realized quite easily in Tcl.

    Care must be taken to ensure that the queue of the Tk application is not flooded with events from the "touchHelper"; this can be done in the "touchHelper" and/or in the Tk application, namely by ignoring
    XI_TouchUpdate events that are triggered too frequently (taking the XIDeviceEvent::time field into account). Furthermore, one must ensure
    that a touch event does not trigger an additional click in the Tk
    application (button 1 event), as it may interfere. This can be done
    using a grab in the "touchHelper", e.g. via XIGrabButton().

    I am aware that this is only a workaround for "legacy" Tk applications
    (on the X Window System). The long-term goal should of course be to make
    at least these three events (TouchBegin, TouchUpdate and TouchEnd)
    available in core Tk (via the bind command)

    I found the following blog posts helpful, even if they don't go too much
    into detail:
    http://who-t.blogspot.com/2009/05/xi2-recipes-part-1.html http://who-t.blogspot.com/2010/11/high-level-overview-of-grabs.html

    Best regards,
    Robert

    Am 21.12.24 um 17:45 Uhr schrieb Harald Oehlmann:
    Robert,

    I have authored the TIP in 2020 and the described knowledge there has
    not changed.
    As it is clear that this in an important feature, there was never any movement here.
    Eventually, undrowish by Christian Werner has some support on Linux.

    On Windows, we only have the button press emulation, that's all.

    And the branch by Peter Sputh did not get any love since 2022.
    Aparently, Peters work also has some Mac aspects.

    Any initiative appreciated - we need that !

    Take care,
    Harald

    Am 21.12.2024 um 13:57 schrieb Robert Csok:
    Hello everyone,

    While reading through the “Highlights of Tk 9.0” I noticed the point
    “Platform Features and Conventions: many improvements, including two-
    finger gesture support where available”. I was initially pleased
    because I thought that Tcl 9 could react to touch events of a touch
    display. This function would make it easier to operate our cadastre
    application on devices with a touch-capable display (“Pinch To Zoom”
    etc.).

    However, I had to realize that this message probably refers more to
    the possibility of scrolling with two fingers on a touchpad (new event
    type “TouchpadScroll”). I also came across TIP 570, which describes
    the desired feature:

    https://core.tcl-lang.org/tips/doc/trunk/tip/570.md

    The proposal has been in a draft state since 2020.

    Can anyone give a hint on a possibility, trick or workaround to react
    to touch events of a touch display in a Tk application under Linux?

    Best regards

    Robert


    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Mar 3 16:32:20 2025
    From Newsgroup: comp.lang.tcl

    Hello Robert,
    thanks a lot for your insights, this is appreciated.
    As stated before, I see it crucial to make this work.
    I am on Windows and anything is there but no love so far.
    Thanks for all,
    Harald

    Am 01.03.2025 um 00:41 schrieb Robert Csok:
    Hello Harald,
    hello Christian,

    Thank you very much for your answers. I wanted to get back to you with
    some new information. First of all, I came across the Touchégg tool (https://github.com/JoseExposito/touchegg), but this tool is
    insufficient as it does not provide coordinates. It is more suitable for indirect touch devices such as touchpads, but not for touch-enabled displays. Then I tried to develop a solution that does not require any modification of Tk, and this solution works surprisingly well. Maybe I
    can make the code available. But perhaps the following hints are already useful for some of you:

    So the idea is (a bit similar to Touchégg) to start a helper program
    (e.g. "touchHelper") in the background for each window/widget that needs touch events. Within a Tk application, the window could be a canvas with
    a map, for example. The "touchHelper" acts as an additional X client
    that selects for touch events on a specific window and forwards them to
    the associated Tk application using Tk_SendObjCmd(), i.e. Tk's send
    command.

    The "touchHelper" uses libXi to select for the touch events (see XISelectEvents() from X11/extensions/XInput2.h). The events
    XI_TouchBegin, XI_TouchUpdate and XI_TouchEnd are selected on the
    specific window (ID) of the Tk application (determined by [winfo id
    window] in the Tk application and passed as a command line argument to
    the "touchHelper" together with [tk appname]). On the basis of these
    three events, a gesture recognition (swipe, pinch-to-zoom etc.) can be realized quite easily in Tcl.

    Care must be taken to ensure that the queue of the Tk application is not flooded with events from the "touchHelper"; this can be done in the "touchHelper" and/or in the Tk application, namely by ignoring XI_TouchUpdate events that are triggered too frequently (taking the XIDeviceEvent::time field into account). Furthermore, one must ensure
    that a touch event does not trigger an additional click in the Tk application (button 1 event), as it may interfere. This can be done
    using a grab in the "touchHelper", e.g. via XIGrabButton().

    I am aware that this is only a workaround for "legacy" Tk applications
    (on the X Window System). The long-term goal should of course be to make
    at least these three events (TouchBegin, TouchUpdate and TouchEnd)
    available in core Tk (via the bind command)

    I found the following blog posts helpful, even if they don't go too much into detail:
    http://who-t.blogspot.com/2009/05/xi2-recipes-part-1.html http://who-t.blogspot.com/2010/11/high-level-overview-of-grabs.html

    Best regards,
    Robert

    Am 21.12.24 um 17:45 Uhr schrieb Harald Oehlmann:
    Robert,

    I have authored the TIP in 2020 and the described knowledge there has
    not changed.
    As it is clear that this in an important feature, there was never any
    movement here.
    Eventually, undrowish by Christian Werner has some support on Linux.

    On Windows, we only have the button press emulation, that's all.

    And the branch by Peter Sputh did not get any love since 2022.
    Aparently, Peters work also has some Mac aspects.

    Any initiative appreciated - we need that !

    Take care,
    Harald

    Am 21.12.2024 um 13:57 schrieb Robert Csok:
    Hello everyone,

    While reading through the “Highlights of Tk 9.0” I noticed the point >>> “Platform Features and Conventions: many improvements, including two- >>> finger gesture support where available”. I was initially pleased
    because I thought that Tcl 9 could react to touch events of a touch
    display. This function would make it easier to operate our cadastre
    application on devices with a touch-capable display (“Pinch To Zoom” >>> etc.).

    However, I had to realize that this message probably refers more to
    the possibility of scrolling with two fingers on a touchpad (new
    event type “TouchpadScroll”). I also came across TIP 570, which
    describes the desired feature:

    https://core.tcl-lang.org/tips/doc/trunk/tip/570.md

    The proposal has been in a draft state since 2020.

    Can anyone give a hint on a possibility, trick or workaround to react
    to touch events of a touch display in a Tk application under Linux?

    Best regards

    Robert



    --- Synchronet 3.20c-Linux NewsLink 1.2