summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/touch.c16
-rw-r--r--src/ui/widget.c4
2 files changed, 13 insertions, 7 deletions
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 613f2c0d..884cc605 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -166,6 +166,7 @@ static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) {
166 .type = SDL_MOUSEMOTION, 166 .type = SDL_MOUSEMOTION,
167 .timestamp = SDL_GetTicks(), 167 .timestamp = SDL_GetTicks(),
168 .which = SDL_TOUCH_MOUSEID, 168 .which = SDL_TOUCH_MOUSEID,
169 .windowID = id_Window(get_Window()),
169 .state = buttonState, 170 .state = buttonState,
170 .x = x_F3(pos), 171 .x = x_F3(pos),
171 .y = y_F3(pos) 172 .y = y_F3(pos)
@@ -183,6 +184,7 @@ static iBool dispatchClick_Touch_(const iTouch *d, int button) {
183 .state = SDL_PRESSED, 184 .state = SDL_PRESSED,
184 .timestamp = SDL_GetTicks(), 185 .timestamp = SDL_GetTicks(),
185 .which = SDL_TOUCH_MOUSEID, 186 .which = SDL_TOUCH_MOUSEID,
187 .windowID = id_Window(window),
186 .x = x_F3(tapPos), 188 .x = x_F3(tapPos),
187 .y = y_F3(tapPos) 189 .y = y_F3(tapPos)
188 }; 190 };
@@ -206,6 +208,7 @@ static void dispatchButtonDown_Touch_(iFloat3 pos) {
206 .clicks = 1, 208 .clicks = 1,
207 .state = SDL_PRESSED, 209 .state = SDL_PRESSED,
208 .which = SDL_TOUCH_MOUSEID, 210 .which = SDL_TOUCH_MOUSEID,
211 .windowID = id_Window(get_Window()),
209 .button = SDL_BUTTON_LEFT, 212 .button = SDL_BUTTON_LEFT,
210 .x = x_F3(pos), 213 .x = x_F3(pos),
211 .y = y_F3(pos) 214 .y = y_F3(pos)
@@ -220,6 +223,7 @@ static void dispatchButtonUp_Touch_(iFloat3 pos) {
220 .clicks = 1, 223 .clicks = 1,
221 .state = SDL_RELEASED, 224 .state = SDL_RELEASED,
222 .which = SDL_TOUCH_MOUSEID, 225 .which = SDL_TOUCH_MOUSEID,
226 .windowID = id_Window(get_Window()),
223 .button = SDL_BUTTON_LEFT, 227 .button = SDL_BUTTON_LEFT,
224 .x = x_F3(pos), 228 .x = x_F3(pos),
225 .y = y_F3(pos) 229 .y = y_F3(pos)
@@ -351,6 +355,7 @@ static void update_TouchState_(void *ptr) {
351 dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ 355 dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
352 .type = SDL_MOUSEWHEEL, 356 .type = SDL_MOUSEWHEEL,
353 .which = SDL_TOUCH_MOUSEID, 357 .which = SDL_TOUCH_MOUSEID,
358 .windowID = id_Window(window_Widget(mom->affinity)),
354 .timestamp = nowTime, 359 .timestamp = nowTime,
355 .x = pixels.x, 360 .x = pixels.x,
356 .y = pixels.y, 361 .y = pixels.y,
@@ -612,11 +617,11 @@ iBool processEvent_Touch(const SDL_Event *ev) {
612 if (touch->axis == y_TouchAxis) { 617 if (touch->axis == y_TouchAxis) {
613 pixels.x = 0; 618 pixels.x = 0;
614 } 619 }
615// printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n", 620 printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n",
616// touch->affinity, 621 touch->affinity,
617// class_Widget(touch->affinity)->name, 622 class_Widget(touch->affinity)->name,
618// pixels.y, y_F3(amount), y_F3(touch->accum), 623 pixels.y, y_F3(amount), y_F3(touch->accum),
619// touch->edge); 624 touch->edge);
620 if (pixels.x || pixels.y) { 625 if (pixels.x || pixels.y) {
621 //setFocus_Widget(NULL); 626 //setFocus_Widget(NULL);
622 dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0); 627 dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0);
@@ -624,6 +629,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
624 dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ 629 dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
625 .type = SDL_MOUSEWHEEL, 630 .type = SDL_MOUSEWHEEL,
626 .which = SDL_TOUCH_MOUSEID, 631 .which = SDL_TOUCH_MOUSEID,
632 .windowID = id_Window(window_Widget(touch->affinity)),
627 .timestamp = SDL_GetTicks(), 633 .timestamp = SDL_GetTicks(),
628 .x = pixels.x, 634 .x = pixels.x,
629 .y = pixels.y, 635 .y = pixels.y,
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 910c31a9..4b8b1dc5 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -1030,7 +1030,7 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
1030 } 1030 }
1031 } 1031 }
1032 else if (ev->type == SDL_MOUSEMOTION && 1032 else if (ev->type == SDL_MOUSEMOTION &&
1033 ev->motion.windowID == SDL_GetWindowID(window_Widget(d)->win) && 1033 ev->motion.windowID == id_Window(window_Widget(d)) &&
1034 (!window_Widget(d)->hover || hasParent_Widget(d, window_Widget(d)->hover)) && 1034 (!window_Widget(d)->hover || hasParent_Widget(d, window_Widget(d)->hover)) &&
1035 flags_Widget(d) & hover_WidgetFlag && ~flags_Widget(d) & hidden_WidgetFlag && 1035 flags_Widget(d) & hover_WidgetFlag && ~flags_Widget(d) & hidden_WidgetFlag &&
1036 ~flags_Widget(d) & disabled_WidgetFlag) { 1036 ~flags_Widget(d) & disabled_WidgetFlag) {
@@ -1075,7 +1075,7 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
1075 fflush(stdout); 1075 fflush(stdout);
1076 } 1076 }
1077#endif 1077#endif
1078#if 0 1078#if 1
1079 if (ev->type == SDL_MOUSEWHEEL) { 1079 if (ev->type == SDL_MOUSEWHEEL) {
1080 printf("[%p] %s:'%s' ate the wheel\n", 1080 printf("[%p] %s:'%s' ate the wheel\n",
1081 child, class_Widget(child)->name, 1081 child, class_Widget(child)->name,