textfield: always re-acquire selection on double-click (fix Wayland paste→stale ownsSelection)

This commit is contained in:
Ollie 2026-05-28 21:44:51 +02:00
parent f2b4d25b81
commit f054296eb1
1 changed files with 7 additions and 6 deletions

View File

@ -1541,12 +1541,13 @@ static void handleTextFieldActionEvents(WMEvent * event, void *data)
}
paintTextField(tPtr);
if (!tPtr->flags.ownsSelection) {
tPtr->flags.ownsSelection =
WMCreateSelectionHandler(tPtr->view,
XA_PRIMARY,
event->u.button.time, &selectionHandler, NULL);
}
/* Always re-acquire on double-click so fresh data is
* pushed on Wayland (selectionLost never fires there).
* Safe on X11 — re-claiming your own selection is a no-op. */
tPtr->flags.ownsSelection =
WMCreateSelectionHandler(tPtr->view,
XA_PRIMARY,
event->u.button.time, &selectionHandler, NULL);
} else if (!tPtr->flags.secure && tPtr->selection.count != 0 && !tPtr->flags.ownsSelection) {
tPtr->flags.ownsSelection =
WMCreateSelectionHandler(tPtr->view,