On Thu, 4 Jan 2024 17:47:42 GMT, Martin Fox <m...@openjdk.org> wrote:

>> When reporting input method candidate position the code in 
>> GlassViewEventHandler is not applying the platform scale factors. This is 
>> causing incorrect IM positions to be reported to glass on hi-dpi monitors.
>> 
>> This PR a no-op on Mac since the platform scale factors are always 1.0. I 
>> don't think it affects the current Linux XIM code at all but XIM is so 
>> out-of-date it has become difficult to test. PR #1080 will replace the old 
>> XIM code and needs this fix to work properly on hi-dpi screens.
>
> Martin Fox has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Better handling of multiple monitors when converting IM coords

This is closer, but doesn't correctly handle the case where a window straddles 
two screens. In that case, you really do want the screen associated with the 
window (even though that might seem a bit counter-intuitive). That's what's 
done pretty consistently in the rest of the code.

To test this, configure two screens with different scale factors, and move the 
window partially onto one screen such that most of the window (and importantly 
the scale associated with that window) is on one screen, an d the text 
insertion point is on the other.

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassViewEventHandler.java
 line 678:

> 676: 
> 677:         for (Screen scr : Screen.getScreens()) {
> 678:             Rectangle2D bounds = new Rectangle2D(scr.getX(), scr.getY(), 
> scr.getWidth(), scr.getHeight());

To correctly handle the case of a window straddling two screens, you need the 
screen associated with the window, not the screen that the anchor point 
intersects.

-------------

PR Review: https://git.openjdk.org/jfx/pull/1311#pullrequestreview-1805048829
PR Review Comment: https://git.openjdk.org/jfx/pull/1311#discussion_r1442300561

Reply via email to