Changeset 925
- Timestamp:
- 05/17/08 10:59:02 (4 months ago)
- Files:
-
- trunk/src/util.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/util.c
r918 r925 1058 1058 ui_event_data kk; 1059 1059 ui_event_data ke; 1060 1060 1061 1061 bool done = FALSE; 1062 1062 1063 1063 term *old = Term; 1064 1065 1064 1066 1065 /* Initialise keypress */ 1067 1066 ke.key = 0; 1068 1067 ke.type = EVT_NONE; 1069 1068 1070 1069 /* Hack -- Use the "inkey_next" pointer */ 1071 1070 if (inkey_next && *inkey_next && !inkey_xtra) … … 1074 1073 ke.key = *inkey_next++; 1075 1074 ke.type = EVT_KBRD; 1076 1075 1077 1076 /* Cancel the various "global parameters" */ 1078 inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE; 1079 1077 inkey_base = inkey_xtra = inkey_flag = FALSE; 1078 inkey_scan = 0; 1079 1080 1080 /* Accept result */ 1081 1081 return (ke); 1082 1082 } 1083 1083 1084 1084 /* Forget pointer */ 1085 1085 inkey_next = NULL; 1086 1087 1086 1088 1087 #ifdef ALLOW_BORG 1089 1088 1090 1089 /* Mega-Hack -- Use the special hook */ 1091 1090 if (inkey_hack && ((ch = (*inkey_hack)(inkey_xtra)) != 0)) 1092 1091 { 1093 1092 /* Cancel the various "global parameters" */ 1094 inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE; 1093 inkey_base = inkey_xtra = inkey_flag = FALSE; 1094 inkey_scan = 0; 1095 1095 ke.type = EVT_KBRD; 1096 1096 1097 1097 /* Accept result */ 1098 1098 return (ke); 1099 1099 } 1100 1100 1101 1101 #endif /* ALLOW_BORG */ 1102 1103 1102 1104 1103 /* Hack -- handle delayed "flush()" */ 1105 1104 if (inkey_xtra) … … 1107 1106 /* End "macro action" */ 1108 1107 parse_macro = FALSE; 1109 1108 1110 1109 /* End "macro trigger" */ 1111 1110 parse_under = FALSE; 1112 1111 1113 1112 /* Forget old keypresses */ 1114 1113 Term_flush(); 1115 1114 } 1116 1117 1115 1116 1118 1117 /* Get the cursor state */ 1119 1118 (void)Term_get_cursor(&cursor_state); 1120 1119 1121 1120 /* Show the cursor if waiting, except sometimes in "command" mode */ 1122 1121 if (!inkey_scan && (!inkey_flag || hilite_player || character_icky)) … … 1125 1124 (void)Term_set_cursor(TRUE); 1126 1125 } 1127 1128 1126 1127 1129 1128 /* Hack -- Activate main screen */ 1130 1129 Term_activate(term_screen); 1131 1132 1130 1131 1133 1132 /* Get a key */ 1134 1133 while (ke.type == EVT_NONE) … … 1141 1140 break; 1142 1141 } 1143 1142 1144 1143 1145 1144 /* Hack -- Flush output once when no key ready */ … … 1158 1157 /* Mega-Hack -- reset saved flag */ 1159 1158 character_saved = FALSE; 1160 1159 1161 1160 /* Mega-Hack -- reset signal counter */ 1162 1161 signal_count = 0; 1163 1162 1164 1163 /* Only once */ 1165 1164 done = TRUE; 1166 1165 } 1167 1168 1166 1167 1169 1168 /* Hack -- Handle "inkey_base" */ 1170 1169 if (inkey_base) … … 1252 1251 continue; 1253 1252 } 1254 1255 1253 1254 1256 1255 /* Treat back-quote as escape */ 1257 1256 if (ke.key == '`') ke.key = ESCAPE; 1258 1259 1257 1258 1260 1259 /* End "macro trigger" */ 1261 1260 if (parse_under && (ke.key >=0 && ke.key <= 32)) … … 1264 1263 ke.type = EVT_NONE; 1265 1264 ke.key = 0; 1266 1265 1267 1266 /* End "macro trigger" */ 1268 1267 parse_under = FALSE; … … 1296 1295 } 1297 1296 } 1298 1299 1297 1298 1300 1299 /* Hack -- restore the term */ 1301 1300 Term_activate(old); 1302 1303 1301 1302 1304 1303 /* Restore the cursor */ 1305 1304 Term_set_cursor(cursor_state); 1306 1307 1305 1306 1308 1307 /* Cancel the various "global parameters" */ 1309 1308 inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE; 1310 1311 1309 1310 1312 1311 /* Return the keypress */ 1313 1312 return (ke);
