From 416f28248cba82e336ba306bb463731f2581a459 Mon Sep 17 00:00:00 2001 From: id Date: Sat, 17 Apr 1999 05:55:31 +0000 Subject: [PATCH] change mind. --- WINGs/wtextfield.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c index 70108ea5..3c5690f4 100644 --- a/WINGs/wtextfield.c +++ b/WINGs/wtextfield.c @@ -1062,6 +1062,7 @@ static void handleTextFieldActionEvents(XEvent *event, void *data) { TextField *tPtr = (TextField*)data; + static int move; CHECK_CLASS(data, WC_TextField); @@ -1085,29 +1086,40 @@ handleTextFieldActionEvents(XEvent *event, void *data) } } else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) { - paintCursor(tPtr); - tPtr->viewPosition--; - } + paintCursor(tPtr); + tPtr->viewPosition--; + } - if (!tPtr->selection.count) { - tPtr->selection.position = tPtr->cursorPosition; - } + if (!tPtr->selection.count) { + tPtr->selection.position = tPtr->cursorPosition; + } - tPtr->cursorPosition = pointToCursorPosition(tPtr, event->xmotion.x); + tPtr->cursorPosition = pointToCursorPosition(tPtr, event->xmotion.x); - tPtr->selection.count = tPtr->cursorPosition - tPtr->selection.position; + tPtr->selection.count = tPtr->cursorPosition - tPtr->selection.position; - /* - printf("notify %d %d\n",event->xmotion.x,tPtr->usableWidth); - */ + /* + printf("notify %d %d\n",event->xmotion.x,tPtr->usableWidth); + */ - paintCursor(tPtr); - paintTextField(tPtr); + paintCursor(tPtr); + paintTextField(tPtr); - } + } + if (move) { + int count; + XSetSelectionOwner(tPtr->view->screen->display, + XA_PRIMARY, None, CurrentTime); + count = tPtr->selection.count < 0 + ? tPtr->selection.position + tPtr->selection.count + : tPtr->selection.position; + XStoreBuffer(tPtr->view->screen->display, + &tPtr->text[count] , abs(tPtr->selection.count), 0); + } break; case ButtonPress: + move = 1; switch (tPtr->flags.alignment) { int textWidth; case WARight: @@ -1167,16 +1179,7 @@ handleTextFieldActionEvents(XEvent *event, void *data) break; case ButtonRelease: - { - int count; - XSetSelectionOwner(tPtr->view->screen->display, - XA_PRIMARY, None, CurrentTime); - count = tPtr->selection.count < 0 - ? tPtr->selection.position + tPtr->selection.count - : tPtr->selection.position; - XStoreBuffer(tPtr->view->screen->display, - &tPtr->text[count] , abs(tPtr->selection.count), 0); - } + move = 0; break; } } -- 2.11.4.GIT