mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-22 03:13:31 +01:00
WINGs: fix cursor ghosting issue in wtextfield
The cursor is moved using right/left arrows but as it's blinking and a XOR function is used to hide/unhide it, it happens the cursor can be not hidden properly from its previous position. Better to refresh the view to avoid such issues.
This commit is contained in:
committed by
Carlos R. Mafra
parent
d2b2c3238b
commit
a542934e67
@@ -1036,7 +1036,6 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
case XK_Left:
|
case XK_Left:
|
||||||
if (tPtr->cursorPosition > 0) {
|
if (tPtr->cursorPosition > 0) {
|
||||||
int i;
|
int i;
|
||||||
paintCursor(tPtr);
|
|
||||||
|
|
||||||
i = tPtr->cursorPosition;
|
i = tPtr->cursorPosition;
|
||||||
i += oneUTF8CharBackward(&tPtr->text[i], i);
|
i += oneUTF8CharBackward(&tPtr->text[i], i);
|
||||||
@@ -1052,9 +1051,8 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
|
|
||||||
if (tPtr->cursorPosition < tPtr->viewPosition) {
|
if (tPtr->cursorPosition < tPtr->viewPosition) {
|
||||||
tPtr->viewPosition = tPtr->cursorPosition;
|
tPtr->viewPosition = tPtr->cursorPosition;
|
||||||
refresh = 1;
|
}
|
||||||
} else
|
refresh = 1;
|
||||||
paintCursor(tPtr);
|
|
||||||
}
|
}
|
||||||
if (shifted)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
@@ -1077,7 +1075,6 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
case XK_Right:
|
case XK_Right:
|
||||||
if (tPtr->cursorPosition < tPtr->textLen) {
|
if (tPtr->cursorPosition < tPtr->textLen) {
|
||||||
int i;
|
int i;
|
||||||
paintCursor(tPtr);
|
|
||||||
|
|
||||||
i = tPtr->cursorPosition;
|
i = tPtr->cursorPosition;
|
||||||
if (controled) {
|
if (controled) {
|
||||||
@@ -1090,10 +1087,8 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
}
|
}
|
||||||
tPtr->cursorPosition = i;
|
tPtr->cursorPosition = i;
|
||||||
|
|
||||||
refresh = incrToFit2(tPtr);
|
incrToFit2(tPtr);
|
||||||
|
refresh = 1;
|
||||||
if (!refresh)
|
|
||||||
paintCursor(tPtr);
|
|
||||||
}
|
}
|
||||||
if (shifted)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
@@ -1116,13 +1111,11 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
case XK_Home:
|
case XK_Home:
|
||||||
if (!controled) {
|
if (!controled) {
|
||||||
if (tPtr->cursorPosition > 0) {
|
if (tPtr->cursorPosition > 0) {
|
||||||
paintCursor(tPtr);
|
|
||||||
tPtr->cursorPosition = 0;
|
tPtr->cursorPosition = 0;
|
||||||
if (tPtr->viewPosition > 0) {
|
if (tPtr->viewPosition > 0) {
|
||||||
tPtr->viewPosition = 0;
|
tPtr->viewPosition = 0;
|
||||||
refresh = 1;
|
}
|
||||||
} else
|
refresh = 1;
|
||||||
paintCursor(tPtr);
|
|
||||||
}
|
}
|
||||||
if (shifted)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
@@ -1145,14 +1138,11 @@ static void handleTextFieldKeyPress(TextField * tPtr, XEvent * event)
|
|||||||
case XK_End:
|
case XK_End:
|
||||||
if (!controled) {
|
if (!controled) {
|
||||||
if (tPtr->cursorPosition < tPtr->textLen) {
|
if (tPtr->cursorPosition < tPtr->textLen) {
|
||||||
paintCursor(tPtr);
|
|
||||||
tPtr->cursorPosition = tPtr->textLen;
|
tPtr->cursorPosition = tPtr->textLen;
|
||||||
tPtr->viewPosition = 0;
|
tPtr->viewPosition = 0;
|
||||||
|
|
||||||
refresh = incrToFit(tPtr);
|
incrToFit(tPtr);
|
||||||
|
refresh = 1;
|
||||||
if (!refresh)
|
|
||||||
paintCursor(tPtr);
|
|
||||||
}
|
}
|
||||||
if (shifted)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user