Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8150954

Taking screenshots on x11 composite desktop produce wrong result

    XMLWordPrintable

Details

    • b130
    • linux

    Backports

      Description

        The Robot code that grabs the content of the screen uses the default root window. On composite desktop the root window does not contain the final composited desktop, so screenshots taken using this window will generally have black areas instead of transparent or translucent ones, as is demonstrated on the attached screenshots.

        The proposed solution is to determine if the desktop is composited or not, and then get a reference to the correct window id, which is either the root window or the compositor owned one.

        This bug is quite likely related to:

        https://bugs.openjdk.java.net/browse/JDK-7043455

        I believe that the original fix that was backed out by 7043455 because it was trying to acquire the composite window, which is wrong since the XCompositeGetOverlayWindow would always return a valid window id.

        The proposed fix uses an Atom to detect if the window manager is a composite wm:

        https://specifications.freedesktop.org/wm-spec/1.4/ar01s08.html

        Attachments

          1. screenshot-non-xcomp.png
            screenshot-non-xcomp.png
            694 kB
          2. screenshot-patched-non-xcomp.png
            screenshot-patched-non-xcomp.png
            696 kB
          3. ScreenshotTaker.java
            0.8 kB
          4. screenshot-unpatched-xcomp.png
            screenshot-unpatched-xcomp.png
            2.53 MB
          5. screenshot-xcomp.png
            screenshot-xcomp.png
            2.74 MB

          Issue Links

            Activity

              People

                neugens Mario Torre
                neugens Mario Torre
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: