diff --git a/doc/newsfragments/warn-on-xwayland.feature b/doc/newsfragments/warn-on-xwayland.feature new file mode 100644 index 000000000..6b228d3d4 --- /dev/null +++ b/doc/newsfragments/warn-on-xwayland.feature @@ -0,0 +1 @@ +InputLeap now warns when connecting to Xwayland. diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 26ad96afe..b5154cecf 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -118,6 +118,8 @@ XWindowsScreen::XWindowsScreen( m_keyMap); LOG_DEBUG("screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_xinerama ? "(xinerama)" : ""); LOG_DEBUG("window is 0x%08lx", m_window); + if (detectXwayland()) + LOG_WARN("Running against Xwayland. InputLeap will not work as expected"); } catch (...) { if (m_display != nullptr) { @@ -2025,6 +2027,14 @@ XWindowsScreen::detectXI2() "XInputExtension", &xi_opcode, &event, &error); } +bool +XWindowsScreen::detectXwayland() +{ + int opcode, event, error; + return m_impl->XQueryExtension(m_display, "XWAYLAND", + &opcode, &event, &error); +} + void XWindowsScreen::selectXIRawMotion() { diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index b084bb135..03ab5676e 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -143,6 +143,7 @@ class XWindowsScreen : public PlatformScreen { int y_accumulateMouseScroll(std::int32_t yDelta) const; bool detectXI2(); + bool detectXwayland(); void selectXIRawMotion(); void selectEvents(Window) const; void doSelectEvents(Window) const;