Skip to content

Commit

Permalink
Merge pull request xiaoyifang#828 from xiaoyifang/fix/start-tray
Browse files Browse the repository at this point in the history
fix: remove toggle main windows extra parameter
  • Loading branch information
xiaoyifang authored Jun 8, 2023
2 parents 1a1f708 + c56304a commit d33bb88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
12 changes: 2 additions & 10 deletions src/ui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2704,19 +2704,15 @@ void MainWindow::showTranslationForDicts( QString const & inWord,
ignoreDiacritics );
}

#ifdef HAVE_X11
void MainWindow::toggleMainWindow( bool onlyShow, bool byIconClick )
#else
void MainWindow::toggleMainWindow( bool onlyShow )
#endif
{
bool shown = false;

if ( !cfg.preferences.searchInDock )
translateBox->setPopupEnabled( false );

if ( !isVisible() )
{
qDebug() << "Current state:" << isVisible() << isMinimized() << isActiveWindow() << onlyShow;
if ( !isVisible() ) {
show();

qApp->setActiveWindow( this );
Expand Down Expand Up @@ -2970,11 +2966,7 @@ void MainWindow::trayIconActivated( QSystemTrayIcon::ActivationReason r )
switch ( r ) {
case QSystemTrayIcon::Trigger:
// Left click toggles the visibility of main window
#ifdef HAVE_X11
toggleMainWindow( false, true );
#else
toggleMainWindow();
#endif
break;

case QSystemTrayIcon::MiddleClick:
Expand Down
4 changes: 0 additions & 4 deletions src/ui/mainwindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ 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 HAVE_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();
Expand Down

0 comments on commit d33bb88

Please sign in to comment.