mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Focus GoldenDict window after restoring it from tray by hotkey under Ubuntu (issue #95)
This commit is contained in:
parent
f9e2f7cf7b
commit
402b481d74
|
@ -33,6 +33,11 @@
|
|||
#include "mouseover_win32/GDDataTranfer.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
using std::set;
|
||||
using std::wstring;
|
||||
using std::map;
|
||||
|
@ -2282,6 +2287,7 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
|||
if ( !isVisible() )
|
||||
{
|
||||
show();
|
||||
qApp->setActiveWindow( this );
|
||||
activateWindow();
|
||||
raise();
|
||||
shown = true;
|
||||
|
@ -2311,7 +2317,16 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
|||
}
|
||||
|
||||
if ( shown )
|
||||
{
|
||||
focusTranslateLine();
|
||||
#ifdef Q_WS_X11
|
||||
Window wh = 0;
|
||||
int rev = 0;
|
||||
XGetInputFocus( QX11Info::display(), &wh, &rev );
|
||||
if( wh != translateLine->internalWinId() )
|
||||
XSetInputFocus( QX11Info::display(), translateLine->internalWinId(), RevertToParent, CurrentTime );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::installHotKeys()
|
||||
|
|
Loading…
Reference in a new issue