diff options
Diffstat (limited to 'win/tkWinKey.c')
-rw-r--r-- | win/tkWinKey.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/win/tkWinKey.c b/win/tkWinKey.c index dae3ed3..8e66171 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -23,7 +23,7 @@ #define MAX_KEYCODE 145 /* VK_SCROLL is the last entry in our table below */ -static KeySym keymap[] = { +static const KeySym keymap[] = { NoSymbol, NoSymbol, NoSymbol, XK_Cancel, NoSymbol, NoSymbol, NoSymbol, NoSymbol, XK_BackSpace, XK_Tab, NoSymbol, NoSymbol, XK_Clear, XK_Return, NoSymbol, @@ -79,7 +79,7 @@ static KeySym KeycodeToKeysym(unsigned int keycode, *---------------------------------------------------------------------- */ -char * +const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred: needed to get * input context. */ @@ -328,7 +328,7 @@ KeycodeToKeysym( */ skipToAscii: - if (keycode < 0 || keycode > MAX_KEYCODE) { + if (keycode > MAX_KEYCODE) { return NoSymbol; } switch (keycode) { @@ -502,12 +502,11 @@ TkpInitKeymapInfo( */ if (dispPtr->modKeyCodes != NULL) { - ckfree((char *) dispPtr->modKeyCodes); + ckfree(dispPtr->modKeyCodes); } dispPtr->numModKeyCodes = 0; arraySize = KEYCODE_ARRAY_SIZE; - dispPtr->modKeyCodes = (KeyCode *) ckalloc((unsigned) - (KEYCODE_ARRAY_SIZE * sizeof(KeyCode))); + dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; @@ -530,11 +529,10 @@ TkpInitKeymapInfo( */ arraySize *= 2; - new = (KeyCode *) ckalloc((unsigned) - (arraySize * sizeof(KeyCode))); - memcpy((void *) new, (void *) dispPtr->modKeyCodes, - (dispPtr->numModKeyCodes * sizeof(KeyCode))); - ckfree((char *) dispPtr->modKeyCodes); + new = ckalloc(arraySize * sizeof(KeyCode)); + memcpy(new, dispPtr->modKeyCodes, + dispPtr->numModKeyCodes * sizeof(KeyCode)); + ckfree(dispPtr->modKeyCodes); dispPtr->modKeyCodes = new; } dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr; @@ -660,11 +658,10 @@ XModifierKeymap * XGetModifierMapping( Display *display) { - XModifierKeymap *map = (XModifierKeymap *) - ckalloc(sizeof(XModifierKeymap)); + XModifierKeymap *map = ckalloc(sizeof(XModifierKeymap)); map->max_keypermod = 1; - map->modifiermap = (KeyCode *) ckalloc(sizeof(KeyCode)*8); + map->modifiermap = ckalloc(sizeof(KeyCode) * 8); map->modifiermap[ShiftMapIndex] = VK_SHIFT; map->modifiermap[LockMapIndex] = VK_CAPITAL; map->modifiermap[ControlMapIndex] = VK_CONTROL; @@ -696,8 +693,8 @@ void XFreeModifiermap( XModifierKeymap *modmap) { - ckfree((char *) modmap->modifiermap); - ckfree((char *) modmap); + ckfree(modmap->modifiermap); + ckfree(modmap); } /* |