From 6dc74a7c7b1fc082ac1df4ff355ec1d8927c90a3 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Thu, 3 Nov 2022 16:58:44 +0200 Subject: [PATCH] Assign correct values to XButtonEvent::[xy]_root The signature is: QPoint QWidget::mapToGlobal(const QPoint &) const; --- mainwindow.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 680a6466..53b14ffd 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -3050,15 +3050,14 @@ void MainWindow::toggleMainWindow( bool onlyShow ) XGetInputFocus( QX11Info::display(), &wh, &rev ); if( wh != translateLine->internalWinId() && !byIconClick ) { - QPoint p( 1, 1 ); - mapToGlobal( p ); + QPoint const pointRelativeToRoot = mapToGlobal( QPoint( 1, 1 ) ); XEvent event; memset( &event, 0, sizeof( event) ); event.type = ButtonPress; event.xbutton.x = 1; event.xbutton.y = 1; - event.xbutton.x_root = p.x(); - event.xbutton.y_root = p.y(); + event.xbutton.x_root = pointRelativeToRoot.x(); + event.xbutton.y_root = pointRelativeToRoot.y(); event.xbutton.window = internalWinId(); event.xbutton.root = QX11Info::appRootWindow( QX11Info::appScreen() ); event.xbutton.state = Button1Mask;