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

8270874: JFrame paint artifacts when dragged from standard monitor to HiDPI monitor #6339

Closed
wants to merge 2 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Nov 10, 2021

The bug occurs more often if initially the window is moved partly outside of the first screen(let's name this part as the invisible part), and then slowly moved to the second screen where that invisible part became visible on the second screen.

The problem is how we try to repaint the frame. The Windows send us coordinates to repaint in the device space, if the width/height values are less than a unit in the user's space, we round it to the empty rectangle and skip it.

Solution: request to repaint the smallest non-empty bounding box in the user's space around the region of pixels.

Workaround: repaint the whole window on the component resize/move event or at the end of the drag.

Notes:

  • It is not reproducible(at least much less often) when d3d is enabled because the d3d pipeline sends repaint events more often (example 8275715: D3D pipeline processes multiple PaintEvent at initial drawing #6064). That hides the current issue.
  • It started to be reproducible during the drag from one screen to another after JDK-8211999 because before JDK-8211999 we make a resize at the end of the drag, which caused the full repaint of the window.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8270874: JFrame paint artifacts when dragged from standard monitor to HiDPI monitor

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6339/head:pull/6339
$ git checkout pull/6339

Update a local copy of the PR:
$ git checkout pull/6339
$ git pull https://git.openjdk.java.net/jdk pull/6339/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6339

View PR using the GUI difftool:
$ git pr show -t 6339

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6339.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 10, 2021

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 10, 2021

@mrserb The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Nov 10, 2021
@mrserb mrserb marked this pull request as ready for review November 10, 2021 21:33
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 10, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 10, 2021

Webrevs

@jayathirthrao
Copy link
Member

Please correct my understanding. Does this refined repaint logic apply even for overlapping Windows? What happens when 2 windows are overlapping and we move top window slowly? Any performance/power impact?

@mrserb
Copy link
Member Author

mrserb commented Nov 16, 2021

Please correct my understanding. Does this refined repaint logic apply even for overlapping Windows? What happens when 2 windows are overlapping and we move top window slowly? Any performance/power impact?

Initially, this code was used just for that, to make a fast blit of the content from the Swing back buffer to the native window, when some other window is moved over the Swing and damaged it (the fix for the "grey rectangle" JDK-4967886). But since Windows Vista the Windows itself maintain such doublebuffer and the content is not damaged when windows overlap, so this callback is not called.

@jayathirthrao
Copy link
Member

Please correct my understanding. Does this refined repaint logic apply even for overlapping Windows? What happens when 2 windows are overlapping and we move top window slowly? Any performance/power impact?

Initially, this code was used just for that, to make a fast blit of the content from the Swing back buffer to the native window, when some other window is moved over the Swing and damaged it (the fix for the "grey rectangle" JDK-4967886). But since Windows Vista the Windows itself maintain such doublebuffer and the content is not damaged when windows overlap, so this callback is not called.

Thanks for the clarification

@openjdk
Copy link

openjdk bot commented Nov 17, 2021

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8270874: JFrame paint artifacts when dragged from standard monitor to HiDPI monitor

Reviewed-by: jdv

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 93 new commits pushed to the master branch:

  • 23e5117: 8276559: (httpclient) Consider adding an HttpRequest.Builder.HEAD method to build a HEAD request.
  • a77d8dd: 8276787: Improve warning messages for -XX:+RecordDynamicDumpInfo
  • 8ed384c: 8276609: Document setting property jdk.serialFilter to an invalid value throws ExceptionInInitializerError
  • cddc6ce: 8275811: Incorrect instance to dispose
  • b0a463f: 8169468: NoResizeEventOnDMChangeTest.java fails because FS Window didn't receive all resizes!
  • e5ffdf9: 8276231: ciReplay: SIGSEGV when replay compiling lambdas
  • d5e47d6: 8277089: Use system binutils to build hsdis
  • f3eb501: 8276162: Optimise unsigned comparison pattern
  • 9a9a157: 8276905: Use appropriate macosx_version_minimum value while compiling metal shaders
  • 7906eb0: 8277119: Add asserts in GenericTaskQueueSet methods
  • ... and 83 more: https://git.openjdk.java.net/jdk/compare/daf77ebfc4ca6d537ef55acbd62b908b5575ad08...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 17, 2021
@mrserb
Copy link
Member Author

mrserb commented Nov 18, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Nov 18, 2021

Going to push as commit 03473b4.
Since your change was applied there have been 127 commits pushed to the master branch:

  • ce0f00f: 8276093: Improve naming in closures to iterate over card sets
  • 5d249c4: 8275071: [macos] A11y cursor gets stuck when combobox is closed
  • 354a34e: 8277336: Improve CollectedHeap::safepoint_workers comments
  • 276bfcd: 8277407: javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java fails to compile after JDK-8276058
  • d93b238: 8277180: Intrinsify recursive ObjectMonitor locking for C2 x64 and A64
  • 00c388b: 8259643: ZGC can return metaspace OOM prematurely
  • a44b45f: 4337793: Mark non-serializable fields of java.security.cert.Certificate and CertPath
  • b3a62b4: 8276795: Deprecate seldom used CDS flags
  • 38345bd: 8277137: Set OnSpinWaitInst/OnSpinWaitInstCount defaults to "isb"/1 for Arm Neoverse N1
  • 2c06bca: 8266368: Inaccurate after_unwind hook in C2 exception handler
  • ... and 117 more: https://git.openjdk.java.net/jdk/compare/daf77ebfc4ca6d537ef55acbd62b908b5575ad08...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 18, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 18, 2021
@openjdk
Copy link

openjdk bot commented Nov 18, 2021

@mrserb Pushed as commit 03473b4.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb mrserb deleted the JDK-8270874 branch November 18, 2021 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants