diff --git a/source/Platform/Unix/X11Display.cpp b/source/Platform/Unix/X11Display.cpp index f4f2222..2fba1b7 100644 --- a/source/Platform/Unix/X11Display.cpp +++ b/source/Platform/Unix/X11Display.cpp @@ -368,7 +368,16 @@ void X11Display::showCursor(bool value) void X11Display::grabCursor(bool value) { - // TODO (this is abit harder on X11 than windows.) + if (value) { + int result = ::XGrabPointer(Xlib::getDisplay(), m_win, True, None, + GrabModeAsync, GrabModeAsync, m_win, None, CurrentTime); + + if (result != GrabSuccess) { + Log::info("X11: Cursor Grab failed"); + } + } else { + ::XUngrabPointer(Xlib::getDisplay(), CurrentTime); + } } void X11Display::processEvent(const ::XEvent& event)