CatDog: Don't show context menu when clicking outside of widget

The context menu for CatDog was shown when right clicking anywhere on
the screen because of global cursor tracking being enabled.
Also fix event not being passed by reference.

Fixes #7285
This commit is contained in:
Marcus Nilsson 2021-05-19 22:11:59 +02:00 committed by Andreas Kling
parent 83fc591cea
commit 41e74d4d31
Notes: sideshowbarker 2024-07-18 17:45:22 +09:00

View File

@ -101,8 +101,9 @@ int main(int argc, char** argv)
advice_timer->start();
};
catdog_widget.on_context_menu_request = [&](GUI::ContextMenuEvent event) {
context_menu->popup(event.screen_position());
catdog_widget.on_context_menu_request = [&](GUI::ContextMenuEvent& event) {
if (catdog_widget.rect().contains(event.position()))
context_menu->popup(event.screen_position());
};
return app->exec();