mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Window activation under Linux again (issue #235)
This commit is contained in:
parent
d0bda5c501
commit
d1a4db20e8
|
@ -2368,7 +2368,11 @@ void MainWindow::showTranslationFor( QString const & inWord,
|
|||
//ui.tabWidget->setTabText( ui.tabWidget->indexOf(ui.tab), inWord.trimmed() );
|
||||
}
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
void MainWindow::toggleMainWindow( bool onlyShow, bool byIconClick )
|
||||
#else
|
||||
void MainWindow::toggleMainWindow( bool onlyShow )
|
||||
#endif
|
||||
{
|
||||
bool shown = false;
|
||||
|
||||
|
@ -2414,7 +2418,7 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
|||
Window wh = 0;
|
||||
int rev = 0;
|
||||
XGetInputFocus( QX11Info::display(), &wh, &rev );
|
||||
if( wh != translateLine->internalWinId() )
|
||||
if( wh != translateLine->internalWinId() && !byIconClick )
|
||||
{
|
||||
QPoint p( 1, 1 );
|
||||
mapToGlobal( p );
|
||||
|
@ -2618,7 +2622,11 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason r )
|
|||
switch(r) {
|
||||
case QSystemTrayIcon::Trigger:
|
||||
// Left click toggles the visibility of main window
|
||||
#ifdef Q_WS_X11
|
||||
toggleMainWindow( false, true );
|
||||
#else
|
||||
toggleMainWindow();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case QSystemTrayIcon::MiddleClick:
|
||||
|
|
|
@ -194,7 +194,11 @@ private:
|
|||
|
||||
/// Brings the main window to front if it's not currently, or hides it
|
||||
/// otherwise. The hiding part is omitted if onlyShow is true.
|
||||
#ifdef Q_WS_X11
|
||||
void toggleMainWindow( bool onlyShow = false, bool byIconClick = false );
|
||||
#else
|
||||
void toggleMainWindow( bool onlyShow = false );
|
||||
#endif
|
||||
|
||||
/// Creates hotkeyWrapper and hooks the currently set keys for it
|
||||
void installHotKeys();
|
||||
|
|
Loading…
Reference in a new issue