Fix Shift+F10 context menu in media viewer.

Fixes #26595.
This commit is contained in:
John Preston 2023-08-11 21:55:45 +02:00
parent f1ab712f07
commit 94f842a81f
1 changed files with 9 additions and 0 deletions

View File

@ -492,6 +492,15 @@ OverlayWidget::OverlayWidget()
return base::EventFilterResult::Cancel;
} else if (type == QEvent::ThemeChange && Platform::IsLinux()) {
_window->setWindowIcon(Window::CreateIcon(_session));
} else if (type == QEvent::ContextMenu) {
const auto event = static_cast<QContextMenuEvent*>(e.get());
const auto mouse = (event->reason() == QContextMenuEvent::Mouse);
const auto position = mouse
? std::make_optional(event->pos())
: std::nullopt;
if (handleContextMenu(position)) {
return base::EventFilterResult::Cancel;
}
}
return base::EventFilterResult::Continue;
});