1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 13:28:05 +01:00

fixed textfields regarding interpretation of special keys with modifiers

This commit is contained in:
dan
2002-03-14 22:20:25 +00:00
parent 65e65c4e9d
commit 97e20d94de
2 changed files with 85 additions and 93 deletions

View File

@@ -12,6 +12,7 @@ Changes since wmaker 0.80.0:
same case.
- Fixed WMGetViewScreenPosition() to consider the window decorations.
- Added ability to enable/disable individual WMTableViewItems.
- Fixed textfields regarding interpretation of special keys with modifiers.
Changes since wmaker 0.70.0:

View File

@@ -1018,13 +1018,9 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
control_pressed = 1;
shifted = event->xkey.state & ShiftMask;
controled = event->xkey.state & ControlMask;
if ((event->xkey.state & (ShiftMask|ControlMask)) != 0) {
modified = True;
} else {
modified = False;
}
shifted = (event->xkey.state & ShiftMask ? True : False);
controled = (event->xkey.state & ControlMask ? True : False);
modified = shifted || controled;
count = XLookupString(&event->xkey, buffer, 63, &ksym, NULL);
buffer[count] = '\0';
@@ -1034,7 +1030,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
#ifdef XK_ISO_Left_Tab
case XK_ISO_Left_Tab:
#endif
if (!controled && !modified) {
if (!controled) {
if (shifted) {
if (tPtr->view->prevFocusChain) {
W_SetFocusOfTopLevel(W_TopLevelOfView(tPtr->view),
@@ -1052,12 +1048,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
}
textEvent = WMTextDidEndEditingNotification;
cancelSelection = 0;
relay = False;
}
break;
case XK_Escape:
if (!shifted && !controled && !modified) {
if (!modified) {
data = (void*)WMEscapeTextMovement;
textEvent = WMTextDidEndEditingNotification;
@@ -1066,7 +1064,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case XK_Return:
if (!shifted && !controled && !modified) {
if (!modified) {
data = (void*)WMReturnTextMovement;
textEvent = WMTextDidEndEditingNotification;
@@ -1078,15 +1076,15 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
if (!control_pressed)
goto normal_key;
else
modified = False;
controled = False;
#ifdef XK_KP_Left
case XK_KP_Left:
#endif
case XK_Left:
if (!modified) {
if (tPtr->cursorPosition > 0) {
paintCursor(tPtr);
if (event->xkey.state & ControlMask) {
if (controled) {
int i = tPtr->cursorPosition - 1;
while (i > 0 && tPtr->text[i] != ' ') i--;
@@ -1102,27 +1100,26 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
} else
paintCursor(tPtr);
}
if (event->xkey.state & ShiftMask)
if (shifted)
cancelSelection = 0;
relay = False;
}
break;
case WM_EMACSKEY_RIGHT:
if (!control_pressed)
goto normal_key;
else
modified = False;
controled = False;
#ifdef XK_KP_Right
case XK_KP_Right:
#endif
case XK_Right:
if (!modified) {
if (tPtr->cursorPosition < tPtr->textLen) {
paintCursor(tPtr);
if (event->xkey.state & ControlMask) {
if (controled) {
int i = tPtr->cursorPosition;
while (tPtr->text[i] && tPtr->text[i] != ' ') i++;
@@ -1142,25 +1139,24 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
if (!refresh)
paintCursor(tPtr);
}
if (event->xkey.state & ShiftMask)
if (shifted)
cancelSelection = 0;
relay = False;
}
break;
case WM_EMACSKEY_HOME:
if (!control_pressed)
goto normal_key;
else {
modified = False;
else
controled = False;
}
#ifdef XK_KP_Home
case XK_KP_Home:
#endif
case XK_Home:
if (!modified && !controled) {
if (!controled) {
if (tPtr->cursorPosition > 0) {
paintCursor(tPtr);
tPtr->cursorPosition = 0;
@@ -1170,7 +1166,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
} else
paintCursor(tPtr);
}
if (event->xkey.state & ShiftMask)
if (shifted)
cancelSelection = 0;
relay = False;
@@ -1180,15 +1176,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
case WM_EMACSKEY_END:
if (!control_pressed)
goto normal_key;
else {
modified = False;
else
controled = False;
}
#ifdef XK_KP_End
case XK_KP_End:
#endif
case XK_End:
if (!modified && !controled) {
if (!controled) {
if (tPtr->cursorPosition < tPtr->textLen) {
paintCursor(tPtr);
tPtr->cursorPosition = tPtr->textLen;
@@ -1203,7 +1198,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
if (!refresh)
paintCursor(tPtr);
}
if (event->xkey.state & ShiftMask)
if (shifted)
cancelSelection = 0;
relay = False;
@@ -1213,13 +1208,11 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
case WM_EMACSKEY_BS:
if (!control_pressed)
goto normal_key;
else {
else
modified = False;
controled = False;
shifted = False;
}
case XK_BackSpace:
if (!modified && !shifted && !controled) {
if (!modified) {
if (tPtr->selection.count) {
WMDeleteTextFieldRange(tPtr, tPtr->selection);
data = (void*)WMDeleteTextEvent;
@@ -1240,16 +1233,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
case WM_EMACSKEY_DEL:
if (!control_pressed)
goto normal_key;
else {
else
modified = False;
controled = False;
shifted = False;
}
#ifdef XK_KP_Delete
case XK_KP_Delete:
#endif
case XK_Delete:
if (!modified && !controled && !shifted) {
if (!modified) {
if (tPtr->selection.count) {
WMDeleteTextFieldRange(tPtr, tPtr->selection);
data = (void*)WMDeleteTextEvent;