From ae2d859e63fbc3d1c357034d9236e8124b7b29ec Mon Sep 17 00:00:00 2001 From: Nishi Date: Thu, 17 Sep 2026 02:06:39 +0900 Subject: [PATCH] move --- src/widget/document.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/widget/document.c b/src/widget/document.c index 7611c62..55dd1f0 100644 --- a/src/widget/document.c +++ b/src/widget/document.c @@ -474,6 +474,21 @@ static void add_clickable(MwDocument d, char* c_title, MwRect* clickable) { arrput(d->clickables, c); } +static void mouse_move(MwWidget handle) { + char* event = in_hitbox(handle, &handle->mouse_point); + MwDocument d = handle->internal; + + if(d->center_cursor && event == NULL) { + MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask); + + d->center_cursor = 0; + } else if(!d->center_cursor && event != NULL) { + MwLLSetCursor(handle->lowlevel, &MwCursorCenter, &MwCursorCenterMask); + + d->center_cursor = 1; + } +} + static void layout(MwWidget handle) { MwDocument d = handle->internal; int w = MwGetInteger(handle, MwNwidth); @@ -602,6 +617,7 @@ static void layout(MwWidget handle) { arrfree(fontstack); + mouse_move(handle); MwForceRender(handle); } @@ -629,21 +645,6 @@ static void prop_change(MwWidget handle, const char* key) { } } -static void mouse_move(MwWidget handle) { - char* event = in_hitbox(handle, &handle->mouse_point); - MwDocument d = handle->internal; - - if(d->center_cursor && event == NULL) { - MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask); - - d->center_cursor = 0; - } else if(!d->center_cursor && event != NULL) { - MwLLSetCursor(handle->lowlevel, &MwCursorCenter, &MwCursorCenterMask); - - d->center_cursor = 1; - } -} - static void resize(MwWidget handle) { layout(handle); }