At first I’m not sure that this is possible even without any hacking of the X.11 input, but the discussions that I saw online made me think that it was possible.
Let me explain what I hope to do. I want a Qt application, which is likely to be just a small window that will look like a widget on the screen. The application does nothing until the user drags another application window on top of it. The way I was hoping to detect this is to track the mouse and see that the left click is not working, and the mouse is above the Qt window, and Qt is not an active window, and then performs some actions. However, at present, I was not able to receive mouse events when my Qt application is not an active window. I think some of these posts that I linked relate to the “window” as a QWindow inside QApp.
What I mean by the window is the X.11 window, any application opened in X. My screenshots, I hope, emphasize my current position. I also added my code and am happy to accept any suggestions. Any other hacks that I know help me achieve this, I also thank you for being informed.

Red shows where my cursor clicked, and the mouse event is recorded outside the Qt window. This was triggered by the FocusOut event, and this is the last event I managed to detect.

As we see on the console, the mouse moved, but there were no events. I really want to detect when the mouse crosses the position that the Qt application window is in, regardless of whether it is on top of another window or not.
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::MouseMove)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
statusBar()->showMessage(QString("Mouse move (%1,%2)").arg(mouseEvent->pos().x()).arg(mouseEvent->pos().y()));
qDebug() << QString::number(mouseEvent->pos().x());
qDebug() << QString::number(mouseEvent->pos().y());
}
if (event->type() == QEvent::FocusOut)
{
QFocusEvent *focusEvent = static_cast<QFocusEvent*>(event);
focusEvent->accept();
qDebug()<<"event Filter Mouse Move111"<<QCursor::pos();
}
return false;
}
void MainWindow::initWindow()
{
setMouseTracking(true);
grabMouse();
qApp->installEventFilter(this);
}