Assign correct values to XButtonEvent::[xy]_root

The signature is: QPoint QWidget::mapToGlobal(const QPoint &) const;
This commit is contained in:
Igor Kushnir 2022-11-03 16:58:44 +02:00 committed by Abs62
parent 307fe2ba16
commit 6dc74a7c7b

View file

@ -3050,15 +3050,14 @@ void MainWindow::toggleMainWindow( bool onlyShow )
XGetInputFocus( QX11Info::display(), &wh, &rev ); XGetInputFocus( QX11Info::display(), &wh, &rev );
if( wh != translateLine->internalWinId() && !byIconClick ) if( wh != translateLine->internalWinId() && !byIconClick )
{ {
QPoint p( 1, 1 ); QPoint const pointRelativeToRoot = mapToGlobal( QPoint( 1, 1 ) );
mapToGlobal( p );
XEvent event; XEvent event;
memset( &event, 0, sizeof( event) ); memset( &event, 0, sizeof( event) );
event.type = ButtonPress; event.type = ButtonPress;
event.xbutton.x = 1; event.xbutton.x = 1;
event.xbutton.y = 1; event.xbutton.y = 1;
event.xbutton.x_root = p.x(); event.xbutton.x_root = pointRelativeToRoot.x();
event.xbutton.y_root = p.y(); event.xbutton.y_root = pointRelativeToRoot.y();
event.xbutton.window = internalWinId(); event.xbutton.window = internalWinId();
event.xbutton.root = QX11Info::appRootWindow( QX11Info::appScreen() ); event.xbutton.root = QX11Info::appRootWindow( QX11Info::appScreen() );
event.xbutton.state = Button1Mask; event.xbutton.state = Button1Mask;