rem: } else if (tPtr->flags.focused) {
add: } if (tPtr->flags.focused) {
context: handleTextFieldActionEvents(XEvent *event, void *data){    TextField *tPtr = (TextField*)data;    static int move = 0;    static Time lastButtonReleasedEvent = 0;    Display *dpy = event->xany.display;        CHECK_CLASS(data, WC_TextField);    switch (event->type) {     case KeyPress:	if (tPtr->flags.waitingSelection) {	    return;	}        if (tPtr->flags.enabled && tPtr->flags.focused) {            handleTextFieldKeyPress(tPtr, event);	    XDefineCursor(dpy, W_VIEW(tPtr)->window, 			  W_VIEW(tPtr)->screen->invisibleCursor);	    tPtr->flags.pointerGrabbed = 1;	}        break;     case MotionNotify:		if (tPtr->flags.pointerGrabbed) {	    tPtr->flags.pointerGrabbed = 0;	    XDefineCursor(dpy, W_VIEW(tPtr)->window, 			  W_VIEW(tPtr)->screen->textCursor);	}	if (tPtr->flags.waitingSelection) {	    return;	}        if (tPtr->flags.enabled && (event->xmotion.state & Button1Mask)) {	    if (tPtr->viewPosition < tPtr->textLen && event->xmotion.x >                tPtr->usableWidth) {		if (WMWidthOfString(tPtr->font,				    &(tPtr->text[tPtr->viewPosition]),				    tPtr->cursorPosition-tPtr->viewPosition)                    > tPtr->usableWidth) {		    tPtr->viewPosition++;		}	    } else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) {		paintCursor(tPtr);		tPtr->viewPosition--;	    }	    tPtr->cursorPosition = 		pointToCursorPosition(tPtr, event->xmotion.x);            /* Do not allow text selection in secure textfields */            if (tPtr->flags.secure) {                tPtr->selection.position = tPtr->cursorPosition;            }            tPtr->selection.count = tPtr->cursorPosition - tPtr->selection.position;	    if (tPtr->selection.count != 0) {		if (!tPtr->flags.ownsSelection) {		    WMCreateSelectionHandler(tPtr->view,					     XA_PRIMARY,					     event->xbutton.time,					     &selectionHandler, NULL);		    tPtr->flags.ownsSelection = 1;		}	    }	    	    paintCursor(tPtr);	    paintTextField(tPtr);	}	break;     case ButtonPress:	if (tPtr->flags.pointerGrabbed) {	    tPtr->flags.pointerGrabbed = 0;	    XDefineCursor(dpy, W_VIEW(tPtr)->window, 			  W_VIEW(tPtr)->screen->textCursor);	    break;	}		if (tPtr->flags.waitingSelection) {	    break;	}        move = 1;        switch (tPtr->flags.alignment) {            int textWidth;         case WARight:            textWidth = WMWidthOfString(tPtr->font, tPtr->text, tPtr->textLen);            if (tPtr->flags.enabled && !tPtr->flags.focused) {                WMSetFocusToWidget(tPtr);            } else if (tPtr->flags.focused) {		tPtr->selection.position = tPtr->cursorPosition;                tPtr->selection.count = 0;            }            if (textWidth < tPtr->usableWidth) {                tPtr->cursorPosition = pointToCursorPosition(tPtr, 				     event->xbutton.x - tPtr->usableWidth                                     + textWidth);            } else tPtr->cursorPosition = pointToCursorPosition(tPtr,                                     event->xbutton.x);            paintTextField(tPtr);            break;                 case WALeft:            if (tPtr->flags.enabled && !tPtr->flags.focused) {                WMSetFocusToWidget(tPtr);                tPtr->cursorPosition = pointToCursorPosition(tPtr,                                      event->xbutton.x);                paintTextField(tPtr);            } else if (tPtr->flags.focused 		       && event->xbutton.button == Button1) {                tPtr->cursorPosition = pointToCursorPosition(tPtr,                                      event->xbutton.x);		tPtr->selection.position = tPtr->cursorPosition;                tPtr->selection.count = 0;                paintTextField(tPtr);            }            if (event->xbutton.button == Button2 && tPtr->flags.enabled) {                char *text;		int n;		if (!WMRequestSelection(tPtr->view, XA_PRIMARY, XA_STRING, 					event->xbutton.time,					pasteText, NULL)) {		    text = XFetchBuffer(tPtr->view->screen->display, &n, 0);				    if (text) {			text[n] = 0;			WMInsertTextFieldText(tPtr, text, tPtr->cursorPosition);			XFree(text);			NOTIFY(tPtr, didChange, WMTextDidChangeNotification,			       (void*)WMInsertTextEvent);		    }		} else {		    tPtr->flags.waitingSelection = 1;		}            }            break;	 default:	    break;        }	break;     case ButtonRelease:	if (tPtr->flags.pointerGrabbed) {	    tPtr->flags.pointerGrabbed = 0;	    XDefineCursor(dpy, W_VIEW(tPtr)->window, 			  W_VIEW(tPtr)->screen->textCursor);	}	if (tPtr->flags.waitingSelection) {	    break;	}		if (tPtr->selection.count != 0) {	    int start, count;	    XRotateBuffers(dpy, 1);	    	    count = abs(tPtr->selection.count);	    if (tPtr->selection.count < 0)		start = tPtr->selection.position - count;	    else		start = tPtr->selection.position;	    	    XStoreBuffer(dpy, &tPtr->text[start], count, 0);	}	move = 0;		        if (!tPtr->flags.secure &&            event->xbutton.time - lastButtonReleasedEvent            <= WINGsConfiguration.doubleClickDelay) {	    tPtr->selection.position = 0;	    tPtr->selection.count = tPtr->textLen;	    paintTextField(tPtr);	    	    if (!tPtr->flags.ownsSelection) {		WMCreateSelectionHandler(tPtr->view,					 XA_PRIMARY,					 event->xbutton.time,					 &selectionHandler, NULL);		tPtr->flags.ownsSelection = 1;	    }	    	    WMPostNotificationName("_lostOwnership", NULL, tPtr);	}	lastButtonReleasedEvent = event->xbutton.time;		        break;    }}