FlorianRhiem / pyGLFW

Python bindings for GLFW
MIT License
232 stars 36 forks source link

Support Wayland with Linux wheels #46

Closed FlorianRhiem closed 4 years ago

FlorianRhiem commented 4 years ago

Currently, the Linux wheels are built on the manylinux2010 image with a few more X11-related libraries (libXinerama, libXrandr, libXcursor and libXi). This works well for X11 users, but on Wayland users still need to install the GLFW shared library themselves. Ideally, the Linux wheels would allow users of both X11 and Wayland to run GLFW without installing additional packages.

As far as I know, the wheel platform tags are all for X11 based systems so far. I'm not aware of any Wayland support for CentOS 6, which manylinux2010 is based on. manylinux2014 is based on CentOS 7, which seems to have some Wayland support, though it's not the default.

FlorianRhiem commented 4 years ago

manylinux2014 / CentOS 7 provides wayland-protocols version 1.14, but GLFW 3.3 requires at least 1.15. Manually building wayland-protocols solves this and the resulting shared library (built under manylinux2014 + extra packages + manual wayland-protocols) seems to work on Ubuntu 19.10.

The next step will be handling multiple included shared libraries and preferring one based on X11 or Wayland being active.

@almarklein When using Wayland, independent on how I built the library, the window decorations are missing. Is this an issue specific to my system, or is this "normal"? I'm using a system with a nvidia graphics card (GTX 970) and had to switch from the nvidia driver installed by Ubuntu 19.10 by default to the noveau driver to be able to use Wayland.

almarklein commented 4 years ago

I have a very similar experience: to use Wayland I first had to select "Intel Graphics" in the Nvidia control panel, otherwise the Wayland option is not available at the login screen. Not that much of an issue though.

However, I think I indeed had an undecorated window, and I don't think I've been able to get anything to work in it yet ... I thought that it might be my specific system, but the fact that you're seeing the same thing does not bode well :)

My guess is that Wayland support is still a bit iffy. Maybe it's simply to early.

FlorianRhiem commented 4 years ago

I've modified the search paths to include either a x11 or a wayland package subdirectory, depending on whether XDG_SESSION_TYPE is set to wayland or not, and the new manylinux2014 wheel includes a shared library in each of these directories. This wheel is only available for x86_64, as there were more dependencies missing in the 32-bit repo.

These changes are currently in the feature-wayland-library branch. Here are the wheels built from it: dist.zip

FlorianRhiem commented 4 years ago

@almarklein Does anything speak against this from your side? If not I'll release a new version with these changes.

almarklein commented 4 years ago

This approach looks sound to me!

FlorianRhiem commented 4 years ago

I've released this as part of version 1.11.0.