summaryrefslogtreecommitdiff
path: root/src/ui/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r--src/ui/touch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 4b22b8fb..14e5fe48 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -130,7 +130,7 @@ static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) {
130 }); 130 });
131} 131}
132 132
133static void dispatchClick_Touch_(const iTouch *d, int button) { 133static iBool dispatchClick_Touch_(const iTouch *d, int button) {
134 const iFloat3 tapPos = d->pos[0]; 134 const iFloat3 tapPos = d->pos[0];
135 SDL_MouseButtonEvent btn = { 135 SDL_MouseButtonEvent btn = {
136 .type = SDL_MOUSEBUTTONDOWN, 136 .type = SDL_MOUSEBUTTONDOWN,
@@ -142,7 +142,7 @@ static void dispatchClick_Touch_(const iTouch *d, int button) {
142 .x = x_F3(tapPos), 142 .x = x_F3(tapPos),
143 .y = y_F3(tapPos) 143 .y = y_F3(tapPos)
144 }; 144 };
145 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn); 145 iBool wasUsed = dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn);
146 /* Immediately released, too. */ 146 /* Immediately released, too. */
147 btn.type = SDL_MOUSEBUTTONUP; 147 btn.type = SDL_MOUSEBUTTONUP;
148 btn.state = SDL_RELEASED; 148 btn.state = SDL_RELEASED;
@@ -150,6 +150,7 @@ static void dispatchClick_Touch_(const iTouch *d, int button) {
150 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn); 150 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn);
151 //dispatchMotion_Touch_(zero_F3(), 0); 151 //dispatchMotion_Touch_(zero_F3(), 0);
152 setHover_Widget(NULL); /* FIXME: this doesn't seem to do anything? */ 152 setHover_Widget(NULL); /* FIXME: this doesn't seem to do anything? */
153 return wasUsed;
153} 154}
154 155
155static void clearWidgetMomentum_TouchState_(iTouchState *d, iWidget *widget) { 156static void clearWidgetMomentum_TouchState_(iTouchState *d, iWidget *widget) {
@@ -305,7 +306,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
305 iWidget *aff = hitChild_Widget(window->root, init_I2(iRound(x), iRound(y_F3(pos)))); 306 iWidget *aff = hitChild_Widget(window->root, init_I2(iRound(x), iRound(y_F3(pos))));
306 /* TODO: We must retain a reference to the affinity widget, or otherwise it might 307 /* TODO: We must retain a reference to the affinity widget, or otherwise it might
307 be destroyed during the gesture. */ 308 be destroyed during the gesture. */
308// printf("aff:%p (%s)\n", aff, aff ? class_Widget(aff)->name : "-"); 309 printf("aff:%p (%s)\n", aff, aff ? class_Widget(aff)->name : "-");
309 if (flags_Widget(aff) & touchDrag_WidgetFlag) { 310 if (flags_Widget(aff) & touchDrag_WidgetFlag) {
310 dispatchEvent_Widget(window->root, (SDL_Event *) &(SDL_MouseButtonEvent){ 311 dispatchEvent_Widget(window->root, (SDL_Event *) &(SDL_MouseButtonEvent){
311 .type = SDL_MOUSEBUTTONDOWN, 312 .type = SDL_MOUSEBUTTONDOWN,