Subject: bug#21348: bug#21469: bug#21348: 25.0.50; Screen scaling factor >=2 causes menus, tooltips to display in the wrong place

From: martin rudalics <[email-masked]>
Date: Tue, 13 Oct 2015 17:51:42 +0200

> I wrote a patch to fix the issues from bugs #20619 and #21348 for GTK
 > users. When the functions to display a tooltip or menu are called, Emacs
 > scales coordinates using a factor from GTK. In my testing, non-GTK
 > tooltips and menus weren't broken, so the problem is specific to GTK and
 > the patch has no effect on non-GTK builds.

Thank you very much Ryan.  Your help is very appreciated.

 > Michael Droettboom, will you
 > apply this patch and verify that the menus are now placed correctly on
 > your system?

Michael, pretty please, do that.  If you have any problems applying the
patch or building Emacs, please tell us.  It would be great to fix and
test this before the release.

 > There's something else entirely going on with the scroll bars in bug
 > #21469, this patch doesn't address that at all. I had never noticed that
 > hidpi bug because I dont use scroll bars, but I can confirm that turning
 > on scroll bars causes strange behavior.

Is the behavior you see "consistent"?  Robert's screenhots seem to tell
that the x-position of each scrollbar is always twice of what it should
be.

 > It might be possible that a
 > similar scaling strategy for scroll bar placement could provide a fix,
 > so I CC'd that bug. I will investigate that more as time allows.

That would be great.

 > The final hidpi bug I looked at, #18429, I am unable to
 > reproduce. Perhaps it is not applicable to my platform - I'm on Ubuntu
 > Trusty, while the reporter is on Utopic. Anders Kaseorg, can you still
 > reproduce the bug?

Let's hope that Anders is listening.

 > Finally, there's the open question of why the coordinates these
 > functions are getting are doubled in the first place. Given my limited
 > familiarity with Emacs internals, I have not made any progress on that
 > question. Perhaps there are few enough places where these
 > sometimes-inflated coordinates are passed into GTK that we can just
 > scale them everywhere and call it good enough.

I don't see any problems with such a solution.

 > Or perhaps there's a more
 > robust solution somewhere else - if anybody can help explain this to me,
 > I would be appreciative.

Are the frame parameters ‘top’ and ‘left’ affected?  Suppose you do say
(set-frame-parameter nil 'left 500) with scaling in effect.  Does the
frame appear 500 pixels left of the left screen edge?  If not, then
mouse warping (‘set-mouse-absolute-pixel-position’) is probably affected
too and we really have to look into a more generic solution.

martin