* Keyboard and button event handler for map window. */
| 1154 | * Keyboard and button event handler for map window. |
| 1155 | */ |
| 1156 | void |
| 1157 | map_input(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| 1158 | { |
| 1159 | XKeyEvent *key; |
| 1160 | XButtonEvent *button; |
| 1161 | boolean meta = FALSE; |
| 1162 | int i, nbytes; |
| 1163 | Cardinal in_nparams = (num_params ? *num_params : 0); |
| 1164 | char c; |
| 1165 | char keystring[MAX_KEY_STRING]; |
| 1166 | |
| 1167 | switch (event->type) { |
| 1168 | case ButtonPress: |
| 1169 | if (!iflags.wc_mouse_support) |
| 1170 | return; |
| 1171 | |
| 1172 | button = (XButtonEvent *) event; |
| 1173 | #ifdef VERBOSE_INPUT |
| 1174 | printf("button press\n"); |
| 1175 | #endif |
| 1176 | if (in_nparams > 0 && (nbytes = strlen(params[0])) < MAX_KEY_STRING) { |
| 1177 | Strcpy(keystring, params[0]); |
| 1178 | key = (XKeyEvent *) event; /* just in case */ |
| 1179 | goto key_events; |
| 1180 | } |
| 1181 | if (w != window_list[WIN_MAP].w) { |
| 1182 | #ifdef VERBOSE_INPUT |
| 1183 | printf("map_input called from wrong window\n"); |
| 1184 | #endif |
| 1185 | X11_nhbell(); |
| 1186 | return; |
| 1187 | } |
| 1188 | set_button_values(w, button->x, button->y, button->button); |
| 1189 | break; |
| 1190 | case KeyPress: |
| 1191 | #ifdef VERBOSE_INPUT |
| 1192 | printf("key: "); |
| 1193 | #endif |
| 1194 | if (appResources.slow && input_func) { |
| 1195 | (*input_func)(w, event, params, num_params); |
| 1196 | break; |
| 1197 | } |
| 1198 | |
| 1199 | /* |
| 1200 | * Don't use key_event_to_char() because we want to be able |
| 1201 | * to allow keys mapped to multiple characters. |
| 1202 | */ |
| 1203 | key = (XKeyEvent *) event; |
| 1204 | if (in_nparams > 0 && (nbytes = strlen(params[0])) < MAX_KEY_STRING) { |
| 1205 | Strcpy(keystring, params[0]); |
| 1206 | } else { |
| 1207 | /* |
| 1208 | * Assume that mod1 is really the meta key. |
| 1209 | */ |
| 1210 | meta = !!(key->state & Mod1Mask); |
| 1211 | nbytes = XLookupString(key, keystring, MAX_KEY_STRING, |
| 1212 | (KeySym *) 0, (XComposeStatus *) 0); |
| 1213 | } |
no test coverage detected