mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-08 09:25:49 +01:00
fixed textfields regarding interpretation of special keys with modifiers
This commit is contained in:
@@ -12,6 +12,7 @@ Changes since wmaker 0.80.0:
|
|||||||
same case.
|
same case.
|
||||||
- Fixed WMGetViewScreenPosition() to consider the window decorations.
|
- Fixed WMGetViewScreenPosition() to consider the window decorations.
|
||||||
- Added ability to enable/disable individual WMTableViewItems.
|
- Added ability to enable/disable individual WMTableViewItems.
|
||||||
|
- Fixed textfields regarding interpretation of special keys with modifiers.
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.70.0:
|
Changes since wmaker 0.70.0:
|
||||||
|
|||||||
@@ -1018,13 +1018,9 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
|
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
|
||||||
control_pressed = 1;
|
control_pressed = 1;
|
||||||
|
|
||||||
shifted = event->xkey.state & ShiftMask;
|
shifted = (event->xkey.state & ShiftMask ? True : False);
|
||||||
controled = event->xkey.state & ControlMask;
|
controled = (event->xkey.state & ControlMask ? True : False);
|
||||||
if ((event->xkey.state & (ShiftMask|ControlMask)) != 0) {
|
modified = shifted || controled;
|
||||||
modified = True;
|
|
||||||
} else {
|
|
||||||
modified = False;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = XLookupString(&event->xkey, buffer, 63, &ksym, NULL);
|
count = XLookupString(&event->xkey, buffer, 63, &ksym, NULL);
|
||||||
buffer[count] = '\0';
|
buffer[count] = '\0';
|
||||||
@@ -1034,7 +1030,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
#ifdef XK_ISO_Left_Tab
|
#ifdef XK_ISO_Left_Tab
|
||||||
case XK_ISO_Left_Tab:
|
case XK_ISO_Left_Tab:
|
||||||
#endif
|
#endif
|
||||||
if (!controled && !modified) {
|
if (!controled) {
|
||||||
if (shifted) {
|
if (shifted) {
|
||||||
if (tPtr->view->prevFocusChain) {
|
if (tPtr->view->prevFocusChain) {
|
||||||
W_SetFocusOfTopLevel(W_TopLevelOfView(tPtr->view),
|
W_SetFocusOfTopLevel(W_TopLevelOfView(tPtr->view),
|
||||||
@@ -1052,12 +1048,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
}
|
}
|
||||||
textEvent = WMTextDidEndEditingNotification;
|
textEvent = WMTextDidEndEditingNotification;
|
||||||
|
|
||||||
|
cancelSelection = 0;
|
||||||
|
|
||||||
relay = False;
|
relay = False;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Escape:
|
case XK_Escape:
|
||||||
if (!shifted && !controled && !modified) {
|
if (!modified) {
|
||||||
data = (void*)WMEscapeTextMovement;
|
data = (void*)WMEscapeTextMovement;
|
||||||
textEvent = WMTextDidEndEditingNotification;
|
textEvent = WMTextDidEndEditingNotification;
|
||||||
|
|
||||||
@@ -1066,7 +1064,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Return:
|
case XK_Return:
|
||||||
if (!shifted && !controled && !modified) {
|
if (!modified) {
|
||||||
data = (void*)WMReturnTextMovement;
|
data = (void*)WMReturnTextMovement;
|
||||||
textEvent = WMTextDidEndEditingNotification;
|
textEvent = WMTextDidEndEditingNotification;
|
||||||
|
|
||||||
@@ -1078,15 +1076,15 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else
|
else
|
||||||
modified = False;
|
controled = False;
|
||||||
|
|
||||||
#ifdef XK_KP_Left
|
#ifdef XK_KP_Left
|
||||||
case XK_KP_Left:
|
case XK_KP_Left:
|
||||||
#endif
|
#endif
|
||||||
case XK_Left:
|
case XK_Left:
|
||||||
if (!modified) {
|
|
||||||
if (tPtr->cursorPosition > 0) {
|
if (tPtr->cursorPosition > 0) {
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
if (event->xkey.state & ControlMask) {
|
if (controled) {
|
||||||
int i = tPtr->cursorPosition - 1;
|
int i = tPtr->cursorPosition - 1;
|
||||||
|
|
||||||
while (i > 0 && tPtr->text[i] != ' ') i--;
|
while (i > 0 && tPtr->text[i] != ' ') i--;
|
||||||
@@ -1102,27 +1100,26 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
} else
|
} else
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
}
|
}
|
||||||
if (event->xkey.state & ShiftMask)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
|
|
||||||
relay = False;
|
relay = False;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_EMACSKEY_RIGHT:
|
case WM_EMACSKEY_RIGHT:
|
||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else
|
else
|
||||||
modified = False;
|
controled = False;
|
||||||
|
|
||||||
#ifdef XK_KP_Right
|
#ifdef XK_KP_Right
|
||||||
case XK_KP_Right:
|
case XK_KP_Right:
|
||||||
#endif
|
#endif
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
if (!modified) {
|
|
||||||
if (tPtr->cursorPosition < tPtr->textLen) {
|
if (tPtr->cursorPosition < tPtr->textLen) {
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
if (event->xkey.state & ControlMask) {
|
if (controled) {
|
||||||
int i = tPtr->cursorPosition;
|
int i = tPtr->cursorPosition;
|
||||||
|
|
||||||
while (tPtr->text[i] && tPtr->text[i] != ' ') i++;
|
while (tPtr->text[i] && tPtr->text[i] != ' ') i++;
|
||||||
@@ -1142,25 +1139,24 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
if (!refresh)
|
if (!refresh)
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
}
|
}
|
||||||
if (event->xkey.state & ShiftMask)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
|
|
||||||
relay = False;
|
relay = False;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_EMACSKEY_HOME:
|
case WM_EMACSKEY_HOME:
|
||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else {
|
else
|
||||||
modified = False;
|
|
||||||
controled = False;
|
controled = False;
|
||||||
}
|
|
||||||
#ifdef XK_KP_Home
|
#ifdef XK_KP_Home
|
||||||
case XK_KP_Home:
|
case XK_KP_Home:
|
||||||
#endif
|
#endif
|
||||||
case XK_Home:
|
case XK_Home:
|
||||||
if (!modified && !controled) {
|
if (!controled) {
|
||||||
if (tPtr->cursorPosition > 0) {
|
if (tPtr->cursorPosition > 0) {
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
tPtr->cursorPosition = 0;
|
tPtr->cursorPosition = 0;
|
||||||
@@ -1170,7 +1166,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
} else
|
} else
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
}
|
}
|
||||||
if (event->xkey.state & ShiftMask)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
|
|
||||||
relay = False;
|
relay = False;
|
||||||
@@ -1180,15 +1176,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
case WM_EMACSKEY_END:
|
case WM_EMACSKEY_END:
|
||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else {
|
else
|
||||||
modified = False;
|
|
||||||
controled = False;
|
controled = False;
|
||||||
}
|
|
||||||
#ifdef XK_KP_End
|
#ifdef XK_KP_End
|
||||||
case XK_KP_End:
|
case XK_KP_End:
|
||||||
#endif
|
#endif
|
||||||
case XK_End:
|
case XK_End:
|
||||||
if (!modified && !controled) {
|
if (!controled) {
|
||||||
if (tPtr->cursorPosition < tPtr->textLen) {
|
if (tPtr->cursorPosition < tPtr->textLen) {
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
tPtr->cursorPosition = tPtr->textLen;
|
tPtr->cursorPosition = tPtr->textLen;
|
||||||
@@ -1203,7 +1198,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
if (!refresh)
|
if (!refresh)
|
||||||
paintCursor(tPtr);
|
paintCursor(tPtr);
|
||||||
}
|
}
|
||||||
if (event->xkey.state & ShiftMask)
|
if (shifted)
|
||||||
cancelSelection = 0;
|
cancelSelection = 0;
|
||||||
|
|
||||||
relay = False;
|
relay = False;
|
||||||
@@ -1213,13 +1208,11 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
case WM_EMACSKEY_BS:
|
case WM_EMACSKEY_BS:
|
||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else {
|
else
|
||||||
modified = False;
|
modified = False;
|
||||||
controled = False;
|
|
||||||
shifted = False;
|
|
||||||
}
|
|
||||||
case XK_BackSpace:
|
case XK_BackSpace:
|
||||||
if (!modified && !shifted && !controled) {
|
if (!modified) {
|
||||||
if (tPtr->selection.count) {
|
if (tPtr->selection.count) {
|
||||||
WMDeleteTextFieldRange(tPtr, tPtr->selection);
|
WMDeleteTextFieldRange(tPtr, tPtr->selection);
|
||||||
data = (void*)WMDeleteTextEvent;
|
data = (void*)WMDeleteTextEvent;
|
||||||
@@ -1240,16 +1233,14 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
case WM_EMACSKEY_DEL:
|
case WM_EMACSKEY_DEL:
|
||||||
if (!control_pressed)
|
if (!control_pressed)
|
||||||
goto normal_key;
|
goto normal_key;
|
||||||
else {
|
else
|
||||||
modified = False;
|
modified = False;
|
||||||
controled = False;
|
|
||||||
shifted = False;
|
|
||||||
}
|
|
||||||
#ifdef XK_KP_Delete
|
#ifdef XK_KP_Delete
|
||||||
case XK_KP_Delete:
|
case XK_KP_Delete:
|
||||||
#endif
|
#endif
|
||||||
case XK_Delete:
|
case XK_Delete:
|
||||||
if (!modified && !controled && !shifted) {
|
if (!modified) {
|
||||||
if (tPtr->selection.count) {
|
if (tPtr->selection.count) {
|
||||||
WMDeleteTextFieldRange(tPtr, tPtr->selection);
|
WMDeleteTextFieldRange(tPtr, tPtr->selection);
|
||||||
data = (void*)WMDeleteTextEvent;
|
data = (void*)WMDeleteTextEvent;
|
||||||
|
|||||||
Reference in New Issue
Block a user