• Mouse wheel events apparently not working in canvas on macOS with Tk9.0.1

    From Eric Brunel@eric.brunel@pragmadev.com to comp.lang.tcl on Mon Feb 17 09:04:00 2025
    From Newsgroup: comp.lang.tcl

    Hello all,

    I'm seeing a weird issue with tcl/tk 9.0.1 on macOS: if I create a canvas
    and bind mouse wheel events on it, it doesn't seem to receive them. Here
    is a tiny script showing the problem:

    canvas .cnv
    pack .cnv -fill both -expand yes
    bind .cnv <MouseWheel> { puts "." }

    If I run that with tcl/tk 8.6.16 compiled from source on my mac mini (M1
    chip, macOS Ventura 13.2.1), it works as expected, the mouse wheel events
    are received and the "." are printed. If I do the same with tcl/tk 9.0.1, again compiled from source on the same machine, it doesn't work: no "." is printed.

    I tried with tcl/tk 9.0.1 also compiled from the source code on Windows
    and even Linux, and the same script works as expected: the mouse wheel
    events are received and the "." are printed. The only platform where it doesn't work is macOS.

    This looks like quite a big problem, so I'd be surprised if it had been missed. Can anyone confirm what I'm seeing here? Is there an issue with my installation?

    Thanks!
    --
    Eric
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Feb 17 10:19:41 2025
    From Newsgroup: comp.lang.tcl

    Hi Eric,
    the MouseWheel stuff had multiple changes with 9.0:
    - unification over platforms: https://core.tcl-lang.org/tips/doc/trunk/tip/474.md
    - the widget below the mouse receives it, not the focus widget.
    - two-finger scroll does not generate mousewheel: https://core.tcl-lang.org/tips/doc/trunk/tip/684.md

    If you find any news, please consider to contribute to the

    https://core.tcl-lang.org/tk/wiki?name=Migrating+scripts+to+Tk+9&p

    I have no MacOS, but maybe, this is helpful.
    If anything does not work after those hints, consider to file a bug
    report, as many core-close people dont look here.

    Take care,
    Harald

    Am 17.02.2025 um 10:04 schrieb Eric Brunel:
    Hello all,

    I'm seeing a weird issue with tcl/tk 9.0.1 on macOS: if I create a canvas
    and bind mouse wheel events on it, it doesn't seem to receive them. Here
    is a tiny script showing the problem:

    canvas .cnv
    pack .cnv -fill both -expand yes
    bind .cnv <MouseWheel> { puts "." }

    If I run that with tcl/tk 8.6.16 compiled from source on my mac mini (M1 chip, macOS Ventura 13.2.1), it works as expected, the mouse wheel events
    are received and the "." are printed. If I do the same with tcl/tk 9.0.1, again compiled from source on the same machine, it doesn't work: no "." is printed.

    I tried with tcl/tk 9.0.1 also compiled from the source code on Windows
    and even Linux, and the same script works as expected: the mouse wheel
    events are received and the "." are printed. The only platform where it doesn't work is macOS.

    This looks like quite a big problem, so I'd be surprised if it had been missed. Can anyone confirm what I'm seeing here? Is there an issue with my installation?

    Thanks!

    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Eric Brunel@eric.brunel@pragmadev.com to comp.lang.tcl on Mon Feb 17 09:51:26 2025
    From Newsgroup: comp.lang.tcl

    On Mon, 17 Feb 2025 10:19:41 +0100, Harald Oehlmann wrote:
    Am 17.02.2025 um 10:04 schrieb Eric Brunel:
    Hello all,

    I'm seeing a weird issue with tcl/tk 9.0.1 on macOS: if I create a
    canvas and bind mouse wheel events on it, it doesn't seem to receive
    them. Here is a tiny script showing the problem:

    canvas .cnv pack .cnv -fill both -expand yes bind .cnv <MouseWheel> {
    puts "." }

    If I run that with tcl/tk 8.6.16 compiled from source on my mac mini
    (M1 chip, macOS Ventura 13.2.1), it works as expected, the mouse wheel
    events are received and the "." are printed. If I do the same with
    tcl/tk 9.0.1, again compiled from source on the same machine, it
    doesn't work: no "." is printed.

    I tried with tcl/tk 9.0.1 also compiled from the source code on Windows
    and even Linux, and the same script works as expected: the mouse wheel
    events are received and the "." are printed. The only platform where it
    doesn't work is macOS.

    This looks like quite a big problem, so I'd be surprised if it had been
    missed. Can anyone confirm what I'm seeing here? Is there an issue with
    my installation?

    Thanks!

    Hi Eric,
    the MouseWheel stuff had multiple changes with 9.0:
    - unification over platforms: https://core.tcl-lang.org/tips/doc/trunk/tip/474.md - the widget below
    the mouse receives it, not the focus widget.
    - two-finger scroll does not generate mousewheel: https://core.tcl-lang.org/tips/doc/trunk/tip/684.md

    If you find any news, please consider to contribute to the

    https://core.tcl-lang.org/tk/wiki?name=Migrating+scripts+to+Tk+9&p

    I have no MacOS, but maybe, this is helpful.
    If anything does not work after those hints, consider to file a bug
    report, as many core-close people dont look here.

    Take care,
    Harald


    Hello Harald and thanks a lot for your answer, which is a big help indeed.
    I happen to have an Apple so-called "Magic Mouse", which actually has no scroll wheel and where the scroll is done by sliding your fingers on the
    top mouse surface. And it seems that tk considers this like a touch pad.
    So if I change my script to handle TouchpadScroll events - which I should
    have done in the first place -, it works as expected.

    Not sure if it needs a precision on the "Migrating" page, since bindings
    for the TouchpadScroll events will be needed anyway.

    Thanks again!
    --
    Eric

    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Feb 17 10:57:20 2025
    From Newsgroup: comp.lang.tcl

    Am 17.02.2025 um 10:51 schrieb Eric Brunel:
    On Mon, 17 Feb 2025 10:19:41 +0100, Harald Oehlmann wrote:
    Am 17.02.2025 um 10:04 schrieb Eric Brunel:
    Hello all,

    I'm seeing a weird issue with tcl/tk 9.0.1 on macOS: if I create a
    canvas and bind mouse wheel events on it, it doesn't seem to receive
    them. Here is a tiny script showing the problem:

    canvas .cnv pack .cnv -fill both -expand yes bind .cnv <MouseWheel> {
    puts "." }

    If I run that with tcl/tk 8.6.16 compiled from source on my mac mini
    (M1 chip, macOS Ventura 13.2.1), it works as expected, the mouse wheel
    events are received and the "." are printed. If I do the same with
    tcl/tk 9.0.1, again compiled from source on the same machine, it
    doesn't work: no "." is printed.

    I tried with tcl/tk 9.0.1 also compiled from the source code on Windows
    and even Linux, and the same script works as expected: the mouse wheel
    events are received and the "." are printed. The only platform where it
    doesn't work is macOS.

    This looks like quite a big problem, so I'd be surprised if it had been
    missed. Can anyone confirm what I'm seeing here? Is there an issue with
    my installation?

    Thanks!

    Hi Eric,
    the MouseWheel stuff had multiple changes with 9.0:
    - unification over platforms:
    https://core.tcl-lang.org/tips/doc/trunk/tip/474.md - the widget below
    the mouse receives it, not the focus widget.
    - two-finger scroll does not generate mousewheel:
    https://core.tcl-lang.org/tips/doc/trunk/tip/684.md

    If you find any news, please consider to contribute to the

    https://core.tcl-lang.org/tk/wiki?name=Migrating+scripts+to+Tk+9&p

    I have no MacOS, but maybe, this is helpful.
    If anything does not work after those hints, consider to file a bug
    report, as many core-close people dont look here.

    Take care,
    Harald


    Hello Harald and thanks a lot for your answer, which is a big help indeed.
    I happen to have an Apple so-called "Magic Mouse", which actually has no scroll wheel and where the scroll is done by sliding your fingers on the
    top mouse surface. And it seems that tk considers this like a touch pad.
    So if I change my script to handle TouchpadScroll events - which I should have done in the first place -, it works as expected.

    Not sure if it needs a precision on the "Migrating" page, since bindings
    for the TouchpadScroll events will be needed anyway.

    Thanks again!

    Great, that it works now.
    Yes, this point is mentioned on the page already.
    On a "real" touchpad, it is great, that x and y scrolling is now
    separated. You can really fine-control scrolling in both directions and
    do scroll in any angle.

    Take care,
    Harald
    --- Synchronet 3.20c-Linux NewsLink 1.2