FreeCAD natively under Gnome/Wayland

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
tsadowski
Posts: 18
Joined: Tue Jan 20, 2015 10:50 pm

FreeCAD natively under Gnome/Wayland

Postby tsadowski » Thu Jan 10, 2019 10:54 pm

Hi,

with Qt 5.12 it is possible to run FreeCAD natively under Wayland. All window decorations are nicely drawn. It is also crisper on HiDPI displays because scaling is handled better. I had to hack the Coin3d build to prevent the linking with libglx, because otherwise FreeCAD would crash as soon as a new document is created or opened.

Cheers, Torsten
Attachments
FreeCAD_Wayland.png
FreeCAD_Wayland.png (395.1 KiB) Viewed 425 times
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FreeCAD natively under Gnome/Wayland

Postby NormandC » Fri Jan 11, 2019 1:48 am

Thank you for your report, Torsten. I had been wondering about it, since Linux distros are gradually phasing out the old X server.
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: FreeCAD natively under Gnome/Wayland

Postby yorik » Fri Jan 11, 2019 12:18 pm

Very nice!! Haven't tried wayland yet, but it's impressive to see that a complex 3D app with lots of (some old) dependencies like freecad works...
User avatar
Kunda1
Posts: 4092
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD natively under Gnome/Wayland

Postby Kunda1 » Fri Jan 11, 2019 12:22 pm

@tsadowski can you show the code that you hacked to make this happen ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
tsadowski
Posts: 18
Joined: Tue Jan 20, 2015 10:50 pm

Re: FreeCAD natively under Gnome/Wayland

Postby tsadowski » Fri Jan 11, 2019 10:43 pm

It was quite easy. Coin works without glx for FreeCAD probably because the funtionality is not needed by FreeCAD and Coin has a dummy implementation. I just had to add a patch to the Arch build recipy:
https://aur.archlinux.org/packages/coin-hg/

not to find glx:

Code: Select all

diff -ura coin/CMakeLists.txt coin.new/CMakeLists.txt
--- coin/CMakeLists.txt 2019-01-10 00:06:52.081521372 +0100
+++ coin.new/CMakeLists.txt     2019-01-10 00:08:32.785648305 +0100
@@ -431,7 +431,7 @@
   check_include_files("GL/gl.h" HAVE_GL_GL_H)
   check_include_files("GL/glu.h" HAVE_GL_GLU_H)
   check_include_files("GL/gl.h;GL/glext.h" HAVE_GL_GLEXT_H)
-  check_include_files("GL/glx.h" HAVE_GLX_H)
+#  check_include_files("GL/glx.h" HAVE_GLX_H)
 endif()
 
 check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
@@ -459,9 +459,9 @@
 check_symbol_exists(CGL_VERSION_1_0 OpenGL/OpenGL.h HAVE_CGL)
 set(HAVE_CGL_PBUFFER ${HAVE_CGL})
 
-if(NOT (HAVE_WGL OR HAVE_AGL OR HAVE_CGL))
-  check_library_exists(GL glXChooseVisual "" HAVE_GLX)
-endif()
+#if(NOT (HAVE_WGL OR HAVE_AGL OR HAVE_CGL))
+#  check_library_exists(GL glXChooseVisual "" HAVE_GLX)
+#endif()
 
 if(HAVE_WINDOWS_H)
   set(SIM_INCLUDE_WINDOWS_H "#include <windows.h>")
I tried to add some runtime workarounds in FreeCAD but this is awkward and probably doomed. Coin probably needs to use EGL instead of GLX. I will check if there is an easy solution and contact the Coin team.

Cheers,
Torsten
triplus
Posts: 8342
Joined: Mon Dec 12, 2011 4:45 pm

Re: FreeCAD natively under Gnome/Wayland

Postby triplus » Wed Jan 23, 2019 11:12 pm

tsadowski wrote:
Fri Jan 11, 2019 10:43 pm
I will check if there is an easy solution and contact the Coin team.

Cheers,
Torsten
That would be great. Likely still a few years before Wayland becomes more widely used and majority of applications add support. But FreeCAD providing support should happen sooner rather than later. If possible. Therefore Coin3D needs to get adapted and as for the Qt. You likely had to use QtWayland module in the procedure somehow? Can Wayland/X11 option be set with an environment variable before starting FreeCAD?