Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jumpy Application Window When Moving Between Displays #500

Open
MichaelWDenney opened this issue Dec 3, 2024 · 5 comments
Open

Jumpy Application Window When Moving Between Displays #500

MichaelWDenney opened this issue Dec 3, 2024 · 5 comments

Comments

@MichaelWDenney
Copy link

Version of Radiance (latest release is 8.0-SNAPSHOT)

8.0-SNAPSHOT

Sub-project (Common, Animation, Theming, Component, ...)

Ribbon

Version of Java (current minimum is 9)

21.0.4+7

Version of OS

Windows 11

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

On a Windows, multi-display computer setup, attempting to drag the application Window from one display to another sometimes causes the Window to 'hiccup' as its being moved. It will jump back to a previous position while being dragged. For example, if you are dragging to a different display on the left, as it crosses the border between the two displays, it will jump back within the original display to the right. Although it is usually possible to just continue dragging and the Window eventually reaches the destination Window, at least one tester has reported that he was unable to ever get the Window to leave the original display.

This can be reproduced using the BasicCheckRibbon demo.

@kirill-grouchnikov
Copy link
Owner

Is this specific to Radiance, or do you see the same issue with a simple decorated frame under Metal look and feel?

@MichaelWDenney
Copy link
Author

Well, it is far from simple, but I switched our old GUI from before I began transitioning to Radiance to Metal look and feel and it drags smoothly.

We've discovered that the severity of the 'hiccup' is based on the scaling of your displays. At 100% scaling dragging seems smooth. At 150%, the hiccup occurs as you cross the boundaries between displays but can almost be ignored. At 200% the hiccup is very noticeable (the application Windows jumps back much farther). The user that reported they could not get the Window to leave the original display was at 200%. At 200%, you can get the Window to the other display if you ignore the hiccup, don't release the mouse button, and just keep dragging. Eventually the Window jumps in the other direction to the destination display. That's assuming you have enough real estate to keep dragging far enough.

It also appears that the problem is only with dragging right to left across displays. Dragging left to right seems smooth.

@kirill-grouchnikov
Copy link
Owner

It's been a while since I touched that code.

In Radiance it should be in https://github.com/kirill-grouchnikov/radiance/blob/sunshine/theming/src/main/java/org/pushingpixels/radiance/theming/internal/ui/RadianceRootPaneUI.java#L1199

In Metal it should be in https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java#L849

The logic overall is the same - get mouse event, and update the window location. However, there is a slight difference in how the event location is obtained. In Radiance it is through PointerInfo.getLocation() and in Metal it is through MouseEvent.getLocationOnScreen. So it might be that this would account for the difference at the "edge" between the two screens.

@kirill-grouchnikov
Copy link
Owner

There's another mouse event handler in https://github.com/kirill-grouchnikov/radiance/blob/sunshine/theming/src/main/java/org/pushingpixels/radiance/theming/internal/ui/RadianceRootPaneUI.java#L1432 that is using MouseEvent.getLocationOnScreen.

The original history of the first one place is now lost, unless it can somehow be reconstructed from the CVS mailing list archives, as the first historical drop from 2010 at https://github.com/kirill-grouchnikov/substance/blob/58d3873e7b2d57b110231dc867be8220ff02801a/src/org/pushingpixels/substance/internal/ui/SubstanceRootPaneUI.java#L1304 already had that.

I'll align both places to use MouseEvent.getLocationOnScreen once the current work for project Chroma is done.

@MichaelWDenney
Copy link
Author

I appreciate you taking a look. Assuming I set up our own fork to work on screen reader support before that (which would certainly be my intent), I'll probably take a look at making this change in our fork as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants