OSDN Git Service
This is the result of merging in what the current Angband, 4.2, has for main-cocoa.m and hacking the result to work with Hengband. Since the key handling in Hengband is not like what Angband and poschengband have, adopted a strategy similar to what's used in main-win.c and main-mac.c: keys that fall in the ASCII range (0 - 127) get sent as is, certain special keys are mapped to the equivalent in the original keyet (arrow keys going to '2', '4', '6', '8'; help function key to '?'; delete function key to '\b'; return and keypad enter to '\r'; escape, tab, and delete to '\033', '\t', and '\b', respectively), others are converted to a macro trigger which includes the modifiers and two characters encoding the key, still others just get mapped to a null character before sending since it wasn't clear to me that it was possible to encode the 16-bit value that the application gets for the key into something that would fit in a macro trigger. Another significant change from the poschengband/Angband version is that their use of overdraws had a bad artifacts when used without modification. I ended up dropping the overdraws and instead use a slightly larger clear rectangle in Term_text_cocoa() and use the same logic for the clear rectangle in Term_wipe_cocoa() as in Term_text_cocoa().