simon-git: puzzles (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Feb 23 08:57:03 GMT 2023


TL;DR:
  ecd868a Revert "JS puzzles: use the PointerEvent API if available."

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2023-02-23 08:57:03

commit ecd868ac6e7ab3df4984ff29a16c7158339611a3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=ecd868ac6e7ab3df4984ff29a16c7158339611a3;hp=90e2c7539be4fce1b6dad397109f3c4927db1594
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 23 08:46:56 2023 +0000

    Revert "JS puzzles: use the PointerEvent API if available."
    
    This reverts commit 9d7c2b8c83506c1f239c840e372058fac603b255.
    
    I thought that switching from the JS 'mousedown', 'mousemove' and
    'mouseup' events to the corresponding 'pointer*' events would make
    essentially no difference except that the pointer events would come
    with more information. But in fact it turns out that there's a
    fundamental change of semantics.
    
    If you press one mouse button down and then, without releasing it,
    press a second one, then the mouse API will send you this information
    in the form of two 'mousedown' events, one for each button. But the
    pointer API will only send you a 'pointerdown' for the first event,
    when the state of the pointer changes from 'no buttons down' to 'at
    least one button down'. The second button press will be delivered as a
    'pointermove', in which the 'buttons' field is different from its
    previous value.
    
    I'm backing out the migration to PointerEvent for the moment, because
    that's too complicated for a trivial fix. In simple cases we could
    easily detect the changed buttons field in the pointermove handler and
    generate a call to the C side of this front end's mousedown()
    function, effectively converting the changed JS representation to the
    one the C was already expecting. But this also has to interact with
    our one-button support (converting Ctrl and Shift clicks into a
    different logical button) _and_ with the ad-hoc mechanism we use to
    avoid delivering buttonless mouse movements to the C side. So getting
    it right in all cases at once isn't trivial, and I'd rather revert the
    attempt now and think about it later than commit to getting it all
    perfect on short notice.

 emccpre.js | 42 ++++++++----------------------------------
 1 file changed, 8 insertions(+), 34 deletions(-)



More information about the tartarus-commits mailing list