Windows switching under Ubuntu Unity (issue #204)

This commit is contained in:
Abs62 2013-02-08 15:49:14 +04:00
parent a46b17924d
commit d992c81e93

View file

@ -2408,7 +2408,29 @@ void MainWindow::toggleMainWindow( bool onlyShow )
int rev = 0; int rev = 0;
XGetInputFocus( QX11Info::display(), &wh, &rev ); XGetInputFocus( QX11Info::display(), &wh, &rev );
if( wh != translateLine->internalWinId() ) if( wh != translateLine->internalWinId() )
XSetInputFocus( QX11Info::display(), translateLine->internalWinId(), RevertToParent, CurrentTime ); {
QPoint p( 1, 1 );
mapToGlobal( p );
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.window = internalWinId();
event.xbutton.root = QX11Info::appRootWindow( QX11Info::appScreen() );
event.xbutton.state = Button1Mask;
event.xbutton.button = Button1;
event.xbutton.same_screen = true;
event.xbutton.time = CurrentTime;
XSendEvent( QX11Info::display(), internalWinId(), true, 0xfff, &event );
XFlush( QX11Info::display() );
event.type = ButtonRelease;
XSendEvent( QX11Info::display(), internalWinId(), true, 0xfff, &event );
XFlush( QX11Info::display() );
}
#endif #endif
} }
} }