Created attachment 109223 [details]
Test file with a single 'note' annotation
'note' annotations (the ones from the top entry of the annotation toolbar) should be selectable by clicking on them. However, with the current git master I can only select them by clicking on the (roughly) top-left quadrant. I will attach an example document and corresponding screenshot.
This used to work, and I suspect that it broke when the hidpi branch was merged.
I am using fractional scaling with
Created attachment 109224 [details]
Screenshot showing the selected annotation. Note how the grey selection rectangle only covers the top-left quadrant.
Hi Oliver! Could you give the patch from https://phabricator.kde.org/D9615 a try and tell if it fixes the bug you've found?
Tobias, thanks for looking into this. Strangely, your patch doesn't change anything here. Did you see any change in behavior using the pdf file that is attached here? Please let me know how I can help you to debug this further.
I guess this is for the same reason as why QT_SCREEN_SCALE_FACTORS works generally unexpected in my setup. See https://bugs.kde.org/show_bug.cgi?id=388458#c2, there are obviously two different DPI settings in effect at once. I have to research a bit on this and hopefully can figure out what's the correct resolution to consider for the icon size calculation.
Ah, wrong guess. Indeed, I can reproduce the error when using your attached PDF file. This happens because the annotation was created and saved to the document before the patch was applied. The saved metadata still holds the wrong annotation size. If you create a new annotation instead, the rectangle size should be fixed. Can you confirm this?
Recreating the file does not solve the problem, because it was actually created using LaTeX, i.e., without okular. So maybe this is a bug in the LaTeX pdfcomment package? I'll attach the source file just in case.
Created attachment 109649 [details]
LaTeX source of the test file
Sorry, I wasn't aware you used latex to create the annotation. The patch currently only works when creating the notes with Okulars own annotating tools (the ones you get with F6). I have not yet considered externally created annotations. Good hint, will do that.
Here's an analysis of what happens for your document:
Your PDF has page size 56.693 x 56.693 pts (from pdfinfo).
LaTex created your annotation object with a /Rect [ 23.448 39.927 35.403 51.882 ] (inspected with qpdf --qdf --object-streams=disable).
I.e., LaTex set the icon size to 11,955 x 11,955 pts (width=35.403-23.448, heigth = 51.882-39.927).
There's no embedded appearance. That's ok, default icon shall be used.
When loading the file to Okular, Poppler reports annotation boundary metadata: l = 0,413596, t = 0,084861, r = 0,624469, b = 0,295733.
Now we can denormalize those values for verification, using page width * (r-l) and page height * (b-t): That's 11,955 x 11,955 pts again.
=> The same as in /Rect, all fine until now!
Now comes Poppler and forces the icon to size 24 x 24 pts during rendering, see . It doesn't update metadata accordingly.
Okular can't know about that 24 x 24 pts. It looks at values derived from l, t, r, b and draws the rectangle for a icon of size 11,96 x 11,96 pts.
This is not even related to HiDPI. I get the same misfit in normal DPI mode. I think Poppler should really not ignore the values in /Rect. We need to decide if we want to go for an workaround in Okular (overwrite metadata with hardcoded known values), or if we try to solve it in poppler. I'd suggest to discuss this in https://phabricator.kde.org/D9615.
Oliver, would you give the Poppler patch from https://phabricator.kde.org/F5620896 a try? Is anybody interested in discussing this issue with the Poppler guys? I'd do it, but only with a mandate from the Okular team:)
Hi Tobias, I'll try the patch later today. As for the poppler guys: Albert, the poppler maintainer, must be reading this anyway. Albert, your opinion & expertise would be appreciated here.
I tried the poppler patch and things look much better. The size of the frame is now basically correct, but the position is a few pixels off. I'll attach a new screenshot.
Created attachment 109693 [details]
Screenshot with Tobias' poppler patch
Created attachment 109698 [details]
Screenshot with poppler patch, take 2
Thanks for testing Oliver. Hm, the Poppler patch produces an exact match under all conditions for me, no idea what causes the few pixel offset at your side. Doesn't matter much yet, just wanted to show that it could be done within Poppler. If we decided to fix it in Poppler, we'll have to improve the patch until it's good enough anyway.
For the poppler part I've just started a more elaborated patch series at https://bugs.freedesktop.org/show_bug.cgi?id=105692#c4. Would be nice to receive comments/reviews there.
Hi Tobias, I see myself unable to judge these patches, but do you want me to test anything?
Hi Oliver, thanks for the offer! Not yet. I hope for interest, discussion, and eventually agreement on how it should be. Then we can go into testing.
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/412