Skip to content

Screenshots on Wayland are always white [Snippet215] #673

Open
@DieterMaiSysgo

Description

@DieterMaiSysgo

Describe the bug
When creating a screenshot as described by Snippet215, the resulting image is all white. I would expect that the image instead contains a content reflecting the pixels displayed when the screenshot was taken.

To Reproduce
Easiest would be to execute Snippet215 on Ubuntu 22.
But essentially the following code seems not to work

	GC gc = new GC(display);
	Rectangle bounds = display.getBounds();
	final Image image = new Image(display, display.getBounds());
	gc.copyArea(image, 0, 0);

Expected behavior
I would expect to be able to create an screenshot with SWT. Preferably as demonstrated in Snippet215

Screenshots
SWT screenshot issue

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    I tested this on Windows 10, Ubuntu 20 and Ubuntu 22. Only Ubuntu 22 has this issue.

  2. JRE/JDK version
    Tested with JDK 17

Version since
Tested with 4.26 and 4.27. Both had the same issue

Workaround (or) Additional context
I was not able to find a workaround.
I found this issue while investigating why our SWTBot test does not produce any screenshots. SWTBot uses SWT to create screenshot in a similar way as Snippet215

Kind regards
Dieter Mai

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions