Fix build on macOS due to not having Wayland (variant 2)
Wayland-specific stuff is guarded by #ifdef Q_OS_UNIX,
which also matches macOS.
Replaced with #ifdef HAVE_WAYLAND guard.
The guard is based on __has_include feature of C++17.
BUG: 497136
(cherry picked from commit 31a0953ff5385d077e10296d56a530afd453e9e3)