wayland: oops! we have MwTimeGetTick, we should use that (even though I'm not sure if that's consistent across platforms. but it will at least compile

This commit is contained in:
IoIxD 2026-05-24 23:01:48 -07:00
commit 884c05acb7
3 changed files with 10 additions and 12 deletions

View file

@ -567,13 +567,13 @@ struct _MwLLWayland {
MwBool moving;
MwI64 keyboard_rate;
MwI32 keyboard_delay;
int last_pressed_key;
MwBool holding_key;
MwU64 next_elapsed;
struct timespec start_time;
struct timespec end_time;
MwI64 keyboard_rate;
MwI32 keyboard_delay;
int last_pressed_key;
MwBool holding_key;
MwU64 next_elapsed;
long start_time;
long end_time;
cairo_surface_t* front_cs;
cairo_surface_t* back_cs;

View file

@ -838,7 +838,7 @@ static void keyboard_key(void* data,
MwLLDispatch(self, key_released, &key);
self->wayland.holding_key = MwFALSE;
}
clock_gettime(CLOCK_REALTIME, &self->wayland.start_time);
self->wayland.start_time = MwTimeGetTick();
self->wayland.next_elapsed = self->wayland.keyboard_delay;
}
}

View file

@ -1150,12 +1150,10 @@ static int MwLLPendingImpl(MwLL handle) {
handle->wayland.setting_wh = 0;
}
clock_gettime(CLOCK_REALTIME, &handle->wayland.end_time);
handle->wayland.end_time = MwTimeGetTick();
if(handle->wayland.holding_key) {
double elapsed = ((double)(handle->wayland.end_time.tv_sec - handle->wayland.start_time.tv_sec) * 1.0e9 +
(double)(handle->wayland.end_time.tv_nsec - handle->wayland.start_time.tv_nsec)) /
1000000.0;
float elapsed = ((float)(handle->wayland.end_time - (float)handle->wayland.start_time));
if(elapsed >= handle->wayland.next_elapsed) {
MwLL topmost_parent = handle;
while(topmost_parent->wayland.parent) {