-
Notifications
You must be signed in to change notification settings - Fork 2k
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
PS uses XWayland and ignores GDK_BACKEND on Wayland #8284
Comments
The override was added as a response to #4691, #2515. The combination of wxWidgets+GTK3+Wayland crashed, which also some consider to be a bad practice. And those issues are not that old. Did you compile PrusaSlicer yourself? With what wxWidgets version? It is possible that just a certain combination is affected. It is also possible that the situation has a better fix. |
I just tried to build PS without It doesn't break while calling X11 methods anymore as in #4691 but now I see segfault that comes somewhere from PS when it calls
|
@gudvinr I believe that @YuSanka has also seen the If we knew when the Wayland issue disappeared (with which wxWidgets version), maybe we could do the env variable override conditionally. The two issues were reported by package maintainers who link against 3.0.x. |
I believe that related issue was fixed in 3.1.5, according to their changelog:
I believe so because issues were related to call from 3.1.6 has some changes related to locale:
This is likely fixable on PS side though unless it is an upstream issue. |
@gudvinr We tried to remove the override after upgrading to wxWidgets 3.1.6. It is true that the application no longer crashes. However, it is also practically unusable: It may or may not have a simple fix. As of now, we are not investing time into it, there are higher priority issues. If someone knows how to fix it, let us know. Thanks. When these issues are fixed (providing it is not caused by a bug in wxWidgets), we will disable the Click to expand!--- a/src/PrusaSlicer.cpp
+++ b/src/PrusaSlicer.cpp
@@ -57,6 +57,10 @@
#include "slic3r/GUI/GUI_Init.hpp"
#endif /* SLIC3R_GUI */
+#ifdef __WXGTK__
+ #include <wx/version.h>
+#endif
+
using namespace Slic3r;
static PrinterTechnology get_printer_technology(const DynamicConfig &config)
@@ -71,10 +75,13 @@ int CLI::run(int argc, char **argv)
set_current_thread_name("slic3r_main");
#ifdef __WXGTK__
+ #if !wxCHECK_VERSION(3, 1, 5)
// On Linux, wxGTK has no support for Wayland, and the app crashes on
// startup if gtk3 is used. This env var has to be set explicitly to
// instruct the window manager to fall back to X server mode.
+ // This was supposedly fixed in wxWidgets 3.1.5 (https://github.com/prusa3d/PrusaSlicer/issues/8284)
::setenv("GDK_BACKEND", "x11", /* replace */ true);
+ #endif
#endif
// Switch boost::filesystem to utf8.
</details> |
@lukasmatena thanks for investigation. Do you see these issues only if Wayland backend is used or is it an issue you see in X11 too with wx 3.1.6? |
@gudvinr As far as I know, the issue is on Wayland only. @tamasmeszaros will correct me if not. |
read this! Not only, there is no any notification when you move window. Not only in GTK4! Codeblocks uses wxAui... and you can't move undocked widgets! |
@tamasmeszaros investigated the Wayland / OpenGL context issue. It took him multiple days to produce a simple reproducible code snippet to reproduce the issue. Until this issue is resolved, we will have to resort to X11 emulation. |
Thank you guys for doing a research and even going beyond that and creating high quality issue report. I hope now since wx released 3.2 now it will get some traction there. |
Hi, I'm also getting a segfault that appears to be at It sounds like you've got a repro and everything, but let me know if there's anything I can do to help. Is there any workaround for this? I immediately get a segfault whether I run with GDK_BACKEND=x11 or not. |
@mijoharas what build are you using and where you got it? |
I have this issue with arch build but I assume that is because they switched to wx 3.2 and this is exact same issue as we discussed before which happens on wx 3.1.6. |
Yep, I'm also using the arch build and having this problem. |
@gudvinr @mijoharas Your issues have nothing to do with Wayland or PrusaSlicer. They are caused by Arch packaging: #8299 (comment) |
Yeah, that is basically what we were talking about in may
What they should've done instead is package new release as wxgtk and old one as wxgtk30 or something similar as it is done regularly with electron packages. That way it is possible to link all packages to 3.0 release and gradually switch over to 32 as it is more widely adopted. But they decided to push it next day after release. In any case it is completely separate topic which has nothing to do with Wayland support as you already said |
@lukasmatena issue was possibly fixed in wxWidgets/wxWidgets@952de60 Also it's in https://www.wxwidgets.org/news/2023/10/wxwidgets-3.2.3-released/ |
I got the native Wayland build working by upgrading wxWidgets & some other small fixups in I didn't rest it extensively, so it's probably subtly broken in some places, but the basic slicer functionality & webview all seem to be working fine (I'm on Fedora 40 with GNOME) |
It is likely won't be accepted. You just replaced prusa's patched version of wxWidgets to vanilla wxWidgets without revisiting existing patches. Either patches should be upstreamed or dropped if not needed anymore (and that's what prusa should do) or you need to update prusa3d/wxWidgets instead. |
That's fine, I don't really have the expertise to get the PR into the state where it could be merged as-is, as I cannot even test it on Windows or MacOS. It's more a proof-of-concept and if someone wants to do a private build that's mostly functional. I looked into the Prusa patches on top of wxWidgets 3.2.0 and it seems to be mostly about the dark mode functionality. If I have some time I'll try cherrypicking them on top of 3.2.5. |
Description of the bug
When used in Wayland session, PS uses XWayland.
It does so by explicitly overriding
GDK_BACKEND
environment variable.It is stated here that wxGTK doesn't support Wayland, which it does since 2013.
There were some issues with wxWidgets not working properly under Wayland over the years so this stance should be revisited at least.
In any case, "fixing" this by overriding user-defined environment variables can be considered a bad programming practice.
Here's proof of it being run under XWayland.
From practical standpoint, that leads to blurry fonts when fractional scaling is used:
Project file & How to reproduce
Issue isn't related to any particular project.
Checklist of files included above
Version of PrusaSlicer
2.4.2
Operating system
Linux (Arch Linux, KDE Plasma 5.24, GTK3 3.24.33)
Printer model
Not applicable
The text was updated successfully, but these errors were encountered: