Mercurial > emacs
comparison src/w32console.c @ 11389:4a8836398f3e
(Fset_message_beep): Defined.
(ring_bell): Support audio cards.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 12 Apr 1995 02:29:47 +0000 |
parents | 2e5a14f7c44e |
children | 04cc0b15ef74 |
comparison
equal
deleted
inserted
replaced
11388:96fa39ad9403 | 11389:4a8836398f3e |
---|---|
34 #include "disptab.h" | 34 #include "disptab.h" |
35 #include "termhooks.h" | 35 #include "termhooks.h" |
36 | 36 |
37 #include "ntinevt.h" | 37 #include "ntinevt.h" |
38 | 38 |
39 /* frrom window.c */ | 39 /* from window.c */ |
40 extern Lisp_Object Frecenter (); | 40 extern Lisp_Object Frecenter (); |
41 | 41 |
42 /* from keyboard.c */ | 42 /* from keyboard.c */ |
43 extern int detect_input_pending (); | 43 extern int detect_input_pending (); |
44 | 44 |
99 move_cursor (int row, int col) | 99 move_cursor (int row, int col) |
100 { | 100 { |
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 } |
108 } | 108 } |
109 | 109 |
386 memset (attrs, char_attr, len*sizeof (*attrs)); | 386 memset (attrs, char_attr, len*sizeof (*attrs)); |
387 | 387 |
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 |
402 cursor_coords.X += len; | 402 cursor_coords.X += len; |
403 move_cursor (cursor_coords.Y, cursor_coords.X); | 403 move_cursor (cursor_coords.Y, cursor_coords.X); |
411 come out empty... */ | 411 come out empty... */ |
412 | 412 |
413 scroll_line (n, LEFT); | 413 scroll_line (n, LEFT); |
414 } | 414 } |
415 | 415 |
416 static unsigned int sound_type = 0xFFFFFFFF; | |
417 | |
416 void | 418 void |
417 ring_bell (void) | 419 ring_bell (void) |
418 { | 420 { |
419 Beep (666, 100); | 421 if (sound_type == 0xFFFFFFFF) |
420 } | 422 Beep (666, 100); |
421 | 423 else |
422 /* Reset to the original console mode but don't get rid of our console | 424 MessageBeep (sound_type); |
423 For suspending emacs. */ | 425 } |
424 void | 426 |
425 restore_console (void) | 427 DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, |
428 "Set the sound generated when the bell is rung.\n\ | |
429 SOUND is 'asterisk, 'exclamation, 'hand, 'question, or 'ok\n\ | |
430 to use the corresponding system sound for the bell.\n\ | |
431 SOUND is nil to use the normal beep.") | |
432 (sound) | |
433 Lisp_Object sound; | |
434 { | |
435 CHECK_SYMBOL (sound, 0); | |
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; | |
453 } | |
454 | |
455 /* Put our console back up, for ending a suspended session. */ | |
456 void | |
457 take_console (void) | |
458 { | |
459 reset_kbd (); | |
460 SetConsoleActiveScreenBuffer (cur_screen); | |
461 } | |
462 | |
463 void | |
464 reset_terminal_modes (void) | |
426 { | 465 { |
427 unset_kbd (); | 466 unset_kbd (); |
428 SetConsoleActiveScreenBuffer (prev_screen); | 467 SetConsoleActiveScreenBuffer (prev_screen); |
429 } | |
430 | |
431 /* Put our console back up, for ending a suspended session. */ | |
432 void | |
433 take_console (void) | |
434 { | |
435 reset_kbd (); | |
436 SetConsoleActiveScreenBuffer (cur_screen); | |
437 } | |
438 | |
439 void | |
440 reset_terminal_modes (void) | |
441 { | |
442 unset_kbd (); | |
443 SetConsoleActiveScreenBuffer (prev_screen); | |
444 CloseHandle (cur_screen); | |
445 cur_screen = NULL; | |
446 } | 468 } |
447 | 469 |
448 void | 470 void |
449 set_terminal_modes (void) | 471 set_terminal_modes (void) |
450 { | 472 { |
595 { | 617 { |
596 *pix_x = x; | 618 *pix_x = x; |
597 *pix_y = y; | 619 *pix_y = y; |
598 } | 620 } |
599 | 621 |
600 _VOID_ | 622 void |
601 syms_of_ntterm () | 623 syms_of_ntterm () |
602 { | 624 { |
603 defsubr (&Sset_screen_color); | 625 defsubr (&Sset_screen_color); |
604 defsubr (&Sset_cursor_size); | 626 defsubr (&Sset_cursor_size); |
605 } | 627 defsubr (&Sset_message_beep); |
628 } |