diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 536c709..3ccab5b 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -2304,4 +2304,43 @@ void QXcbConnectionGrabber::release()
     }
 }
 
+const QWindow *windowFor(WId wid)
+{
+    for (QWindow *w : QGuiApplication::allWindows()) {
+        QPlatformWindow *pw = w->handle();
+        if(pw && pw->winId() == wid)
+            return w;
+    }
+    return 0;
+}
+
+xcb_translate_coordinates_cookie_t
+Xcb_translate_coordinates (xcb_connection_t *c,
+                           xcb_window_t      src_window,
+                           xcb_window_t      dst_window,
+                           int16_t           src_x ,
+                           int16_t           src_y)
+{
+    qDebug()  << __FUNCTION__  << hex
+              << "src_window=" << src_window << windowFor(src_window)
+              << "dst_window=" << dst_window << windowFor(dst_window)
+              << dec << "x,y" << src_x << src_y;
+    return xcb_translate_coordinates (c, src_window, dst_window, src_x, src_y);
+ }
+
+xcb_translate_coordinates_cookie_t
+Xcb_translate_coordinates_unchecked (xcb_connection_t *c  /**< */,
+                                     xcb_window_t      src_window  /**< */,
+                                     xcb_window_t      dst_window  /**< */,
+                                     int16_t           src_x  /**< */,
+                                     int16_t           src_y  /**< */)
+{
+
+    qDebug()  << __FUNCTION__  <<  hex
+              << "src_window=" << src_window << windowFor(src_window)
+              << "dst_window=" << dst_window << windowFor(dst_window)
+              << dec << "x,y" << src_x << src_y;
+    return xcb_translate_coordinates_unchecked (c, src_window, dst_window, src_x, src_y);
+}
+
 QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 999dc06..775ba7f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -773,4 +773,28 @@ union q_padded_xcb_event {
 
 QT_END_NAMESPACE
 
+typedef xcb_translate_coordinates_cookie_t Xcb_translate_coordinates_cookie_t;
+typedef xcb_translate_coordinates_reply_t Xcb_translate_coordinates_reply_t ;
+
+xcb_translate_coordinates_cookie_t
+Xcb_translate_coordinates (xcb_connection_t *c,
+                           xcb_window_t      src_window,
+                           xcb_window_t      dst_window,
+                           int16_t           src_x ,
+                           int16_t           src_y);
+
+inline xcb_translate_coordinates_reply_t *
+Xcb_translate_coordinates_reply (xcb_connection_t                    *c,
+                                 xcb_translate_coordinates_cookie_t  cookie,
+                                 xcb_generic_error_t                **e)
+{
+    return xcb_translate_coordinates_reply(c, cookie, e);
+}
+
+xcb_translate_coordinates_cookie_t
+Xcb_translate_coordinates_unchecked (xcb_connection_t *c,
+                                     xcb_window_t      src_window,
+                                     xcb_window_t      dst_window,
+                                     int16_t           src_x,
+                                     int16_t           src_y);
 #endif
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 1e96326..f506d8e 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -38,6 +38,7 @@
 ****************************************************************************/
 
 #include "qxcbdrag.h"
+#include "qxcbconnection.h"
 #include <xcb/xcb.h>
 #include "qxcbconnection.h"
 #include "qxcbclipboard.h"
@@ -333,7 +334,7 @@ void QXcbDrag::move(const QPoint &globalPos)
     }
 
     xcb_window_t rootwin = current_virtual_desktop->root();
-    auto translate = Q_XCB_REPLY(xcb_translate_coordinates, connection()->xcb_connection(),
+    auto translate = Q_XCB_REPLY(Xcb_translate_coordinates, connection()->xcb_connection(),
                                  rootwin, rootwin, globalPos.x(), globalPos.y());
     if (!translate)
         return;
@@ -348,7 +349,7 @@ void QXcbDrag::move(const QPoint &globalPos)
             DNDDEBUG << "checking target for XdndAware" << target << lx << ly;
 
             // translate coordinates
-            auto translate = Q_XCB_REPLY(xcb_translate_coordinates, connection()->xcb_connection(),
+            auto translate = Q_XCB_REPLY(Xcb_translate_coordinates, connection()->xcb_connection(),
                                          src, target, lx, ly);
             if (!translate) {
                 target = 0;
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 67c96b2..986dd14 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -38,6 +38,7 @@
 ****************************************************************************/
 
 #include "qxcbscreen.h"
+#include "qxcbconnection.h"
 #include "qxcbwindow.h"
 #include "qxcbcursor.h"
 #include "qxcbimage.h"
@@ -328,6 +329,7 @@ void QXcbVirtualDesktop::readXResources()
             m_subpixelType = parseXftRgba(stringValue);
         }
     }
+    qDebug() << "Screen, root=" << hex << root();
 }
 
 QSurfaceFormat QXcbVirtualDesktop::surfaceFormatFor(const QSurfaceFormat &format) const
