summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-19 14:32:55 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-19 14:32:55 +0200
commit984b005bd01a57e53212bc1176b57b617414e75d (patch)
tree74447d46867a1c13d43a6d2dbe6e8e964b65c493
parentd368b2b41bf45b3a3a8a2ab5f8b61fb3dac5b7ea (diff)
Fixed clicking on tabs when banner is underneath
Banner was too eager to eat all mouse events.
-rw-r--r--res/about/version.gmi3
-rw-r--r--src/ui/banner.c18
2 files changed, 21 insertions, 0 deletions
diff --git a/res/about/version.gmi b/res/about/version.gmi
index ffd91f7f..020373e4 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -6,6 +6,9 @@
6``` 6```
7# Release notes 7# Release notes
8 8
9## 1.8.3
10* Fixed clicking on UI elements that are over the page top banner. The banner would always get clicked instead.
11
9## 1.8.2 12## 1.8.2
10* Fixed encoding of `+` characters in URLs as per RFC 3986. 13* Fixed encoding of `+` characters in URLs as per RFC 3986.
11* Fixed crash when fontpack.ini specifies a file that cannot be found. 14* Fixed crash when fontpack.ini specifies a file that cannot be found.
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
260static 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
260iBool processEvent_Banner(iBanner *d, const SDL_Event *ev) { 275iBool 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);