* fhandler_console.cc (beep): Move up to avoid forward declaration.
(fhandler_console::read): Just beep on characters invalid in current charset. Add comment.
This commit is contained in:
		@@ -1,3 +1,9 @@
 | 
			
		||||
2009-09-30  Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
	* fhandler_console.cc (beep): Move up to avoid forward declaration.
 | 
			
		||||
	(fhandler_console::read): Just beep on characters invalid in current
 | 
			
		||||
	charset.  Add comment.
 | 
			
		||||
 | 
			
		||||
2009-09-29  Eric Blake  <ebb9@byu.net>
 | 
			
		||||
 | 
			
		||||
	* syscalls.cc (rename): Fix regression in rename("dir","d/").
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,23 @@ static console_state NO_COPY *shared_console_info;
 | 
			
		||||
 | 
			
		||||
dev_console NO_COPY *fhandler_console::dev_state;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
beep ()
 | 
			
		||||
{
 | 
			
		||||
  reg_key r (HKEY_CURRENT_USER, KEY_ALL_ACCESS, "AppEvents", "Schemes", "Apps",
 | 
			
		||||
	     ".Default", ".Default", ".Current", NULL);
 | 
			
		||||
  if (r.created ())
 | 
			
		||||
    {
 | 
			
		||||
      char *buf = NULL;
 | 
			
		||||
      UINT len = GetWindowsDirectory (buf, 0);
 | 
			
		||||
      buf = (char *) alloca (len += sizeof ("\\media\\ding.wav"));
 | 
			
		||||
      UINT res = GetWindowsDirectory (buf, len);
 | 
			
		||||
      if (res && res <= len)
 | 
			
		||||
	r.set_string ("", strcat (buf, "\\media\\ding.wav"));
 | 
			
		||||
    }
 | 
			
		||||
  MessageBeep (MB_OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Allocate and initialize the shared record for the current console.
 | 
			
		||||
   Returns a pointer to shared_console_info. */
 | 
			
		||||
tty_min *
 | 
			
		||||
@@ -350,7 +367,18 @@ fhandler_console::read (void *pv, size_t& buflen)
 | 
			
		||||
		     && ((control_key_state & CTRL_PRESSED) == 0
 | 
			
		||||
			 || (wch <= 0x1f || wch == 0x7f));
 | 
			
		||||
	      if (!meta)
 | 
			
		||||
		toadd = tmp + 1;
 | 
			
		||||
		{
 | 
			
		||||
		  /* Determine if the character is in the current multibyte
 | 
			
		||||
		     charset.  The test is easy.  If the multibyte sequence
 | 
			
		||||
		     is > 1 and the first byte is ASCII CAN, the character
 | 
			
		||||
		     has been translated into the ASCII CAN + UTF-8 replacement
 | 
			
		||||
		     sequence.  If so, just ignore the keypress.
 | 
			
		||||
		     FIXME: Is there a better solution? */
 | 
			
		||||
		  if (nread > 1 && tmp[1] == 0x18)
 | 
			
		||||
		    beep ();
 | 
			
		||||
		  else
 | 
			
		||||
		    toadd = tmp + 1;
 | 
			
		||||
		}
 | 
			
		||||
	      else if (dev_state->metabit)
 | 
			
		||||
		{
 | 
			
		||||
		  tmp[1] |= 0x80;
 | 
			
		||||
@@ -1415,23 +1443,6 @@ bad_escape:
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
beep ()
 | 
			
		||||
{
 | 
			
		||||
  reg_key r (HKEY_CURRENT_USER, KEY_ALL_ACCESS, "AppEvents", "Schemes", "Apps",
 | 
			
		||||
	     ".Default", ".Default", ".Current", NULL);
 | 
			
		||||
  if (r.created ())
 | 
			
		||||
    {
 | 
			
		||||
      char *buf = NULL;
 | 
			
		||||
      UINT len = GetWindowsDirectory (buf, 0);
 | 
			
		||||
      buf = (char *) alloca (len += sizeof ("\\media\\ding.wav"));
 | 
			
		||||
      UINT res = GetWindowsDirectory (buf, len);
 | 
			
		||||
      if (res && res <= len)
 | 
			
		||||
	r.set_string ("", strcat (buf, "\\media\\ding.wav"));
 | 
			
		||||
    }
 | 
			
		||||
  MessageBeep (MB_OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This gets called when we found an invalid input character.  We just
 | 
			
		||||
   print a half filled square (UTF 0x2592).  We have no chance to figure
 | 
			
		||||
   out the "meaning" of the input char anyway. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user