Skip to content

"Positioning" does not work under pure Wayland #170

Open

Description

@mkurz

After making things work on Linux aarch64 (#168) I can not run PDF-Over correctly in a KDE Wayland session.


When forcing Xwayland it works:
GDK_BACKEND=x11 java -cp './pdf-over-build/lib/*' at.asit.pdfover.gui.Main "$@"
Image

However trying pure Wayland mode does not work:

GDK_BACKEND=wayland java -cp './pdf-over-build/lib/*' at.asit.pdfover.gui.Main "$@"
Image

I did read your comment so it seems you are aware of that and set GDK_BACKEND to force Xwayland for now:

GDK_BACKEND=x11,wayland exec $BASEDIR/jre/bin/java -cp "$BASEDIR/lib/*" at.asit.pdfover.gui.Main "$@"

But I would be interested

  • did you find out already what the exact problem is? Is it in your code? Or is it that a third party dependency you are using that takes care of that preview and positioning is broken?

Also, can we keep this issue open just to keep track of Wayland support?

Thanks!

Activity

  1. mkurz commented on Dec 11, 2025

    @mkurz
    ContributorAuthor

    Also, since Gnome already dropped the X11 backend, and KDE will do so as well in 2027 I hope this gets fixed. I know for many years we can still just force Xwayland, however even GTK will drop the x11 backend with gtk5, so the GDK_BACKEND=x11 workaround will stop working someday (still many years away however).

  2. mkurz commented on Sep 1, 2026

    @mkurz
    ContributorAuthor

    Small clarification after digging into this further:

    PDF-Over is already mostly capable of running as a native Wayland application. Its main UI uses SWT’s GTK backend, so when launched without forcing GDK_BACKEND=x11, GTK can create the SWT Shell directly on Wayland. This explains why most of the UI works and why xeyes does not track the pointer over it.

    This does not mean that OpenJDK 21’s AWT supports Wayland. The problem is specifically the positioning view:

    • PositioningComposite creates an SWT.EMBEDDED composite and calls SWT_AWT.new_Frame(...).
    • The embedded SignaturePanel is a Swing JPanel.
    • On Linux, SWT’s SWT_AWT.new_Frame() uses sun.awt.X11.XEmbeddedFrame, so this embedding path is inherently X11-based.

    A native Wayland SWT window therefore cannot host that X11 embedded frame in the same way. The underlying limitation is in the SWT/AWT bridge, but the actionable problem in PDF-Over is our use of that bridge - not PDFBox or the PDF renderer.

    This also explains the launcher setting:

    GDK_BACKEND=x11,wayland

    GTK tries those backends in order, so it chooses X11 whenever XWayland is available. That keeps SWT and AWT on the same X11 backend and makes positioning work, but prevents the application from using native Wayland.

    I have a local local branch which replaces the embedded AWT/Swing preview with a pure SWT Canvas. That removes the X11-specific bridge and should allow the complete UI, including positioning, to run natively on Wayland.

  3. mkurz commented on Sep 1, 2026

    @mkurz
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions