summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-15 19:03:33 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-15 19:03:41 +0200
commit42bd372f1b0c93df06000f55df779696e4cb3aa3 (patch)
treeeef1fbd17b47650653186318ed343e71cd7584ba /src/ui/widget.c
parentee2d10692f702ec650aed084825a49a531769077 (diff)
Translation: Handling cancellation/errors
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 19546235..6a6480e5 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -619,15 +619,30 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
619 iReverseForEach(PtrArray, i, rootData_.onTop) { 619 iReverseForEach(PtrArray, i, rootData_.onTop) {
620 iWidget *widget = *i.value; 620 iWidget *widget = *i.value;
621 if (isVisible_Widget(widget) && dispatchEvent_Widget(widget, ev)) { 621 if (isVisible_Widget(widget) && dispatchEvent_Widget(widget, ev)) {
622#if 0
623 if (ev->type == SDL_MOUSEMOTION) {
624 printf("[%p] %s:'%s' (on top) ate the motion\n",
625 widget, class_Widget(widget)->name,
626 cstr_String(id_Widget(widget)));
627 fflush(stdout);
628 }
629#endif
622 return iTrue; 630 return iTrue;
623 } 631 }
624 } 632 }
625 } 633 }
626 else if (ev->type == SDL_MOUSEMOTION && !rootData_.hover && 634 else if (ev->type == SDL_MOUSEMOTION &&
635 (!rootData_.hover || hasParent_Widget(d, rootData_.hover)) &&
627 flags_Widget(d) & hover_WidgetFlag && ~flags_Widget(d) & hidden_WidgetFlag && 636 flags_Widget(d) & hover_WidgetFlag && ~flags_Widget(d) & hidden_WidgetFlag &&
628 ~flags_Widget(d) & disabled_WidgetFlag) { 637 ~flags_Widget(d) & disabled_WidgetFlag) {
629 if (contains_Widget(d, init_I2(ev->motion.x, ev->motion.y))) { 638 if (contains_Widget(d, init_I2(ev->motion.x, ev->motion.y))) {
630 setHover_Widget(d); 639 setHover_Widget(d);
640#if 0
641 printf("set hover to [%p] %s:'%s'\n",
642 d, class_Widget(d)->name,
643 cstr_String(id_Widget(d)));
644 fflush(stdout);
645#endif
631 } 646 }
632 } 647 }
633 if (filterEvent_Widget_(d, ev)) { 648 if (filterEvent_Widget_(d, ev)) {
@@ -644,6 +659,14 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
644 } 659 }
645 if (dispatchEvent_Widget(child, ev)) { 660 if (dispatchEvent_Widget(child, ev)) {
646#if 0 661#if 0
662 if (ev->type == SDL_MOUSEMOTION) {
663 printf("[%p] %s:'%s' (on top) ate the motion\n",
664 child, class_Widget(child)->name,
665 cstr_String(id_Widget(child)));
666 fflush(stdout);
667 }
668#endif
669#if 0
647 if (ev->type == SDL_MOUSEBUTTONDOWN) { 670 if (ev->type == SDL_MOUSEBUTTONDOWN) {
648 printf("[%p] %s:'%s' ate the button %d\n", 671 printf("[%p] %s:'%s' ate the button %d\n",
649 child, class_Widget(child)->name, 672 child, class_Widget(child)->name,