=> fcebf3ede89e9a64a095c0deef4526addff09397
[1mdiff --git a/src/app.c b/src/app.c[m [1mindex d33f31e1..75807111 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -43,8 +43,9 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #include "ui/labelwidget.h"[m #include "ui/root.h"[m #include "ui/sidebarwidget.h"[m [31m-#include "ui/uploadwidget.h"[m [32m+[m[32m#include "ui/touch.h"[m #include "ui/text.h"[m [32m+[m[32m#include "ui/uploadwidget.h"[m #include "ui/util.h"[m #include "ui/window.h"[m #include "visited.h"[m [36m@@ -1376,6 +1377,9 @@[m [mvoid trimMemory_App(void) {[m }[m [m iLocalDef iBool isWaitingAllowed_App_(iApp *d) {[m [32m+[m[32m// if (deviceType_App() != desktop_AppDeviceType && numFingers_Touch() > 0) {[m [32m+[m[32m// return iFalse;[m [32m+[m[32m// }[m if (d->warmupFrames > 0) {[m return iFalse;[m }[m [1mdiff --git a/src/ui/touch.c b/src/ui/touch.c[m [1mindex 21a92b80..1de6c244 100644[m [1m--- a/src/ui/touch.c[m [1m+++ b/src/ui/touch.c[m [36m@@ -79,6 +79,10 @@[m [mstruct Impl_Touch {[m iFloat3 pos[numHistory_Touch_];[m size_t posCount;[m iFloat3 accum;[m [32m+[m[32m iInt2 pendingScroll[3]; /* SDL_FINGERMOTION sometimes arrives in clumps on iOS;[m [32m+[m[32m buffer the scrolls to post more evenly */[m [32m+[m[32m int numPendingScroll;[m [32m+[m[32m int pendingScrollThreshold;[m };[m [m iLocalDef void pushPos_Touch_(iTouch *d, const iFloat3 pos, uint32_t time) {[m [36m@@ -275,6 +279,27 @@[m [mstatic void update_TouchState_(void *ptr) {[m const uint32_t nowTime = SDL_GetTicks();[m iForEach(Array, i, d->touches) {[m iTouch *touch = i.value;[m [32m+[m[32m /* Post the next pending scroll. */[m [32m+[m[32m if (touch->numPendingScroll > touch->pendingScrollThreshold) {[m [32m+[m[32m const iInt2 pixels = touch->pendingScroll[0];[m [32m+[m[32m// printf("%u :: (%d/%d) pending scroll %d,%d\n", nowTime, touch->numPendingScroll, touch->pendingScrollThreshold, pixels.x, pixels.y);[m [32m+[m[32m memmove(touch->pendingScroll, touch->pendingScroll + 1,[m [32m+[m[32m sizeof(touch->pendingScroll[0]) * (iElemCount(touch->pendingScroll) - 1));[m [32m+[m[32m touch->numPendingScroll--;[m [32m+[m[32m dispatchMotion_Touch_(touch->startPos, 0);[m [32m+[m[32m setCurrent_Root(touch->affinity->root);[m [32m+[m[32m dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){[m [32m+[m[32m .type = SDL_MOUSEWHEEL,[m [32m+[m[32m .which = SDL_TOUCH_MOUSEID,[m [32m+[m[32m .windowID = id_Window(window_Widget(touch->affinity)),[m [32m+[m[32m .timestamp = SDL_GetTicks(),[m [32m+[m[32m .x = pixels.x,[m [32m+[m[32m .y = pixels.y,[m [32m+[m[32m .direction = perPixel_MouseWheelFlag,[m [32m+[m[32m });[m [32m+[m[32m /* TODO: Keep increasing movement if the direction is the same. */[m [32m+[m[32m clearWidgetMomentum_TouchState_(d, touch->affinity);[m [32m+[m[32m }[m if (touch->pinchId || touch->isTouchDrag) {[m continue;[m }[m [36m@@ -640,8 +665,9 @@[m [miBool processEvent_Touch(const SDL_Event *ev) {[m }[m #if 0[m static uint32_t lastTime = 0;[m [31m- printf("%u :: %p (%s) py: %i wy: %f acc: %f edge: %d\n",[m [32m+[m[32m printf("%u [%u] :: %p (%s) py: %i wy: %f acc: %f edge: %d\n",[m nowTime - lastTime,[m [32m+[m[32m ev->common.timestamp,[m touch->affinity,[m class_Widget(touch->affinity)->name,[m pixels.y, y_F3(amount), y_F3(touch->accum),[m [36m@@ -649,20 +675,23 @@[m [miBool processEvent_Touch(const SDL_Event *ev) {[m lastTime = nowTime;[m #endif[m if (pixels.x || pixels.y) {[m [31m- //setFocus_Widget(NULL);[m [31m- dispatchMotion_Touch_(touch->startPos /*pos[0]*/, 0);[m [31m- setCurrent_Root(touch->affinity->root);[m [31m- dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){[m [31m- .type = SDL_MOUSEWHEEL,[m [31m- .which = SDL_TOUCH_MOUSEID,[m [31m- .windowID = id_Window(window_Widget(touch->affinity)),[m [31m- .timestamp = SDL_GetTicks(),[m [31m- .x = pixels.x,[m [31m- .y = pixels.y,[m [31m- .direction = perPixel_MouseWheelFlag,[m [31m- });[m [31m- /* TODO: Keep increasing movement if the direction is the same. */[m [31m- clearWidgetMomentum_TouchState_(d, touch->affinity);[m [32m+[m[32m /* Finger events may not arrive at regular intervals (particularly with the SDL on[m [32m+[m[32m iOS, it seems!), so we won't post the scroll event immediately but instead[m [32m+[m[32m wait until next ticker iteration. This allows us to buffer events if too many[m [32m+[m[32m arrive at once. */[m [32m+[m[32m const int maxPending = iElemCount(touch->pendingScroll);[m [32m+[m[32m if (touch->numPendingScroll == maxPending) {[m [32m+[m[32m addv_I2(&touch->pendingScroll[maxPending - 1], pixels);[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m touch->pendingScroll[touch->numPendingScroll] = pixels;[m [32m+[m[32m#if defined (iPlatformAppleMobile)[m [32m+[m[32m touch->pendingScrollThreshold = iMin(touch->numPendingScroll, 1);[m [32m+[m[32m#else[m [32m+[m[32m touch->pendingScrollThreshold = 0;[m [32m+[m[32m#endif[m [32m+[m[32m touch->numPendingScroll++;[m [32m+[m[32m }[m }[m }[m }[m [36m@@ -676,11 +705,6 @@[m [miBool processEvent_Touch(const SDL_Event *ev) {[m endPinch_TouchState_(d, touch->pinchId);[m break;[m }[m [31m-#if 0[m [31m- if (touch->edgeDragging) {[m [31m- setFlags_Widget(touch->edgeDragging, dragged_WidgetFlag, iFalse);[m [31m- }[m [31m-#endif[m if (touch->edge && !isStationary_Touch_(touch)) {[m const iFloat3 gesture = gestureVector_Touch_(touch);[m const uint32_t duration = gestureSpan_Touch_(touch);[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).