@@ -502,10 +504,23 @@ QString QXcbScreen::serialNumber() const
 {
     return m_edid.serialNumber;
 }
-
+QDebug operator<< (QDebug d, const xcb_translate_coordinates_reply_t *r)
+{
+    d << "xcb_translate_coordinates_reply_t(";
+    if (r)
+        d << "response_type" << r->response_type
+      << "same_screen=" << r->same_screen
+      << "child=" << hex << r->child << dec << "x,y" << r->dst_x << r->dst_y;
+    else
+        d << '0';
+    d << ')';
+    return d;
+}
 QWindow *QXcbScreen::topLevelAt(const QPoint &p) const
 {
+
     xcb_window_t root = screen()->root;
+    qDebug() << __FUNCTION__ << p << "root=" << hex << root;
 
     int x = p.x();
     int y = p.y();
@@ -513,11 +528,15 @@ QWindow *QXcbScreen::topLevelAt(const QPoint &p) const
     xcb_window_t parent = root;
     xcb_window_t child = root;
 
+    int n = 0;
     do {
-        auto translate_reply = Q_XCB_REPLY_UNCHECKED(xcb_translate_coordinates, xcb_connection(), parent, child, x, y);
+        qDebug() << '#' << n++ << "loop parent" << hex << parent << "child=" << child << "Xcb_translate_coordinates";
+        auto translate_reply = Q_XCB_REPLY_UNCHECKED(Xcb_translate_coordinates, xcb_connection(), parent, child, x, y);
+        qDebug() << translate_reply.get();
         if (!translate_reply) {
-            return 0;
-        }
+            qDebug() << "0 reply";
+            return 0;            
+        }        
 
         parent = child;
         child = translate_reply->child;
@@ -528,9 +547,14 @@ QWindow *QXcbScreen::topLevelAt(const QPoint &p) const
             return 0;
 
         QPlatformWindow *platformWindow = connection()->platformWindowFromId(child);
-        if (platformWindow)
+        if (platformWindow) {
+            qDebug() << __FUNCTION__ << "SUCC" << platformWindow->window();
             return platformWindow->window();
+        }
+//        else
+//            return nullptr;
     } while (parent != child);
+    qDebug() << __FUNCTION__ << "FAIL";
 
     return 0;
 }
