Don't show PopupMenu for inactive window on macOS.

On macOS context menu (right click) doesn't activate the window that was clicked.
- You can't  activate it yourself if some other application is active.
- It's hard to make menu work while window still is inactive (like macOS menus).
Because when you left-click anything after right click Qt makes the window
something-like-focused (it shows on top and receives input), but not really
(it still displays as inactive, cursor not blinking and all). Looks like Qt bug.
This commit is contained in:
John Preston 2018-08-01 20:14:55 +03:00
parent 8cc0fbc687
commit 06bf67c146
1 changed files with 6 additions and 0 deletions

View File

@ -423,6 +423,12 @@ void PopupMenu::popup(const QPoint &p) {
}
void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, TriggeredSource source) {
if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
if (!parent && !static_cast<QApplication*>(QApplication::instance())->activeWindow()) {
crl::on_main(this, [=] { show(); hideFast(); });
return;
}
}
_parent = parent;
auto origin = PanelAnimation::Origin::TopLeft;