Language used
I am using C ++ 14 with cmake for my program.
Problem:
I would like to know how I can find out if a Linux system uses Wayland or X11 as a window system in order to be able to use both APIs in my source code without conflict. Thus, creating a window with Wayland when Wayland is available, and otherwise use the X11 API.
Note: I know there is XWayland, but I want to use the native X11 and the native Wayland without something like XWayland.
EDIT: To clarify some things: I do not want to check X11 or Wayland at compile time, but instead at run time , because then I just have to compile the code once and the user does not need to think about which version to use.
source share