diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-09 21:42:50 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-10 06:29:31 +0300 |
commit | f9ef1545a644b3f39d300c5a51cb0d8804e6fa09 (patch) | |
tree | 00e9fc5c7bcf1ab144c4f9c16107359ecf62ba24 /src/ui/touch.c | |
parent | d5249e99515c1a10db34bd9cd730b315c35fecc8 (diff) |
Touch: Notify widget when tap is about to begin
Notify when hover state should be updated again after scrolling.
Diffstat (limited to 'src/ui/touch.c')
-rw-r--r-- | src/ui/touch.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c index 68c493dc..bf217301 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -209,6 +209,17 @@ static void dispatchButtonUp_Touch_(iFloat3 pos) { | |||
209 | }); | 209 | }); |
210 | } | 210 | } |
211 | 211 | ||
212 | static void dispatchNotification_Touch_(const iTouch *d, int code) { | ||
213 | if (d->affinity) { | ||
214 | dispatchEvent_Widget(d->affinity, (SDL_Event *) &(SDL_UserEvent){ | ||
215 | .type = SDL_USEREVENT, | ||
216 | .timestamp = SDL_GetTicks(), | ||
217 | .code = code, | ||
218 | .data1 = d->affinity | ||
219 | }); | ||
220 | } | ||
221 | } | ||
222 | |||
212 | static void update_TouchState_(void *ptr) { | 223 | static void update_TouchState_(void *ptr) { |
213 | iTouchState *d = ptr; | 224 | iTouchState *d = ptr; |
214 | const uint32_t nowTime = SDL_GetTicks(); | 225 | const uint32_t nowTime = SDL_GetTicks(); |
@@ -226,6 +237,7 @@ static void update_TouchState_(void *ptr) { | |||
226 | } | 237 | } |
227 | if (elapsed > 50 && !touch->isTapBegun) { | 238 | if (elapsed > 50 && !touch->isTapBegun) { |
228 | /* Looks like a possible tap. */ | 239 | /* Looks like a possible tap. */ |
240 | dispatchNotification_Touch_(touch, widgetTapBegins_UserEventCode); | ||
229 | dispatchMotion_Touch_(touch->pos[0], 0); | 241 | dispatchMotion_Touch_(touch->pos[0], 0); |
230 | touch->isTapBegun = iTrue; | 242 | touch->isTapBegun = iTrue; |
231 | } | 243 | } |