From: Holger Schemel Date: Mon, 11 Jun 2018 18:03:07 +0000 (+0200) Subject: fixed order of handling mouse clicks on gadgets and on global animations X-Git-Tag: 4.1.1.0~134 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0f01abd69eb241af59cc7bfb5ec9f6d4b3b61c12;p=rocksndiamonds.git fixed order of handling mouse clicks on gadgets and on global animations Before, gadgets were checked for clicks before global animations, which caused clickable global animations to not be clicked if a gadget at the same position was successfully clicked (because mouse events are forced to be off-screen afterwards). Now, clickable global animations are checked for mouse clicks before gadgets, and they either consume the mouse click (so a gadget at the same position will not receive the mouse click anymore), or they are set to "passthrough_clicks" style (so a gadget at the same position will still receive the mouse click). --- diff --git a/src/events.c b/src/events.c index b21f3706..146689f6 100644 --- a/src/events.c +++ b/src/events.c @@ -1554,16 +1554,16 @@ void HandleButton(int mx, int my, int button, int button_nr) strEqual(setup.touch.control_type, TOUCH_CONTROL_FOLLOW_FINGER)); #endif - if (handle_gadgets && HandleGadgets(mx, my, button)) + if (HandleGlobalAnimClicks(mx, my, button)) { /* do not handle this button event anymore */ - mx = my = -32; /* force mouse event to be outside screen tiles */ + return; /* force mouse event not to be handled at all */ } - if (HandleGlobalAnimClicks(mx, my, button)) + if (handle_gadgets && HandleGadgets(mx, my, button)) { /* do not handle this button event anymore */ - return; /* force mouse event not to be handled at all */ + mx = my = -32; /* force mouse event to be outside screen tiles */ } if (button_hold && game_status == GAME_MODE_PLAYING && tape.pausing)