diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-19 14:32:55 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-19 14:32:55 +0200 |
commit | 984b005bd01a57e53212bc1176b57b617414e75d (patch) | |
tree | 74447d46867a1c13d43a6d2dbe6e8e964b65c493 /src | |
parent | d368b2b41bf45b3a3a8a2ab5f8b61fb3dac5b7ea (diff) |
Fixed clicking on tabs when banner is underneath
Banner was too eager to eat all mouse events.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/banner.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ui/banner.c b/src/ui/banner.c index 0ffb1d9f..7168f4b2 100644 --- a/src/ui/banner.c +++ b/src/ui/banner.c | |||
@@ -257,8 +257,26 @@ static size_t itemAtCoord_Banner_(const iBanner *d, iInt2 coord) { | |||
257 | return iInvalidPos; | 257 | return iInvalidPos; |
258 | } | 258 | } |
259 | 259 | ||
260 | static iBool isInside_Banner(const iBanner *d, const SDL_Event *ev) { | ||
261 | if (ev->type == SDL_MOUSEMOTION || ev->type == SDL_MOUSEBUTTONDOWN || | ||
262 | ev->type == SDL_MOUSEBUTTONDOWN) { | ||
263 | iInt2 coord; | ||
264 | if (ev->type == SDL_MOUSEMOTION) { | ||
265 | coord = init_I2(ev->motion.x, ev->motion.y); | ||
266 | } | ||
267 | else { | ||
268 | coord = init_I2(ev->button.x, ev->button.y); | ||
269 | } | ||
270 | return contains_Rect(bounds_Widget(constAs_Widget(d->doc)), coord); | ||
271 | } | ||
272 | return iTrue; | ||
273 | } | ||
274 | |||
260 | iBool processEvent_Banner(iBanner *d, const SDL_Event *ev) { | 275 | iBool processEvent_Banner(iBanner *d, const SDL_Event *ev) { |
261 | iWidget *w = as_Widget(d->doc); | 276 | iWidget *w = as_Widget(d->doc); |
277 | if (!isInside_Banner(d, ev)) { | ||
278 | return iFalse; | ||
279 | } | ||
262 | switch (ev->type) { | 280 | switch (ev->type) { |
263 | case SDL_MOUSEMOTION: { | 281 | case SDL_MOUSEMOTION: { |
264 | const iInt2 coord = init_I2(ev->motion.x, ev->motion.y); | 282 | const iInt2 coord = init_I2(ev->motion.x, ev->motion.y); |