mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 21:34:07 +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() );
|
//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 )
|
void MainWindow::toggleMainWindow( bool onlyShow )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bool shown = false;
|
bool shown = false;
|
||||||
|
|
||||||
|
@ -2414,7 +2418,7 @@ void MainWindow::toggleMainWindow( bool onlyShow )
|
||||||
Window wh = 0;
|
Window wh = 0;
|
||||||
int rev = 0;
|
int rev = 0;
|
||||||
XGetInputFocus( QX11Info::display(), &wh, &rev );
|
XGetInputFocus( QX11Info::display(), &wh, &rev );
|
||||||
if( wh != translateLine->internalWinId() )
|
if( wh != translateLine->internalWinId() && !byIconClick )
|
||||||
{
|
{
|
||||||
QPoint p( 1, 1 );
|
QPoint p( 1, 1 );
|
||||||
mapToGlobal( p );
|
mapToGlobal( p );
|
||||||
|
@ -2618,7 +2622,11 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason r )
|
||||||
switch(r) {
|
switch(r) {
|
||||||
case QSystemTrayIcon::Trigger:
|
case QSystemTrayIcon::Trigger:
|
||||||
// Left click toggles the visibility of main window
|
// Left click toggles the visibility of main window
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
toggleMainWindow( false, true );
|
||||||
|
#else
|
||||||
toggleMainWindow();
|
toggleMainWindow();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QSystemTrayIcon::MiddleClick:
|
case QSystemTrayIcon::MiddleClick:
|
||||||
|
|
|
@ -194,7 +194,11 @@ private:
|
||||||
|
|
||||||
/// Brings the main window to front if it's not currently, or hides it
|
/// Brings the main window to front if it's not currently, or hides it
|
||||||
/// otherwise. The hiding part is omitted if onlyShow is true.
|
/// 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 );
|
void toggleMainWindow( bool onlyShow = false );
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Creates hotkeyWrapper and hooks the currently set keys for it
|
/// Creates hotkeyWrapper and hooks the currently set keys for it
|
||||||
void installHotKeys();
|
void installHotKeys();
|
||||||
|
|
Loading…
Reference in a new issue