diff options
Diffstat (limited to '')
| -rw-r--r-- | st.c | 58 |
1 files changed, 2 insertions, 56 deletions
| @@ -110,16 +110,6 @@ typedef struct { | |||
| 110 | int narg; /* nb of args */ | 110 | int narg; /* nb of args */ |
| 111 | } STREscape; | 111 | } STREscape; |
| 112 | 112 | ||
| 113 | typedef struct { | ||
| 114 | KeySym k; | ||
| 115 | uint mask; | ||
| 116 | char *s; | ||
| 117 | /* three valued logic variables: 0 indifferent, 1 on, -1 off */ | ||
| 118 | signed char appkey; /* application keypad */ | ||
| 119 | signed char appcursor; /* application cursor */ | ||
| 120 | signed char crlf; /* crlf mode */ | ||
| 121 | } Key; | ||
| 122 | |||
| 123 | /* function definitions used in config.h */ | 113 | /* function definitions used in config.h */ |
| 124 | static void clipcopy(const Arg *); | 114 | static void clipcopy(const Arg *); |
| 125 | static void clippaste(const Arg *); | 115 | static void clippaste(const Arg *); |
| @@ -223,6 +213,8 @@ size_t colornamelen = LEN(colorname); | |||
| 223 | size_t mshortcutslen = LEN(mshortcuts); | 213 | size_t mshortcutslen = LEN(mshortcuts); |
| 224 | size_t shortcutslen = LEN(shortcuts); | 214 | size_t shortcutslen = LEN(shortcuts); |
| 225 | size_t selmaskslen = LEN(selmasks); | 215 | size_t selmaskslen = LEN(selmasks); |
| 216 | size_t keyslen = LEN(key); | ||
| 217 | size_t mappedkeyslen = LEN(mappedkeys); | ||
| 226 | 218 | ||
| 227 | ssize_t | 219 | ssize_t |
| 228 | xwrite(int fd, const char *s, size_t len) | 220 | xwrite(int fd, const char *s, size_t len) |
| @@ -2550,54 +2542,8 @@ redraw(void) | |||
| 2550 | draw(); | 2542 | draw(); |
| 2551 | } | 2543 | } |
| 2552 | 2544 | ||
| 2553 | int | ||
| 2554 | match(uint mask, uint state) | ||
| 2555 | { | ||
| 2556 | return mask == XK_ANY_MOD || mask == (state & ~ignoremod); | ||
| 2557 | } | ||
| 2558 | |||
| 2559 | void | 2545 | void |
| 2560 | numlock(const Arg *dummy) | 2546 | numlock(const Arg *dummy) |
| 2561 | { | 2547 | { |
| 2562 | term.numlock ^= 1; | 2548 | term.numlock ^= 1; |
| 2563 | } | 2549 | } |
| 2564 | |||
| 2565 | char* | ||
| 2566 | kmap(KeySym k, uint state) | ||
| 2567 | { | ||
| 2568 | Key *kp; | ||
| 2569 | int i; | ||
| 2570 | |||
| 2571 | /* Check for mapped keys out of X11 function keys. */ | ||
| 2572 | for (i = 0; i < LEN(mappedkeys); i++) { | ||
| 2573 | if (mappedkeys[i] == k) | ||
| 2574 | break; | ||
| 2575 | } | ||
| 2576 | if (i == LEN(mappedkeys)) { | ||
| 2577 | if ((k & 0xFFFF) < 0xFD00) | ||
| 2578 | return NULL; | ||
| 2579 | } | ||
| 2580 | |||
| 2581 | for (kp = key; kp < key + LEN(key); kp++) { | ||
| 2582 | if (kp->k != k) | ||
| 2583 | continue; | ||
| 2584 | |||
| 2585 | if (!match(kp->mask, state)) | ||
| 2586 | continue; | ||
| 2587 | |||
| 2588 | if (IS_SET(MODE_APPKEYPAD) ? kp->appkey < 0 : kp->appkey > 0) | ||
| 2589 | continue; | ||
| 2590 | if (term.numlock && kp->appkey == 2) | ||
| 2591 | continue; | ||
| 2592 | |||
| 2593 | if (IS_SET(MODE_APPCURSOR) ? kp->appcursor < 0 : kp->appcursor > 0) | ||
| 2594 | continue; | ||
| 2595 | |||
| 2596 | if (IS_SET(MODE_CRLF) ? kp->crlf < 0 : kp->crlf > 0) | ||
| 2597 | continue; | ||
| 2598 | |||
| 2599 | return kp->s; | ||
| 2600 | } | ||
| 2601 | |||
| 2602 | return NULL; | ||
| 2603 | } | ||