@@ -801,7 +825,7 @@ void QXcbScreen::updateRefreshRate(xcb_randr_mode_t mode)
 static inline bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent,
                              int *x, int *y)
 {
-    auto translate_reply = Q_XCB_REPLY_UNCHECKED(xcb_translate_coordinates,
+    auto translate_reply = Q_XCB_REPLY_UNCHECKED(Xcb_translate_coordinates,
                                                  connection, child, parent, *x, *y);
     if (!translate_reply)
         return false;
diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp
index c98879c..1eecd5e 100644
--- a/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp
+++ b/src/plugins/platforms/xcb/qxcbsystemtraytracker.cpp
@@ -132,7 +132,7 @@ QRect QXcbSystemTrayTracker::systemTrayWindowGlobalGeometry(xcb_window_t window)
     if (!geomReply)
         return QRect();
 
-    auto translateReply = Q_XCB_REPLY(xcb_translate_coordinates, conn, window, m_connection->rootWindow(), 0, 0);
+    auto translateReply = Q_XCB_REPLY(Xcb_translate_coordinates, conn, window, m_connection->rootWindow(), 0, 0);
     if (!translateReply)
         return QRect();
 
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c8a668b..cf6a058 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -38,6 +38,7 @@
 ****************************************************************************/
 
 #include "qxcbwindow.h"
+#include "qxcbconnection.h"
 
 #include <QtDebug>
 #include <QMetaEnum>
@@ -484,6 +485,7 @@ void QXcbWindow::create()
     };
 
     m_window = xcb_generate_id(xcb_connection());
+    qDebug() << __FUNCTION__ << window() << hex << "m_window" << m_window;
     xcb_create_window(xcb_connection(),
                       m_depth,
                       m_window,                        // window id
@@ -638,6 +640,7 @@ QXcbForeignWindow::~QXcbForeignWindow()
 
 void QXcbWindow::destroy()
 {
+    qDebug() << __FUNCTION__ << window() << hex << "m_window" << m_window;
     if (connection()->focusWindow() == this)
         doFocusOut();
     if (connection()->mouseGrabber() == this)
@@ -748,7 +751,7 @@ QMargins QXcbWindow::frameMargins() const
 
         QPoint offset;
 
-        auto reply = Q_XCB_REPLY(xcb_translate_coordinates, xcb_connection(), window, parent, 0, 0);
+        auto reply = Q_XCB_REPLY(Xcb_translate_coordinates, xcb_connection(), window, parent, 0, 0);
         if (reply) {
             offset = QPoint(reply->dst_x, reply->dst_y);
         }
@@ -905,10 +908,13 @@ void QXcbWindow::hide()
         for (QPlatformScreen *screen : screens) {
             if (screen->geometry().contains(cursorPos)) {
                 const QPoint devicePosition = QHighDpi::toNativePixels(cursorPos, screen->screen());
+                qDebug() << __FUNCTION__  << ">look";
                 enterWindow = screen->topLevelAt(devicePosition);
+                qDebug() << __FUNCTION__  << "<look";
                 break;
             }
         }
+        qDebug() << __FUNCTION__  << enterWindow;
 
         if (enterWindow && enterWindow != window()) {
             // Find the child window at cursor position, otherwise use the top level window
@@ -920,6 +926,7 @@ void QXcbWindow::hide()
                                                      nativePos);
         }
     }
+    qDebug() << __FUNCTION__  << "<";
 }
 
 bool QXcbWindow::relayFocusToModalWindow() const
@@ -2066,7 +2073,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
     QPoint pos(event->x, event->y);
     if (!parent() && !fromSendEvent) {
         // Do not trust the position, query it instead.
-        auto reply = Q_XCB_REPLY(xcb_translate_coordinates, xcb_connection(),
+        auto reply = Q_XCB_REPLY(Xcb_translate_coordinates, xcb_connection(),
                                  xcb_window(), xcbScreen()->root(), 0, 0);
         if (reply) {
             pos.setX(reply->dst_x);
@@ -2113,11 +2120,12 @@ bool QXcbWindow::isEmbedded() const
 
 QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const
 {
+    qDebug() << __FUNCTION__ << window() << pos;
     if (!m_embedded)
         return pos;
 
     QPoint ret;
-    auto reply = Q_XCB_REPLY(xcb_translate_coordinates, xcb_connection(),
+    auto reply = Q_XCB_REPLY(Xcb_translate_coordinates, xcb_connection(),
                              xcb_window(), xcbScreen()->root(),
                              pos.x(), pos.y());
     if (reply) {
@@ -2130,11 +2138,12 @@ QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const
 
 QPoint QXcbWindow::mapFromGlobal(const QPoint &pos) const
 {
+    qDebug() << __FUNCTION__ << window() << pos;
     if (!m_embedded)
         return pos;
 
     QPoint ret;
-    auto reply = Q_XCB_REPLY(xcb_translate_coordinates, xcb_connection(),
+    auto reply = Q_XCB_REPLY(Xcb_translate_coordinates, xcb_connection(),
                              xcbScreen()->root(), xcb_window(),
                              pos.x(), pos.y());
     if (reply) {
@@ -2158,6 +2167,7 @@ void QXcbWindow::handleMapNotifyEvent(const xcb_map_notify_event_t *event)
 
 void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event)
 {
+    qDebug() << __FUNCTION__ << window() << "m_window=" << m_window;
     if (event->window == m_window) {
         m_mapped = false;
         QWindowSystemInterface::handleExposeEvent(window(), QRegion());
