Lagrange [work/v1.8]

Touch: Fixed motion events

=> 851bc03a3ca740dc6879438392a25d8eb8c5a104

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) {
         .type = SDL_MOUSEMOTION,
         .timestamp = SDL_GetTicks(),
         .which = SDL_TOUCH_MOUSEID,
+        .windowID = id_Window(get_Window()),
         .state = buttonState,
         .x = x_F3(pos),
         .y = y_F3(pos)
@@ -183,6 +184,7 @@ static iBool dispatchClick_Touch_(const iTouch *d, int button) {
         .state = SDL_PRESSED,
         .timestamp = SDL_GetTicks(),
         .which = SDL_TOUCH_MOUSEID,
+        .windowID = id_Window(window),
         .x = x_F3(tapPos),
         .y = y_F3(tapPos)
     };
@@ -206,6 +208,7 @@ static void dispatchButtonDown_Touch_(iFloat3 pos) {
         .clicks = 1,
         .state = SDL_PRESSED,
         .which = SDL_TOUCH_MOUSEID,
+        .windowID = id_Window(get_Window()),
         .button = SDL_BUTTON_LEFT,
         .x = x_F3(pos),
         .y = y_F3(pos)
@@ -220,6 +223,7 @@ static void dispatchButtonUp_Touch_(iFloat3 pos) {
         .clicks = 1,
         .state = SDL_RELEASED,
         .which = SDL_TOUCH_MOUSEID,
+        .windowID = id_Window(get_Window()),
         .button = SDL_BUTTON_LEFT,
         .x = x_F3(pos),
         .y = y_F3(pos)
@@ -351,6 +355,7 @@ static void update_TouchState_(void *ptr) {
                 dispatchEvent_Widget(mom->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
                                                         .type = SDL_MOUSEWHEEL,
                                                         .which = SDL_TOUCH_MOUSEID,
+                                                        .windowID = id_Window(window_Widget(mom->affinity)),
                                                         .timestamp = nowTime,
                                                         .x = pixels.x,
                                                         .y = pixels.y,
@@ -612,11 +617,11 @@ iBool processEvent_Touch(const SDL_Event *ev) {
             if (touch->axis == y_TouchAxis) {
                 pixels.x = 0;
             }
-//            printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n",
-//                   touch->affinity,
-//                   class_Widget(touch->affinity)->name,
-//                   pixels.y, y_F3(amount), y_F3(touch->accum),
-//                   touch->edge);
+            printf("%p (%s) py: %i wy: %f acc: %f edge: %d\n",
+                   touch->affinity,
+                   class_Widget(touch->affinity)->name,
+                   pixels.y, y_F3(amount), y_F3(touch->accum),
+                   touch->edge);
             if (pixels.x || pixels.y) {
                 //setFocus_Widget(NULL);
                 dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0);
@@ -624,6 +629,7 @@ iBool processEvent_Touch(const SDL_Event *ev) {
                 dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){
                     .type = SDL_MOUSEWHEEL,
                     .which = SDL_TOUCH_MOUSEID,
+                    .windowID = id_Window(window_Widget(touch->affinity)),
                     .timestamp = SDL_GetTicks(),
                     .x = pixels.x,
                     .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) {
         }
     }
     else if (ev->type == SDL_MOUSEMOTION &&
-             ev->motion.windowID == SDL_GetWindowID(window_Widget(d)->win) &&
+             ev->motion.windowID == id_Window(window_Widget(d)) &&
              (!window_Widget(d)->hover || hasParent_Widget(d, window_Widget(d)->hover)) &&
              flags_Widget(d) & hover_WidgetFlag && ~flags_Widget(d) & hidden_WidgetFlag &&
              ~flags_Widget(d) & disabled_WidgetFlag) {
@@ -1075,7 +1075,7 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
                     fflush(stdout);
                 }
 #endif
-#if 0
+#if 1
                 if (ev->type == SDL_MOUSEWHEEL) {
                     printf("[%p] %s:'%s' ate the wheel\n",
                            child, class_Widget(child)->name,
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.8/cdiff/851bc03a3ca740dc6879438392a25d8eb8c5a104
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
53.345442 milliseconds
Gemini-to-HTML Time
0.265329 milliseconds

This content has been proxied by September (ba2dc).