Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mainmenu: Remove shortcut popup delay #1771

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions plugin-mainmenu/lxqtmainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
mMenuCacheNotify = nullptr;
#endif

mDelayedPopup.setSingleShot(true);
mDelayedPopup.setInterval(200);
connect(&mDelayedPopup, &QTimer::timeout, this, &LXQtMainMenu::showHideMenu);
mHideTimer.setSingleShot(true);
mHideTimer.setInterval(250);

mSearchTimer.setSingleShot(true);
connect(&mSearchTimer, &QTimer::timeout, this, &LXQtMainMenu::searchMenu);
mSearchTimer.setInterval(350); // typing speed (not very fast)
Expand Down Expand Up @@ -132,14 +126,7 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
else
mShortcutSeq = mShortcut->shortcut();
});
connect(mShortcut, &GlobalKeyShortcut::Action::activated, this, [this] {
if (!mHideTimer.isActive())
// Delay this a little -- if we don't do this, search field
// won't be able to capture focus
// See <https://github.com/lxqt/lxqt-panel/pull/131> and
// <https://github.com/lxqt/lxqt-panel/pull/312>
mDelayedPopup.start();
});
connect(mShortcut, &GlobalKeyShortcut::Action::activated, this, &LXQtMainMenu::showHideMenu);
}
}

Expand Down Expand Up @@ -430,8 +417,6 @@ void LXQtMainMenu::buildMenu()
mMenu->addSeparator();

menuInstallEventFilter(mMenu, this);
connect(mMenu, &QMenu::aboutToHide, &mHideTimer, QOverload<>::of(&QTimer::start));
connect(mMenu, &QMenu::aboutToShow, &mHideTimer, &QTimer::stop);

mMenu->addSeparator();
mMenu->addAction(mSearchViewAction);
Expand Down Expand Up @@ -667,7 +652,6 @@ bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event)
const QString press = QKeySequence{static_cast<int>(mod)}.toString() % QString::fromLatin1(key_meta.valueToKey(keyEvent->key())).remove(0, 4);
if (press == mShortcutSeq)
{
mHideTimer.start();
mMenu->hide(); // close the app menu
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions plugin-mainmenu/lxqtmainmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class LXQtMainMenu : public QObject, public ILXQtPanelPlugin
XdgMenu mXdgMenu;
#endif

QTimer mDelayedPopup;
QTimer mHideTimer;
QTimer mSearchTimer;
QString mShortcutSeq;
QString mMenuFile;
Expand Down