Skip to content

Commit

Permalink
Merge pull request #1887 from whot/wip/warn-on-xwayland
Browse files Browse the repository at this point in the history
x11: log a warning if we're running against Xwayland
  • Loading branch information
p12tic committed Mar 12, 2024
2 parents 9c88618 + 396317e commit 08d43e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/newsfragments/warn-on-xwayland.feature
@@ -0,0 +1 @@
InputLeap now warns when connecting to Xwayland.
10 changes: 10 additions & 0 deletions src/lib/platform/XWindowsScreen.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
{
Expand Down
1 change: 1 addition & 0 deletions src/lib/platform/XWindowsScreen.h
Expand Up @@ -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;
Expand Down

0 comments on commit 08d43e7

Please sign in to comment.