aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1995-04-12 02:29:47 +0000
committerKarl Heuer1995-04-12 02:29:47 +0000
commit0534d577c72012d935788856cfa25ce80c6a5998 (patch)
tree4f47d6a51dec1117460d3365d64e9a7fd4c967cf /src
parent22759c72461395f2578cc6951f3046284c050566 (diff)
downloademacs-0534d577c72012d935788856cfa25ce80c6a5998.tar.gz
emacs-0534d577c72012d935788856cfa25ce80c6a5998.zip
(Fset_message_beep): Defined.
(ring_bell): Support audio cards.
Diffstat (limited to 'src')
-rw-r--r--src/w32console.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/src/w32console.c b/src/w32console.c
index 53e8e2cbcda..95d54a8c204 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -36,7 +36,7 @@
36 36
37#include "ntinevt.h" 37#include "ntinevt.h"
38 38
39/* frrom window.c */ 39/* from window.c */
40extern Lisp_Object Frecenter (); 40extern Lisp_Object Frecenter ();
41 41
42/* from keyboard.c */ 42/* from keyboard.c */
@@ -101,7 +101,7 @@ move_cursor (int row, int col)
101 cursor_coords.X = col; 101 cursor_coords.X = col;
102 cursor_coords.Y = row; 102 cursor_coords.Y = row;
103 103
104 if (updating_frame == NULL) 104 if (updating_frame == (FRAME_PTR) NULL)
105 { 105 {
106 SetConsoleCursorPosition (cur_screen, cursor_coords); 106 SetConsoleCursorPosition (cur_screen, cursor_coords);
107 } 107 }
@@ -388,14 +388,14 @@ write_glyphs (register GLYPH *string, register int len)
388 /* Write the attributes. */ 388 /* Write the attributes. */
389 if (!WriteConsoleOutputAttribute (cur_screen, attrs, len, cursor_coords, &i)) 389 if (!WriteConsoleOutputAttribute (cur_screen, attrs, len, cursor_coords, &i))
390 { 390 {
391 printf ("Failed writing console attributes.\n"); 391 printf ("Failed writing console attributes: %d\n", GetLastError ());
392 fflush (stdout); 392 fflush (stdout);
393 } 393 }
394 394
395 /* Write the characters. */ 395 /* Write the characters. */
396 if (!WriteConsoleOutputCharacter (cur_screen, chars, len, cursor_coords, &i)) 396 if (!WriteConsoleOutputCharacter (cur_screen, chars, len, cursor_coords, &i))
397 { 397 {
398 printf ("Failed writing console characters.\n"); 398 printf ("Failed writing console characters: %d\n", GetLastError ());
399 fflush (stdout); 399 fflush (stdout);
400 } 400 }
401 401
@@ -413,19 +413,43 @@ delete_glyphs (int n)
413 scroll_line (n, LEFT); 413 scroll_line (n, LEFT);
414} 414}
415 415
416static unsigned int sound_type = 0xFFFFFFFF;
417
416void 418void
417ring_bell (void) 419ring_bell (void)
418{ 420{
419 Beep (666, 100); 421 if (sound_type == 0xFFFFFFFF)
422 Beep (666, 100);
423 else
424 MessageBeep (sound_type);
420} 425}
421 426
422/* Reset to the original console mode but don't get rid of our console 427DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0,
423 For suspending emacs. */ 428 "Set the sound generated when the bell is rung.\n\
424void 429SOUND is 'asterisk, 'exclamation, 'hand, 'question, or 'ok\n\
425restore_console (void) 430to use the corresponding system sound for the bell.\n\
431SOUND is nil to use the normal beep.")
432 (sound)
433 Lisp_Object sound;
426{ 434{
427 unset_kbd (); 435 CHECK_SYMBOL (sound, 0);
428 SetConsoleActiveScreenBuffer (prev_screen); 436
437 if (NILP (sound))
438 sound_type = 0xFFFFFFFF;
439 else if (EQ (sound, intern ("asterisk")))
440 sound_type = MB_ICONASTERISK;
441 else if (EQ (sound, intern ("exclamation")))
442 sound_type = MB_ICONEXCLAMATION;
443 else if (EQ (sound, intern ("hand")))
444 sound_type = MB_ICONHAND;
445 else if (EQ (sound, intern ("question")))
446 sound_type = MB_ICONQUESTION;
447 else if (EQ (sound, intern ("ok")))
448 sound_type = MB_OK;
449 else
450 sound_type = 0xFFFFFFFF;
451
452 return sound;
429} 453}
430 454
431/* Put our console back up, for ending a suspended session. */ 455/* Put our console back up, for ending a suspended session. */
@@ -441,8 +465,6 @@ reset_terminal_modes (void)
441{ 465{
442 unset_kbd (); 466 unset_kbd ();
443 SetConsoleActiveScreenBuffer (prev_screen); 467 SetConsoleActiveScreenBuffer (prev_screen);
444 CloseHandle (cur_screen);
445 cur_screen = NULL;
446} 468}
447 469
448void 470void
@@ -597,9 +619,10 @@ glyph_to_pixel_coords (FRAME_PTR f, int x, int y, int *pix_x, int *pix_y)
597 *pix_y = y; 619 *pix_y = y;
598} 620}
599 621
600_VOID_ 622void
601syms_of_ntterm () 623syms_of_ntterm ()
602{ 624{
603 defsubr (&Sset_screen_color); 625 defsubr (&Sset_screen_color);
604 defsubr (&Sset_cursor_size); 626 defsubr (&Sset_cursor_size);
627 defsubr (&Sset_message_beep);
605} 628}