tsadowski wrote: ↑
Sat Oct 20, 2018 3:26 pm
I kept the option name SPNAV_USE_X11. The option has nothing to do with Wayland directly and the polling driver works under both window systems.
Just to explain why I suggested USE_WAYLAND, in case it's educational (I spend/waste a lot of time dealing with state management like this, and so want to prevent wastage for others):
We have, in a sense, two bits of state that need to be captured here: are we using space navigator or not, and which API. We already have precompiler switches for space navigator, so all that we really need to add is a bit of state for the API choice. One API only works with X11, and the general consensus seems to be that X11 is slowly on the way out the door. And, so at some stage X11 is simply obsolete and we'll strip the X11 code out of FreeCAD. As far as I'm aware, there's no existing switch that says "Use X11" on Linux, as it's just assumed to be that way.
In the X11->Wayland transitional period, it's possible we will need that X11/Wayland switch elsewhere. Further in the future, Wayland (or whatever wins in the nearer term) will be replaced by something else, so at that stage we'll probably need the switch between Wayland and NewThing. So, I think it makes more sense to add a Wayland switch, than an X11 one. At this point, each is just the inverse of the other, so it's an arbitrary decision, but down the track we may need a different switch for Wayland/NewThing - this gives a weak preference to relating the new switch to Wayland.
Another way to put it: assuming we go with SPNAV_USE_X11, if we later add an X11/Wayland switch, we'll then have redundant state. The right thing to do then, would then be to go modify this code again to throw an error if the Wayland switch is set, and SPNAV_USE_X11 is too, because they conflict.