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"
|
#include "mouseover_win32/GDDataTranfer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
#include <QX11Info>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::wstring;
|
using std::wstring;
|
||||||
using std::map;
|
using std::map;
|
||||||
|
@ -2282,6 +2287,7 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
||||||
if ( !isVisible() )
|
if ( !isVisible() )
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
|
qApp->setActiveWindow( this );
|
||||||
activateWindow();
|
activateWindow();
|
||||||
raise();
|
raise();
|
||||||
shown = true;
|
shown = true;
|
||||||
|
@ -2311,7 +2317,16 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shown )
|
if ( shown )
|
||||||
|
{
|
||||||
focusTranslateLine();
|
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()
|
void MainWindow::installHotKeys()
|
||||||
|
|
Loading…
Reference in a new issue