1010
1111typedef struct ScrollSample {
1212 double dx , dy ;
13- monotonic_t timestamp , local_timestamp ;
13+ monotonic_t timestamp ;
1414} ScrollSample ;
1515
1616#define DEQUE_DATA_TYPE ScrollSample
@@ -59,8 +59,8 @@ cancel_existing_scroll(void) {
5959}
6060
6161static void
62- add_sample (double dx , double dy , monotonic_t timestamp ) {
63- deque_push_back (& s .samples , (ScrollSample ){dx , dy , timestamp , monotonic ()}, NULL );
62+ add_sample (double dx , double dy ) {
63+ deque_push_back (& s .samples , (ScrollSample ){dx , dy , monotonic ()}, NULL );
6464}
6565
6666static void
@@ -73,7 +73,7 @@ last_sample_delta(double *dx, double *dy) {
7373static void
7474trim_old_samples (monotonic_t now ) {
7575 const ScrollSample * ss ;
76- while ((ss = deque_peek_front (& s .samples )) && (now - ss -> local_timestamp ) > ms_to_monotonic_t (150 ))
76+ while ((ss = deque_peek_front (& s .samples )) && (now - ss -> timestamp ) > ms_to_monotonic_t (150 ))
7777 deque_pop_front (& s .samples , NULL );
7878}
7979
@@ -102,12 +102,12 @@ set_velocity_from_samples(void) {
102102
103103 // Use weighted average - more recent samples have higher weight
104104 double total_dx = 0.0 , total_dy = 0.0 , total_weight = 0.0 ;
105- monotonic_t first_time = deque_peek_front (& s .samples )-> local_timestamp ;
106- monotonic_t last_time = deque_peek_back (& s .samples )-> local_timestamp ;
105+ monotonic_t first_time = deque_peek_front (& s .samples )-> timestamp ;
106+ monotonic_t last_time = deque_peek_back (& s .samples )-> timestamp ;
107107 double time_span = MAX (1 , last_time - first_time );
108108 for (size_t i = 0 ; i < deque_size (& s .samples ); i ++ ) {
109109 const ScrollSample * ss = deque_at (& s .samples , i );
110- double weight = 1.0 + (ss -> local_timestamp - first_time ) / time_span ;
110+ double weight = 1.0 + (ss -> timestamp - first_time ) / time_span ;
111111 total_dx += ss -> dx * weight ; total_dy += ss -> dy * weight ;
112112 total_weight += weight ;
113113 }
@@ -154,7 +154,7 @@ start_momentum_scroll(void) {
154154
155155void
156156glfw_handle_scroll_event_for_momentum (
157- _GLFWwindow * w , const GLFWScrollEvent * ev , monotonic_t timestamp , bool stopped , bool is_finger_based
157+ _GLFWwindow * w , const GLFWScrollEvent * ev , bool stopped , bool is_finger_based
158158) {
159159 if (!w || (w -> id != s .window_id && s .window_id ) || s .state != PHYSICAL_EVENT_IN_PROGRESS ) cancel_existing_scroll ();
160160 if (!w ) return ;
@@ -167,7 +167,7 @@ glfw_handle_scroll_event_for_momentum(
167167 s .window_id = w -> id ;
168168 s .keyboard_modifiers = ev -> keyboard_modifiers ;
169169 if (is_finger_based ) {
170- add_sample (ev -> x_offset , ev -> y_offset , timestamp );
170+ add_sample (ev -> x_offset , ev -> y_offset );
171171 s .state = stopped ? MOMENTUM_IN_PROGRESS : PHYSICAL_EVENT_IN_PROGRESS ;
172172 } else {
173173 s .state = stopped ? NONE : PHYSICAL_EVENT_IN_PROGRESS ;
0 commit comments