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

Detect wayland and make sure X rendering is used. #1253

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

m-elwin
Copy link
Contributor

@m-elwin m-elwin commented Jul 25, 2024

This patch causes rviz to detect Wayland and sets it to X compatibility mode, enabling it to run under Wayland.

Currently rviz2 does not support wayland (Issue #847), meaning that rviz2 crashes (e.g., issue #1227, #1245) for Wayland users unless they do a manual workaround.

The current workaround of setting QT_QPA_PLUGIN has a few issues that make it less than ideal:

  1. If it is set globally it forces all other QT applications to use X even if they support Wayland.
  2. However, when using launchfiles that start rviz2, it needs to be set globally (or you need to modify the launch file) or rviz will crash on startup.

rviz2 does not work under wayland unless using X compatibility.
The current workaround on wayland is to set the QT_QPA_PLATFORM
environment variable to xcb.  This patch now detects
if rviz2 is started in a wayland session and if so sets that
variable automatically.

Signed-off-by: Matthew Elwin <[email protected]>
@m-elwin m-elwin requested a review from ahcorde as a code owner July 25, 2024 16:14
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround, that I'm fine with it for now, but we should work on natively support Wayland. @clalancette anything else to add ?

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

This is a workaround, that I'm fine with it for now, but we should work on natively support Wayland. @clalancette anything else to add ?

No, seems reasonable to me for now. I think we should also backport this to Jazzy.

@ahcorde ahcorde merged commit 72c0826 into ros2:rolling Jul 26, 2024
2 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented Jul 26, 2024

https://github.com/Mergifyio backport jazzy

Copy link

mergify bot commented Jul 26, 2024

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 26, 2024
rviz2 does not work under wayland unless using X compatibility.
The current workaround on wayland is to set the QT_QPA_PLATFORM
environment variable to xcb.  This patch now detects
if rviz2 is started in a wayland session and if so sets that
variable automatically.

Signed-off-by: Matthew Elwin <[email protected]>
(cherry picked from commit 72c0826)
ahcorde pushed a commit that referenced this pull request Jul 26, 2024
rviz2 does not work under wayland unless using X compatibility.
The current workaround on wayland is to set the QT_QPA_PLATFORM
environment variable to xcb.  This patch now detects
if rviz2 is started in a wayland session and if so sets that
variable automatically.

Signed-off-by: Matthew Elwin <[email protected]>
(cherry picked from commit 72c0826)

Co-authored-by: Matthew Elwin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants