Use App's x11 rootWindow and connection in PointerInputRedirection::warpXcbOnSurfaceLeft

It was already partially using the x11Connection and partially the global
connection. In order to prepare for removal of the global connection and
rootWindow, it is better to use only the newer variant through kwinApp.
This commit is contained in:
Martin Flöser 2017-08-24 13:26:45 +02:00
parent 651ea26f3c
commit 80c3fdd684

View file

@ -652,10 +652,11 @@ void PointerInputRedirection::warpXcbOnSurfaceLeft(KWayland::Server::SurfaceInte
// No XWayland, no point in warping the x cursor
return;
}
if (!kwinApp()->x11Connection()) {
const auto c = kwinApp()->x11Connection();
if (!c) {
return;
}
static bool s_hasXWayland119 = xcb_get_setup(kwinApp()->x11Connection())->release_number >= 11900000;
static bool s_hasXWayland119 = xcb_get_setup(c)->release_number >= 11900000;
if (s_hasXWayland119) {
return;
}
@ -669,8 +670,8 @@ void PointerInputRedirection::warpXcbOnSurfaceLeft(KWayland::Server::SurfaceInte
return;
}
// warp pointer to 0/0 to trigger leave events on previously focused X window
xcb_warp_pointer(connection(), XCB_WINDOW_NONE, rootWindow(), 0, 0, 0, 0, 0, 0),
xcb_flush(connection());
xcb_warp_pointer(c, XCB_WINDOW_NONE, kwinApp()->x11RootWindow(), 0, 0, 0, 0, 0, 0),
xcb_flush(c);
}
QPointF PointerInputRedirection::applyPointerConfinement(const QPointF &pos) const