Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cadet.c: Minor cleanup. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | ams/cleanup |
Files: | files | file ages | folders |
SHA3-256: |
9b54829fe3ec85cead33eca841f3a453 |
User & Date: | ams 2024-05-29 09:10:48 |
Context
2024-05-30
| ||
07:38 | cadet.c: Move keymap to cadet.defs. Closed-Leaf check-in: a654806104 user: ams tags: ams/cleanup | |
2024-05-29
| ||
09:10 | cadet.c: Minor cleanup. check-in: 9b54829fe3 user: ams tags: ams/cleanup | |
09:02 | cadet.c: Remove useless comment. check-in: b70e0e36e3 user: ams tags: ams/cleanup | |
Changes
Changes to cadet.c.
1 2 3 | /* cadet.c --- Space Cadet (aka new) keyboard translation */ | < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* cadet.c --- Space Cadet (aka new) keyboard translation */ #include <stdint.h> #include <string.h> #include <stdbool.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #include "ucode.h" #include "utrace.h" #include "iob.h" #include "kbd.h" /* * Second index in CADET_KBD_MAP, gives which shift must be generated. */ #define CADET_IX_UNSHIFT 0 |
︙ | ︙ | |||
118 119 120 121 122 123 124 | keycode = modmap->modifiermap[modifier * modmap->max_keypermod + i]; if (keymap[keycode / 8] & (1 << keycode % 8)) { keymap[keycode / 8] &= ~(1 << keycode % 8); /* Clear the key in KEYMAP. */ DEBUG(TRACE_KBD, "cadet_allup_key() - bucky pressed (%d); keycode = %d\n", bucky, keycode); switch (bucky) { case KBD_SHIFT: | < < < < < < < < < < < | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | keycode = modmap->modifiermap[modifier * modmap->max_keypermod + i]; if (keymap[keycode / 8] & (1 << keycode % 8)) { keymap[keycode / 8] &= ~(1 << keycode % 8); /* Clear the key in KEYMAP. */ DEBUG(TRACE_KBD, "cadet_allup_key() - bucky pressed (%d); keycode = %d\n", bucky, keycode); switch (bucky) { case KBD_SHIFT: mods |= CADET_ALLUP_SHIFT; shifts |= (1 << CADET_IX_SHIFT); break; case KBD_TOP: mods |= CADET_ALLUP_TOP; shifts |= (1 << CADET_IX_TOP); break; case KBD_CONTROL: mods |= CADET_ALLUP_CONTROL; break; case KBD_META: mods |= CADET_ALLUP_META; break; case KBD_SHIFT_LOCK: mods |= CADET_ALLUP_CAPS_LOCK; break; case KBD_MODE_LOCK: mods |= CADET_ALLUP_MODELOCK; break; case KBD_GREEK: mods |= CADET_ALLUP_GREEK; shifts |= (1 << CADET_IX_GREEK); break; case KBD_REPEAT: break; case KBD_ALT_LOCK: mods |= CADET_ALLUP_ALTLOCK; break; case KBD_HYPER: mods |= CADET_ALLUP_HYPER; break; case KBD_SUPER: mods |= CADET_ALLUP_SUPER; break; default: WARNING(TRACE_KBD, "kbd (cadet): unknown bucky key: 0%o\n", x11_modifier_map[modifier]); break; } } |
︙ | ︙ | |||
185 186 187 188 189 190 191 | DEBUG(TRACE_KBD, "cadet_allup_key() - found a key that is up which is not a shift; keymap[%d] = 0%o\n", i, keymap[i]); allup = false; break; } } if (allup == true) { DEBUG(TRACE_KBD, "cadet_allup_key() - all-up event; mods = 0%o, shifts = 0%o\n", mods, shifts); | | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | DEBUG(TRACE_KBD, "cadet_allup_key() - found a key that is up which is not a shift; keymap[%d] = 0%o\n", i, keymap[i]); allup = false; break; } } if (allup == true) { DEBUG(TRACE_KBD, "cadet_allup_key() - all-up event; mods = 0%o, shifts = 0%o\n", mods, shifts); cadet_shifts = shifts; /* Keep track of shifts. */ cadet_allup_event(mods); /* Generate all-up event. */ } return allup; #elif WITH_SDL #endif } static void |
︙ | ︙ | |||
221 222 223 224 225 226 227 | void cadet_process_key(XEvent *e, int keydown) { #ifdef WITH_X11 KeySym keysym; KeyCode keycode; static XComposeStatus status; | | | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | void cadet_process_key(XEvent *e, int keydown) { #ifdef WITH_X11 KeySym keysym; KeyCode keycode; static XComposeStatus status; int bi; /* Bucky key in X11_MODIFIER_MAP. */ int lmchar; /* Lisp Machine charachter to insert. */ int scc; /* Space Cadet scancode. */ int wantshift; /* Index into second column in cadet_kbd_map. */ int shkey; /* Shift key being pressed. */ int oshift; unsigned char buf[5]; if (!keydown && cadet_allup_key() == true) return; XLookupString(&e->xkey, (char *) buf, sizeof(buf), &keysym, &status); keycode = x11_keysym_to_keycode(keysym); |
︙ | ︙ |