bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50487:  Image :map area is not correct in Windows HiDPI environment


From: tsuucat
Subject: bug#50487:  Image :map area is not correct in Windows HiDPI environment
Date: Sun, 12 Sep 2021 05:58:09 -0000

Emacs version: 28.0.50
Window system: Windows (Windows 10)

Image descriptors :map can create hot-spot for an image.
The area will be specified as (rect . ((0 . 0) . (200 . 300))), but
this will not be reflected correctly in my HiDPI environment.

Reproduce steps:
1: eval following to insert image.
```
(require 'svg)
(let ((start (point))
      (end (progn (insert "x") (point))))
  (put-text-property
   start end 'display
   (let ((svg (svg-create 400 300)))
     (svg-rectangle svg 0 0 200 300 :fill "blue")
     (svg-rectangle svg 200 0 200 300 :fill "green")
     (svg-image svg :map '(((rect . ((0 . 0) . (200 . 300))) left-area (help-echo "left-area"))
               ((rect . ((200 . 0) . (400 . 300))) right-area (help-echo "right-area")))))))
```
2: move mouse cursor on image.
expected: when mouse is on blue rectangle area, tool-tip "left-area" appears.
actual: The area which tool-tip "left-area" appears doesn't match blue rectangle area.
The area which tool-tip "left-area"appears is smaller than expected.

My screen scale is 200%. If I change the scale to 100%, Emacs works
correctly. So I think this is HiDPI-related problem.

After more investigation, it seems that this is not a problem limited
to the Windows High DPI environment. Because the function `find_hot_spot`
does not take :scale value into account, the area appears to be misaligned.

Either find_hot_spot needs to be adapted to take :scale into account, or we
need to document that :map only works well when :scale is 1.0.

--
tsuucat

reply via email to

[Prev in Thread] Current Thread [Next in Thread]