Skip to content

[GTK] Can draw outside window on Wayland #3145

@tmssngr

Description

@tmssngr

Describe the bug
It is possible easily by setting clipping to draw outside a window (shell) on Wayland.

To Reproduce
Run following snippet on a Wayland system:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class DrawOutsideShell {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        Composite composite = new Composite(shell, SWT.DOUBLE_BUFFERED);
        composite.setBounds(-50, 0, 500, 250);
        composite.addListener(SWT.Paint, event -> {
            event.gc.setClipping(0, 0, 500, 250);
            event.gc.fillRectangle(0, 0, 500, 250);
        });
        shell.setSize(300, 200);
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }
}

Expected behavior
The drawing area is clipped to the controls/shells bounds, no matter what clipping area is set by the user.

Screenshots
Image

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)
    Tried on latest Fedora and on Linux Mint with experimental Wayland support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions