simon-git: puzzles (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Feb 22 12:55:47 GMT 2023


TL;DR:
  9d7c2b8 JS puzzles: use the PointerEvent API if available.
  90e2c75 Normalise pathnames in assert statements where possible.

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-22 12:55:47

commit 9d7c2b8c83506c1f239c840e372058fac603b255
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=9d7c2b8c83506c1f239c840e372058fac603b255;hp=5c858253f9456b970be5d5ef3e7df727d39e3da7
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Feb 22 12:36:59 2023 +0000

    JS puzzles: use the PointerEvent API if available.
    
    If the browser knows what 'PointerEvent' means, then we switch our
    'onmousefoo' event handlers to the 'onpointerfoo' events, for both the
    puzzle canvas and the resize handle.
    
    The immediate effect of this is that we get to use the
    setPointerCapture method on the puzzle canvas, in preference to the
    deprecated Firefox-only setCapture.
    
    A pointer event also contains extra fields compared to a mouse event:
    as well as telling you which pointing device the event comes from, it
    can also provide extra information, such as pressure, or the angle of
    a stylus if the hardware can detect it. I don't have any immediate
    ideas about what those could be used for, but it can't hurt to have
    them available just in case we think of something in future.

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

commit 90e2c7539be4fce1b6dad397109f3c4927db1594
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=90e2c7539be4fce1b6dad397109f3c4927db1594;hp=9d7c2b8c83506c1f239c840e372058fac603b255
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Feb 22 12:46:32 2023 +0000

    Normalise pathnames in assert statements where possible.
    
    After commit 1470c9530b1cff3 enabled assertions, I found that my build
    scripts were complaining that the Windows binaries built from the same
    source twice were not generating the same output, and it turned out to
    be because the use of __FILE__ in every assert was baking in a
    pathname from my build setup containing a mkstemp()-randomised path
    component.
    
    I've found the '-fmacro-prefix-map' option, available in both gcc and
    clang (except the archaic gcc used by my NestedVM build, alas), which
    lets you remap pathnames for purpose of what __FILE__ expands to. So
    now our assertion statements should look as if the puzzle source just
    lived in /puzzles, and (just in case a pathname in a generated header
    ever becomes relevant) the cmake build directory is /build.

 cmake/setup.cmake | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)



More information about the tartarus-commits mailing list