Previous 15994 Revisions Next

r2678 Tuesday 20th May, 2008 at 11:00:27 UTC by Nathan Woods
Fixed default key naming of keyboard inputs for non-ASCII characters.
[docs]messnew.txt
[src/mess]inputx.c utils.c

src/mess/utils.c
r2677r2678
3636   buflen = strlen(buf);
3737   if (buflen)
3838   {
39      for (s = &buf[buflen-1]; s >= buf && isspace(*s); s--)
39      for (s = &buf[buflen-1]; s >= buf && (*s >= '\0') && isspace(*s); s--)
4040         *s = '\0';
4141   }
4242}
src/mess/inputx.c
r2677r2678
430430
431431
432432
433static unicode_char get_keyboard_code(const input_port_entry *ipt, int i)
434{
435   unicode_char ch = ipt->keyboard.chars[i];
436
437   /* special hack to allow for PORT_CODE('\xA3') */
438   if ((ch >= 0xFFFFFF80) && (ch <= 0xFFFFFFFF))
439      ch &= 0xFF;
440   return ch;
441}
442
443
444
433445static int scan_keys(const input_port_entry *input_ports, mess_input_code *codes, UINT32 *ports, const input_port_entry **shift_ports, int keys, int shift)
434446{
435447   int code_count = 0;
r2677r2678
448460         case IPT_KEYBOARD:
449461            ipt_key = ipt;
450462
451            code = ipt->keyboard.chars[shift];
452            if (code)
463            code = get_keyboard_code(ipt, shift);
464            if (code != 0)
453465            {
454466               /* is this a shifter key? */
455467               if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END))
r2677r2678
986998
987999         for (i = 0; i < ARRAY_LENGTH(ipt->keyboard.chars) && ipt->keyboard.chars[i]; i++)
9881000         {
989            ch = ipt->keyboard.chars[i];
1001            ch = get_keyboard_code(ipt, i);
9901002            pos += snprintf(&buf[pos], ARRAY_LENGTH(buf) - pos, "%-*s ", MAX(SPACE_COUNT - 1, 0), inputx_key_name(ch));
9911003         }
9921004
r2677r2678
10071019
10081020const char *inputx_key_name(unicode_char ch)
10091021{
1010   static char buf[2];
1022   static char buf[UTF8_CHAR_MAX + 1];
10111023   const char_info *ci;
10121024   const char *result;
1025   int pos;
10131026
10141027   ci = find_charinfo(ch);
10151028   result = ci ? ci->name : NULL;
r2677r2678
10201033   }
10211034   else
10221035   {
1023      if ((ch <= 0x7F) && isprint(ch))
1036      if ((ch > 0x7F) || isprint(ch))
10241037      {
1025         buf[0] = (char) ch;
1026         buf[1] = '\0';
1038         pos = utf8_from_uchar(buf, ARRAY_LENGTH(buf), ch);
1039         buf[pos] = '\0';
10271040         result = buf;
10281041      }
10291042      else
docs/messnew.txt
r2677r2678
6161-----------------------
6262- File Manager and Tape Control cleanups.  [Nate Woods]
6363
64- Fixed default key naming of keyboard inputs for non-ASCII characters.  [Nate
65  Woods]
6466
6567
68
6669Imgtool Changes:
6770----------------
6871- Now supporting encoding of tokenized BASIC files.  (bug #1609) [Nate Woods]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team