Fix Wayland work-around for COSMIC, and add to the PyPI entry point - #602
Merged
Merged
Conversation
The work-around from CadQuery#575 lives only in run.py, the PyInstaller entry point (pyinstaller.spec runs Analysis(['run.py'])), which is not shipped in the wheel. Installs from PyPI enter at cq_editor.cqe_run:main and never ran it -- CadQuery#266 was reported against the cq-editor console script, so the fix did not reach it. Additionally: skipping the fix-up whenever QT_QPA_PLATFORM is already set reads the variable as user intent, but COSMIC and others export "wayland;xcb" session-wide, so on exactly those systems nothing happened and the viewer still died with BadWindow. Move the logic to cq_editor/qt_platform.py, called from both entry points, and reorder the plugin list rather than replacing it: wayland* entries are demoted but kept, so an explicitly requested plugin is still reachable as a fallback and an offscreen or eglfs choice is untouched. Only an unset variable defaults to xcb.
|
I confirm that this commit made it possible to run cq-editor under kde 6.7.5 (arch) |
Member
|
Thanks @willstott101 One thing to consider:
|
Contributor
Author
|
That makes sense - I mostly went this way to be similar to #575 I'll test and push an update to simplify it to one call site soon(-ish). |
willstott101
force-pushed
the
wayland-platform-fix
branch
from
September 20, 2026 18:21
76fdae7 to
d234d31
Compare
Reorder QT_QPA_PLATFORM so Qt reaches a Wayland plugin only after everything else has failed to load, defaulting to xcb when unset. Desktops such as COSMIC export "wayland;xcb" session-wide; we respect that config as far as possible without running on Wayland. On Wayland occt_widget hands winId() to OCP's Xw_Window, which needs an X11 window id and gets a Wayland surface id instead, dying with BadWindow. OCCT does not yet support Wayland. Inline in __main__ (rather than a separate module) as it must run before the QApplication is created, and both cqe_run and `python -m cq_editor` import it.
willstott101
force-pushed
the
wayland-platform-fix
branch
from
September 20, 2026 18:24
d234d31 to
4ad8f65
Compare
Contributor
Author
|
I have de-duplicated the calls, and then inlined the function, I don't think it warrants it's own module anymore with one call-site. |
Member
|
Thanks @willstott101 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The work-around from #575 lives only in run.py, the PyInstaller entry point (pyinstaller.spec runs Analysis(['run.py'])), which is not shipped in the wheel. Installs from PyPI enter at cq_editor.cqe_run:main and never ran it -- #266 was reported against the cq-editor console script, so the fix did not reach it.
Additionally: skipping the fix-up whenever QT_QPA_PLATFORM is already set reads the variable as user intent, but COSMIC and others export "wayland;xcb" session-wide, so on exactly those systems nothing happened and the viewer still died with BadWindow.
Move the logic to cq_editor/qt_platform.py, called from both entry points, and reorder the plugin list rather than replacing it: wayland* entries are demoted but kept, so an explicitly requested plugin is still reachable as a fallback and an offscreen or eglfs choice is untouched. Only an unset variable defaults to xcb.