Subject: 28.0.91; posn-image fails below an image

From: "Roland Winkler" <[email-masked]>
Date: Tue, 25 Jan 2022 23:29:31 -0600

In 'emacs -Q' load

(defun foo (event)
  (interactive "e")
  (message "%simage"
           (if (posn-image (event-start event)) "" "not ")))
(global-set-key [down-mouse-1] 'foo)

Then visit a pbm image such as etc/images/gnus.pbm from GNU Emacs such
that the image is smaller than the window displaying the image.  Then
(left-) clicking inside the image gives the message "image" (fine).
Clicking on the right of the image gives the message "not image" (again fine).
However, clicking below the image again gives the message "image", when it
should be "not image".  (With emacs 27.2, clicking below the image gives
"not image".)

I noticed this with djvu-image-rect in djvu.el (GNU Elpa).

In GNU Emacs 28.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2022-01-16 built on regnitz
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix