diff options
| author | Karoly Lorentey | 2006-05-20 10:32:11 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-05-20 10:32:11 +0000 |
| commit | aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe (patch) | |
| tree | 7db1ed5481ec4ec6b43271d0ea57c032c22f60fc /src | |
| parent | 9f97e26d01003a17b861505d535c89ad73799b7e (diff) | |
| parent | 689840b9224725a0beae741aaaa325d7edb2244c (diff) | |
| download | emacs-aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe.tar.gz emacs-aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-285
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-286
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-287
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-288
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-102
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-558
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 54 | ||||
| -rw-r--r-- | src/Makefile.in | 3 | ||||
| -rw-r--r-- | src/buffer.c | 10 | ||||
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 15 | ||||
| -rw-r--r-- | src/coding.h | 10 | ||||
| -rw-r--r-- | src/config.in | 6 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/image.c | 12 | ||||
| -rw-r--r-- | src/macfns.c | 24 | ||||
| -rw-r--r-- | src/macterm.c | 3 | ||||
| -rw-r--r-- | src/sound.c | 401 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 20 | ||||
| -rw-r--r-- | src/xfaces.c | 43 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
16 files changed, 537 insertions, 74 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1a58d0b5905..5acc6313bbb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,54 @@ | |||
| 1 | 2006-05-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * frame.c (x_set_border_width): Remove #ifndef MAC_OS. | ||
| 4 | |||
| 5 | * image.c [MAC_OS] (gif_load): Allocate Lisp string first. | ||
| 6 | |||
| 7 | * macfns.c (Fx_focus_frame): Don't check dpyinfo->x_focus_frame. | ||
| 8 | |||
| 9 | * macterm.c (XTread_socket) [TARGET_API_MAC_CARBON && MAC_OSX]: | ||
| 10 | Forward keyUp events to toolbox_dispatcher. | ||
| 11 | |||
| 12 | * window.c (foreach_window): Check WINDOWP (FRAME_ROOT_WINDOW (f)). | ||
| 13 | |||
| 14 | 2006-05-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 15 | |||
| 16 | * config.in: Regenerated (HAVE_ALSA). | ||
| 17 | |||
| 18 | * sound.c (alsa_sound_perror, alsa_open, alsa_period_size) | ||
| 19 | (alsa_configure, alsa_close, alsa_choose_format, alsa_write) | ||
| 20 | (snd_error_quiet, alsa_init): New functions. | ||
| 21 | (vox_init): Return 0 if unable to open device. | ||
| 22 | (Fplay_sound_internal): Test for alsa first and use vox (oss) as | ||
| 23 | a fallback. | ||
| 24 | (struct sound_device): Add period_size. | ||
| 25 | (wav_play, au_play): Use period_size if set. | ||
| 26 | |||
| 27 | * Makefile.in (CFLAGS_SOUND): New flags for ALSA | ||
| 28 | (ALL_CFLAGS): Add CFLAGS_SOUND | ||
| 29 | |||
| 30 | 2006-05-18 Kenichi Handa <handa@m17n.org> | ||
| 31 | |||
| 32 | * callproc.c (Fcall_process): Reject encoding arguments by | ||
| 33 | ascii-incompatible coding systems (e.g. utf-16). | ||
| 34 | |||
| 35 | * coding.c (Qascii_incompatible): New variable. | ||
| 36 | (syms_of_coding): Setup Qascii_incompatible. | ||
| 37 | (setup_coding_system): Be sure to initialize coding->common_flags. | ||
| 38 | Check `ascii-incompatible' property of the coding system. | ||
| 39 | |||
| 40 | * coding.h (CODING_ASCII_INCOMPATIBLE_MASK): New macro. | ||
| 41 | |||
| 42 | 2006-05-18 Kim F. Storm <storm@cua.dk> | ||
| 43 | |||
| 44 | * xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when | ||
| 45 | backtracking in case last image doesn't fit on line. | ||
| 46 | |||
| 47 | 2006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change) | ||
| 48 | |||
| 49 | * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than | ||
| 50 | height of one frame default line. | ||
| 51 | |||
| 1 | 2006-05-16 Kim F. Storm <storm@cua.dk> | 52 | 2006-05-16 Kim F. Storm <storm@cua.dk> |
| 2 | 53 | ||
| 3 | * xterm.c (handle_one_xevent): Check that f is not NULL before | 54 | * xterm.c (handle_one_xevent): Check that f is not NULL before |
| @@ -17012,8 +17063,7 @@ | |||
| 17012 | (Fapropos_internal): Initialize them and clear them out. | 17063 | (Fapropos_internal): Initialize them and clear them out. |
| 17013 | Don't GCPRO them. | 17064 | Don't GCPRO them. |
| 17014 | 17065 | ||
| 17015 | * buffer.c (syms_of_buffer) <scroll-up-aggressively, scroll-down-aggressively>: | 17066 | * buffer.c (syms_of_buffer) <scroll-up|down-aggressively>: Doc fixes. |
| 17016 | Doc fixes. | ||
| 17017 | 17067 | ||
| 17018 | * lisp.h: New misc type Lisp_Save_Value. | 17068 | * lisp.h: New misc type Lisp_Save_Value. |
| 17019 | (enum Lisp_Misc_Type): Add Lisp_Misc_Save_Value. | 17069 | (enum Lisp_Misc_Type): Add Lisp_Misc_Save_Value. |
diff --git a/src/Makefile.in b/src/Makefile.in index d5ae100dc0f..89096b93b2d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -280,7 +280,7 @@ TOOLKIT_DEFINES = | |||
| 280 | 280 | ||
| 281 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM | 281 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM |
| 282 | since it may have -I options that should override those two. */ | 282 | since it may have -I options that should override those two. */ |
| 283 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS} | 283 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS} |
| 284 | .c.o: | 284 | .c.o: |
| 285 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 285 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 286 | 286 | ||
| @@ -453,6 +453,7 @@ LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX10 LIBX10_MACHINE LIBX10_SYSTEM | |||
| 453 | #endif /* not HAVE_X_WINDOWS */ | 453 | #endif /* not HAVE_X_WINDOWS */ |
| 454 | 454 | ||
| 455 | LIBSOUND= @LIBSOUND@ | 455 | LIBSOUND= @LIBSOUND@ |
| 456 | CFLAGS_SOUND= @CFLAGS_SOUND@ | ||
| 456 | 457 | ||
| 457 | #ifndef ORDINARY_LINK | 458 | #ifndef ORDINARY_LINK |
| 458 | /* Fix linking if compiled with GCC. */ | 459 | /* Fix linking if compiled with GCC. */ |
diff --git a/src/buffer.c b/src/buffer.c index baa977ab853..6317c14d393 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2495,10 +2495,10 @@ swap_out_buffer_local_variables (b) | |||
| 2495 | Return the number found, and store them in a vector in *VEC_PTR. | 2495 | Return the number found, and store them in a vector in *VEC_PTR. |
| 2496 | Store in *LEN_PTR the size allocated for the vector. | 2496 | Store in *LEN_PTR the size allocated for the vector. |
| 2497 | Store in *NEXT_PTR the next position after POS where an overlay starts, | 2497 | Store in *NEXT_PTR the next position after POS where an overlay starts, |
| 2498 | or ZV if there are no more overlays. | 2498 | or ZV if there are no more overlays between POS and ZV. |
| 2499 | Store in *PREV_PTR the previous position before POS where an overlay ends, | 2499 | Store in *PREV_PTR the previous position before POS where an overlay ends, |
| 2500 | or where an overlay starts which ends at or after POS; | 2500 | or where an overlay starts which ends at or after POS; |
| 2501 | or BEGV if there are no such overlays. | 2501 | or BEGV if there are no such overlays from BEGV to POS. |
| 2502 | NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info. | 2502 | NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info. |
| 2503 | 2503 | ||
| 2504 | *VEC_PTR and *LEN_PTR should contain a valid vector and size | 2504 | *VEC_PTR and *LEN_PTR should contain a valid vector and size |
| @@ -3969,7 +3969,8 @@ or between BEG and END. */) | |||
| 3969 | DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, | 3969 | DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, |
| 3970 | 1, 1, 0, | 3970 | 1, 1, 0, |
| 3971 | doc: /* Return the next position after POS where an overlay starts or ends. | 3971 | doc: /* Return the next position after POS where an overlay starts or ends. |
| 3972 | If there are no more overlay boundaries after POS, return (point-max). */) | 3972 | If there are no overlay boundaries from POS to (point-max), |
| 3973 | the value is (point-max). */) | ||
| 3973 | (pos) | 3974 | (pos) |
| 3974 | Lisp_Object pos; | 3975 | Lisp_Object pos; |
| 3975 | { | 3976 | { |
| @@ -4010,7 +4011,8 @@ If there are no more overlay boundaries after POS, return (point-max). */) | |||
| 4010 | DEFUN ("previous-overlay-change", Fprevious_overlay_change, | 4011 | DEFUN ("previous-overlay-change", Fprevious_overlay_change, |
| 4011 | Sprevious_overlay_change, 1, 1, 0, | 4012 | Sprevious_overlay_change, 1, 1, 0, |
| 4012 | doc: /* Return the previous position before POS where an overlay starts or ends. | 4013 | doc: /* Return the previous position before POS where an overlay starts or ends. |
| 4013 | If there are no more overlay boundaries before POS, return (point-min). */) | 4014 | If there are no overlay boundaries from (point-min) to POS, |
| 4015 | the value is (point-min). */) | ||
| 4014 | (pos) | 4016 | (pos) |
| 4015 | Lisp_Object pos; | 4017 | Lisp_Object pos; |
| 4016 | { | 4018 | { |
diff --git a/src/callproc.c b/src/callproc.c index 25c79bf926c..fb187d757d5 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -302,6 +302,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 302 | val = Qnil; | 302 | val = Qnil; |
| 303 | } | 303 | } |
| 304 | setup_coding_system (Fcheck_coding_system (val), &argument_coding); | 304 | setup_coding_system (Fcheck_coding_system (val), &argument_coding); |
| 305 | if (argument_coding.common_flags & CODING_ASCII_INCOMPATIBLE_MASK) | ||
| 306 | setup_coding_system (Qraw_text, &argument_coding); | ||
| 305 | if (argument_coding.eol_type == CODING_EOL_UNDECIDED) | 307 | if (argument_coding.eol_type == CODING_EOL_UNDECIDED) |
| 306 | argument_coding.eol_type = system_eol_type; | 308 | argument_coding.eol_type = system_eol_type; |
| 307 | } | 309 | } |
diff --git a/src/coding.c b/src/coding.c index a83aadfd468..659b52b93fb 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -365,6 +365,7 @@ Lisp_Object Qno_conversion, Qundecided; | |||
| 365 | Lisp_Object Qcoding_system_history; | 365 | Lisp_Object Qcoding_system_history; |
| 366 | Lisp_Object Qsafe_chars; | 366 | Lisp_Object Qsafe_chars; |
| 367 | Lisp_Object Qvalid_codes; | 367 | Lisp_Object Qvalid_codes; |
| 368 | Lisp_Object Qascii_incompatible; | ||
| 368 | 369 | ||
| 369 | extern Lisp_Object Qinsert_file_contents, Qwrite_region; | 370 | extern Lisp_Object Qinsert_file_contents, Qwrite_region; |
| 370 | Lisp_Object Qcall_process, Qcall_process_region; | 371 | Lisp_Object Qcall_process, Qcall_process_region; |
| @@ -3621,7 +3622,10 @@ setup_coding_system (coding_system, coding) | |||
| 3621 | = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | 3622 | = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; |
| 3622 | } | 3623 | } |
| 3623 | else | 3624 | else |
| 3624 | coding->eol_type = CODING_EOL_LF; | 3625 | { |
| 3626 | coding->common_flags = 0; | ||
| 3627 | coding->eol_type = CODING_EOL_LF; | ||
| 3628 | } | ||
| 3625 | 3629 | ||
| 3626 | coding_type = XVECTOR (coding_spec)->contents[0]; | 3630 | coding_type = XVECTOR (coding_spec)->contents[0]; |
| 3627 | /* Try short cut. */ | 3631 | /* Try short cut. */ |
| @@ -3681,6 +3685,12 @@ setup_coding_system (coding_system, coding) | |||
| 3681 | if (!NILP (val)) | 3685 | if (!NILP (val)) |
| 3682 | coding->composing = COMPOSITION_NO; | 3686 | coding->composing = COMPOSITION_NO; |
| 3683 | 3687 | ||
| 3688 | /* If the coding system is ascii-incompatible, record it in | ||
| 3689 | common_flags. */ | ||
| 3690 | val = Fplist_get (plist, Qascii_incompatible); | ||
| 3691 | if (! NILP (val)) | ||
| 3692 | coding->common_flags |= CODING_ASCII_INCOMPATIBLE_MASK; | ||
| 3693 | |||
| 3684 | switch (XFASTINT (coding_type)) | 3694 | switch (XFASTINT (coding_type)) |
| 3685 | { | 3695 | { |
| 3686 | case 0: | 3696 | case 0: |
| @@ -7820,6 +7830,9 @@ syms_of_coding () | |||
| 7820 | Qvalid_codes = intern ("valid-codes"); | 7830 | Qvalid_codes = intern ("valid-codes"); |
| 7821 | staticpro (&Qvalid_codes); | 7831 | staticpro (&Qvalid_codes); |
| 7822 | 7832 | ||
| 7833 | Qascii_incompatible = intern ("ascii-incompatible"); | ||
| 7834 | staticpro (&Qascii_incompatible); | ||
| 7835 | |||
| 7823 | Qemacs_mule = intern ("emacs-mule"); | 7836 | Qemacs_mule = intern ("emacs-mule"); |
| 7824 | staticpro (&Qemacs_mule); | 7837 | staticpro (&Qemacs_mule); |
| 7825 | 7838 | ||
diff --git a/src/coding.h b/src/coding.h index cac11d1514c..be68753acb2 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -443,10 +443,12 @@ struct coding_system | |||
| 443 | Lisp_Object translation_table_for_encode; | 443 | Lisp_Object translation_table_for_encode; |
| 444 | }; | 444 | }; |
| 445 | 445 | ||
| 446 | #define CODING_REQUIRE_FLUSHING_MASK 1 | 446 | /* Mask bits for (struct coding_system *)->common_flags. */ |
| 447 | #define CODING_REQUIRE_DECODING_MASK 2 | 447 | #define CODING_REQUIRE_FLUSHING_MASK 0x01 |
| 448 | #define CODING_REQUIRE_ENCODING_MASK 4 | 448 | #define CODING_REQUIRE_DECODING_MASK 0x02 |
| 449 | #define CODING_REQUIRE_DETECTION_MASK 8 | 449 | #define CODING_REQUIRE_ENCODING_MASK 0x04 |
| 450 | #define CODING_REQUIRE_DETECTION_MASK 0x08 | ||
| 451 | #define CODING_ASCII_INCOMPATIBLE_MASK 0x10 | ||
| 450 | 452 | ||
| 451 | /* Return 1 if the coding system CODING requires specific code to be | 453 | /* Return 1 if the coding system CODING requires specific code to be |
| 452 | attached at the tail of converted text. */ | 454 | attached at the tail of converted text. */ |
diff --git a/src/config.in b/src/config.in index ddbbbce97d2..51f4aaa07fa 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -87,6 +87,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 87 | */ | 87 | */ |
| 88 | #undef HAVE_ALLOCA_H | 88 | #undef HAVE_ALLOCA_H |
| 89 | 89 | ||
| 90 | /* Define to 1 if ALSA is available. */ | ||
| 91 | #undef HAVE_ALSA | ||
| 92 | |||
| 90 | /* Define to 1 if you have the `bcmp' function. */ | 93 | /* Define to 1 if you have the `bcmp' function. */ |
| 91 | #undef HAVE_BCMP | 94 | #undef HAVE_BCMP |
| 92 | 95 | ||
| @@ -949,6 +952,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 949 | #ifdef HAVE_SOUNDCARD_H | 952 | #ifdef HAVE_SOUNDCARD_H |
| 950 | #define HAVE_SOUND 1 | 953 | #define HAVE_SOUND 1 |
| 951 | #endif | 954 | #endif |
| 955 | #ifdef HAVE_ALSA | ||
| 956 | #define HAVE_SOUND 1 | ||
| 957 | #endif | ||
| 952 | #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ | 958 | #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ |
| 953 | 959 | ||
| 954 | /* If using GNU, then support inline function declarations. */ | 960 | /* If using GNU, then support inline function declarations. */ |
diff --git a/src/frame.c b/src/frame.c index 094453ed33e..f29bca1796f 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3443,10 +3443,8 @@ x_set_border_width (f, arg, oldval) | |||
| 3443 | if (XINT (arg) == f->border_width) | 3443 | if (XINT (arg) == f->border_width) |
| 3444 | return; | 3444 | return; |
| 3445 | 3445 | ||
| 3446 | #ifndef MAC_OS | ||
| 3447 | if (FRAME_X_WINDOW (f) != 0) | 3446 | if (FRAME_X_WINDOW (f) != 0) |
| 3448 | error ("Cannot change the border width of a frame"); | 3447 | error ("Cannot change the border width of a frame"); |
| 3449 | #endif /* MAC_TODO */ | ||
| 3450 | 3448 | ||
| 3451 | f->border_width = XINT (arg); | 3449 | f->border_width = XINT (arg); |
| 3452 | } | 3450 | } |
diff --git a/src/image.c b/src/image.c index b71f31e3b50..b8a640a9391 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -8069,18 +8069,18 @@ gif_load (f, img) | |||
| 8069 | /* Save GIF image extension data for `image-extension-data'. | 8069 | /* Save GIF image extension data for `image-extension-data'. |
| 8070 | Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */ | 8070 | Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */ |
| 8071 | { | 8071 | { |
| 8072 | unsigned char gce[4]; | 8072 | Lisp_Object gce = make_uninit_string (4); |
| 8073 | int centisec = ((float)duration / time_scale) * 100.0f + 0.5f; | 8073 | int centisec = ((float)duration / time_scale) * 100.0f + 0.5f; |
| 8074 | 8074 | ||
| 8075 | /* Fill the delay time field. */ | 8075 | /* Fill the delay time field. */ |
| 8076 | gce[1] = centisec & 0xff; | 8076 | SSET (gce, 1, centisec & 0xff); |
| 8077 | gce[2] = (centisec >> 8) & 0xff; | 8077 | SSET (gce, 2, (centisec >> 8) & 0xff); |
| 8078 | /* We don't know about other fields. */ | 8078 | /* We don't know about other fields. */ |
| 8079 | gce[0] = gce[3] = 0; | 8079 | SSET (gce, 0, 0); |
| 8080 | SSET (gce, 3, 0); | ||
| 8080 | 8081 | ||
| 8081 | img->data.lisp_val = list4 (Qcount, make_number (nsamples), | 8082 | img->data.lisp_val = list4 (Qcount, make_number (nsamples), |
| 8082 | make_number (0xf9), | 8083 | make_number (0xf9), gce); |
| 8083 | make_unibyte_string (gce, 4)); | ||
| 8084 | } | 8084 | } |
| 8085 | 8085 | ||
| 8086 | /* Maybe fill in the background field while we have ximg handy. */ | 8086 | /* Maybe fill in the background field while we have ximg handy. */ |
diff --git a/src/macfns.c b/src/macfns.c index ab23865507b..577167e6fe3 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -2829,26 +2829,22 @@ FRAME nil means use the selected frame. */) | |||
| 2829 | Lisp_Object frame; | 2829 | Lisp_Object frame; |
| 2830 | { | 2830 | { |
| 2831 | struct frame *f = check_x_frame (frame); | 2831 | struct frame *f = check_x_frame (frame); |
| 2832 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 2833 | 2832 | ||
| 2834 | if (dpyinfo->x_focus_frame != f) | 2833 | BLOCK_INPUT; |
| 2835 | { | ||
| 2836 | BLOCK_INPUT; | ||
| 2837 | #ifdef MAC_OSX | 2834 | #ifdef MAC_OSX |
| 2838 | ActivateWindow (ActiveNonFloatingWindow (), false); | 2835 | ActivateWindow (ActiveNonFloatingWindow (), false); |
| 2839 | ActivateWindow (FRAME_MAC_WINDOW (f), true); | 2836 | ActivateWindow (FRAME_MAC_WINDOW (f), true); |
| 2840 | #else | 2837 | #else |
| 2841 | #if !TARGET_API_MAC_CARBON | 2838 | #if !TARGET_API_MAC_CARBON |
| 2842 | /* SelectWindow (Non-Carbon) does not issue deactivate events if | 2839 | /* SelectWindow (Non-Carbon) does not issue deactivate events if the |
| 2843 | the possibly inactive window that is to be selected is | 2840 | possibly inactive window that is to be selected is already the |
| 2844 | already the frontmost one. */ | 2841 | frontmost one. */ |
| 2845 | SendBehind (FRAME_MAC_WINDOW (f), NULL); | 2842 | SendBehind (FRAME_MAC_WINDOW (f), NULL); |
| 2846 | #endif | 2843 | #endif |
| 2847 | /* This brings the window to the front. */ | 2844 | /* This brings the window to the front. */ |
| 2848 | SelectWindow (FRAME_MAC_WINDOW (f)); | 2845 | SelectWindow (FRAME_MAC_WINDOW (f)); |
| 2849 | #endif | 2846 | #endif |
| 2850 | UNBLOCK_INPUT; | 2847 | UNBLOCK_INPUT; |
| 2851 | } | ||
| 2852 | 2848 | ||
| 2853 | return Qnil; | 2849 | return Qnil; |
| 2854 | } | 2850 | } |
diff --git a/src/macterm.c b/src/macterm.c index beaecfdc790..68959758e98 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -10333,6 +10333,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10333 | break; | 10333 | break; |
| 10334 | 10334 | ||
| 10335 | case keyDown: | 10335 | case keyDown: |
| 10336 | case keyUp: | ||
| 10336 | case autoKey: | 10337 | case autoKey: |
| 10337 | { | 10338 | { |
| 10338 | int keycode = (er.message & keyCodeMask) >> 8; | 10339 | int keycode = (er.message & keyCodeMask) >> 8; |
| @@ -10354,6 +10355,8 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10354 | != eventNotHandledErr) | 10355 | != eventNotHandledErr) |
| 10355 | break; | 10356 | break; |
| 10356 | #endif | 10357 | #endif |
| 10358 | if (er.what == keyUp) | ||
| 10359 | break; | ||
| 10357 | 10360 | ||
| 10358 | #if 0 | 10361 | #if 0 |
| 10359 | if (dpyinfo->x_focus_frame == NULL) | 10362 | if (dpyinfo->x_focus_frame == NULL) |
diff --git a/src/sound.c b/src/sound.c index 0fbeceb4b9e..2ceefd3bce3 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -73,6 +73,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 73 | #ifdef HAVE_SOUNDCARD_H | 73 | #ifdef HAVE_SOUNDCARD_H |
| 74 | #include <soundcard.h> | 74 | #include <soundcard.h> |
| 75 | #endif | 75 | #endif |
| 76 | #ifdef HAVE_ALSA | ||
| 77 | #include <asoundlib.h> | ||
| 78 | #endif | ||
| 79 | |||
| 76 | /* END: Non Windows Includes */ | 80 | /* END: Non Windows Includes */ |
| 77 | 81 | ||
| 78 | #else /* WINDOWSNT */ | 82 | #else /* WINDOWSNT */ |
| @@ -121,6 +125,9 @@ static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); | |||
| 121 | #ifndef DEFAULT_SOUND_DEVICE | 125 | #ifndef DEFAULT_SOUND_DEVICE |
| 122 | #define DEFAULT_SOUND_DEVICE "/dev/dsp" | 126 | #define DEFAULT_SOUND_DEVICE "/dev/dsp" |
| 123 | #endif | 127 | #endif |
| 128 | #ifndef DEFAULT_ALSA_SOUND_DEVICE | ||
| 129 | #define DEFAULT_ALSA_SOUND_DEVICE "default" | ||
| 130 | #endif | ||
| 124 | 131 | ||
| 125 | 132 | ||
| 126 | /* Structure forward declarations. */ | 133 | /* Structure forward declarations. */ |
| @@ -227,6 +234,10 @@ struct sound_device | |||
| 227 | void (* choose_format) P_ ((struct sound_device *sd, | 234 | void (* choose_format) P_ ((struct sound_device *sd, |
| 228 | struct sound *s)); | 235 | struct sound *s)); |
| 229 | 236 | ||
| 237 | /* Return a preferred data size in bytes to be sent to write (below) | ||
| 238 | each time. 2048 is used if this is NULL. */ | ||
| 239 | int (* period_size) P_ ((struct sound_device *sd)); | ||
| 240 | |||
| 230 | /* Write NYBTES bytes from BUFFER to device SD. */ | 241 | /* Write NYBTES bytes from BUFFER to device SD. */ |
| 231 | void (* write) P_ ((struct sound_device *sd, const char *buffer, | 242 | void (* write) P_ ((struct sound_device *sd, const char *buffer, |
| 232 | int nbytes)); | 243 | int nbytes)); |
| @@ -280,7 +291,7 @@ static void vox_open P_ ((struct sound_device *)); | |||
| 280 | static void vox_configure P_ ((struct sound_device *)); | 291 | static void vox_configure P_ ((struct sound_device *)); |
| 281 | static void vox_close P_ ((struct sound_device *sd)); | 292 | static void vox_close P_ ((struct sound_device *sd)); |
| 282 | static void vox_choose_format P_ ((struct sound_device *, struct sound *)); | 293 | static void vox_choose_format P_ ((struct sound_device *, struct sound *)); |
| 283 | static void vox_init P_ ((struct sound_device *)); | 294 | static int vox_init P_ ((struct sound_device *)); |
| 284 | static void vox_write P_ ((struct sound_device *, const char *, int)); | 295 | static void vox_write P_ ((struct sound_device *, const char *, int)); |
| 285 | static void find_sound_type P_ ((struct sound *)); | 296 | static void find_sound_type P_ ((struct sound *)); |
| 286 | static u_int32_t le2hl P_ ((u_int32_t)); | 297 | static u_int32_t le2hl P_ ((u_int32_t)); |
| @@ -604,7 +615,7 @@ wav_play (s, sd) | |||
| 604 | { | 615 | { |
| 605 | char *buffer; | 616 | char *buffer; |
| 606 | int nbytes; | 617 | int nbytes; |
| 607 | int blksize = 2048; | 618 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 608 | 619 | ||
| 609 | buffer = (char *) alloca (blksize); | 620 | buffer = (char *) alloca (blksize); |
| 610 | lseek (s->fd, sizeof *header, SEEK_SET); | 621 | lseek (s->fd, sizeof *header, SEEK_SET); |
| @@ -633,7 +644,8 @@ enum au_encoding | |||
| 633 | AU_ENCODING_32, | 644 | AU_ENCODING_32, |
| 634 | AU_ENCODING_IEEE32, | 645 | AU_ENCODING_IEEE32, |
| 635 | AU_ENCODING_IEEE64, | 646 | AU_ENCODING_IEEE64, |
| 636 | AU_COMPRESSED = 23 | 647 | AU_COMPRESSED = 23, |
| 648 | AU_ENCODING_ALAW_8 = 27 | ||
| 637 | }; | 649 | }; |
| 638 | 650 | ||
| 639 | 651 | ||
| @@ -689,7 +701,7 @@ au_play (s, sd) | |||
| 689 | SBYTES (s->data) - header->data_offset); | 701 | SBYTES (s->data) - header->data_offset); |
| 690 | else | 702 | else |
| 691 | { | 703 | { |
| 692 | int blksize = 2048; | 704 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 693 | char *buffer; | 705 | char *buffer; |
| 694 | int nbytes; | 706 | int nbytes; |
| 695 | 707 | ||
| @@ -868,16 +880,33 @@ vox_choose_format (sd, s) | |||
| 868 | /* Initialize device SD. Set up the interface functions in the device | 880 | /* Initialize device SD. Set up the interface functions in the device |
| 869 | structure. */ | 881 | structure. */ |
| 870 | 882 | ||
| 871 | static void | 883 | static int |
| 872 | vox_init (sd) | 884 | vox_init (sd) |
| 873 | struct sound_device *sd; | 885 | struct sound_device *sd; |
| 874 | { | 886 | { |
| 887 | char *file; | ||
| 888 | int fd; | ||
| 889 | |||
| 890 | /* Open the sound device. Default is /dev/dsp. */ | ||
| 891 | if (sd->file) | ||
| 892 | file = sd->file; | ||
| 893 | else | ||
| 894 | file = DEFAULT_SOUND_DEVICE; | ||
| 895 | fd = emacs_open (file, O_WRONLY, 0); | ||
| 896 | if (fd >= 0) | ||
| 897 | emacs_close (fd); | ||
| 898 | else | ||
| 899 | return 0; | ||
| 900 | |||
| 875 | sd->fd = -1; | 901 | sd->fd = -1; |
| 876 | sd->open = vox_open; | 902 | sd->open = vox_open; |
| 877 | sd->close = vox_close; | 903 | sd->close = vox_close; |
| 878 | sd->configure = vox_configure; | 904 | sd->configure = vox_configure; |
| 879 | sd->choose_format = vox_choose_format; | 905 | sd->choose_format = vox_choose_format; |
| 880 | sd->write = vox_write; | 906 | sd->write = vox_write; |
| 907 | sd->period_size = NULL; | ||
| 908 | |||
| 909 | return 1; | ||
| 881 | } | 910 | } |
| 882 | 911 | ||
| 883 | /* Write NBYTES bytes from BUFFER to device SD. */ | 912 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| @@ -893,6 +922,359 @@ vox_write (sd, buffer, nbytes) | |||
| 893 | sound_perror ("Error writing to sound device"); | 922 | sound_perror ("Error writing to sound device"); |
| 894 | } | 923 | } |
| 895 | 924 | ||
| 925 | #ifdef HAVE_ALSA | ||
| 926 | /*********************************************************************** | ||
| 927 | ALSA Driver Interface | ||
| 928 | ***********************************************************************/ | ||
| 929 | |||
| 930 | /* This driver is available on GNU/Linux. */ | ||
| 931 | |||
| 932 | static void | ||
| 933 | alsa_sound_perror (msg, err) | ||
| 934 | char *msg; | ||
| 935 | int err; | ||
| 936 | { | ||
| 937 | error ("%s: %s", msg, snd_strerror (err)); | ||
| 938 | } | ||
| 939 | |||
| 940 | struct alsa_params | ||
| 941 | { | ||
| 942 | snd_pcm_t *handle; | ||
| 943 | snd_pcm_hw_params_t *hwparams; | ||
| 944 | snd_pcm_sw_params_t *swparams; | ||
| 945 | snd_pcm_uframes_t period_size; | ||
| 946 | }; | ||
| 947 | |||
| 948 | /* Open device SD. If SD->file is non-null, open that device, | ||
| 949 | otherwise use a default device name. */ | ||
| 950 | |||
| 951 | static void | ||
| 952 | alsa_open (sd) | ||
| 953 | struct sound_device *sd; | ||
| 954 | { | ||
| 955 | char *file; | ||
| 956 | struct alsa_params *p; | ||
| 957 | int err; | ||
| 958 | |||
| 959 | /* Open the sound device. Default is "default". */ | ||
| 960 | if (sd->file) | ||
| 961 | file = sd->file; | ||
| 962 | else | ||
| 963 | file = DEFAULT_ALSA_SOUND_DEVICE; | ||
| 964 | |||
| 965 | p = xmalloc (sizeof (*p)); | ||
| 966 | p->handle = NULL; | ||
| 967 | p->hwparams = NULL; | ||
| 968 | p->swparams = NULL; | ||
| 969 | |||
| 970 | sd->fd = -1; | ||
| 971 | sd->data = p; | ||
| 972 | |||
| 973 | |||
| 974 | if ((err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0)) < 0) | ||
| 975 | alsa_sound_perror (file, err); | ||
| 976 | } | ||
| 977 | |||
| 978 | static int | ||
| 979 | alsa_period_size (sd) | ||
| 980 | struct sound_device *sd; | ||
| 981 | { | ||
| 982 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 983 | return p->period_size; | ||
| 984 | } | ||
| 985 | |||
| 986 | static void | ||
| 987 | alsa_configure (sd) | ||
| 988 | struct sound_device *sd; | ||
| 989 | { | ||
| 990 | int val, err, dir; | ||
| 991 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 992 | snd_pcm_uframes_t buffer_size; | ||
| 993 | |||
| 994 | xassert (p->handle != 0); | ||
| 995 | |||
| 996 | if ((err = snd_pcm_hw_params_malloc (&p->hwparams)) < 0) | ||
| 997 | alsa_sound_perror ("Could not allocate hardware parameter structure", err); | ||
| 998 | |||
| 999 | if ((err = snd_pcm_sw_params_malloc (&p->swparams)) < 0) | ||
| 1000 | alsa_sound_perror ("Could not allocate software parameter structure", err); | ||
| 1001 | |||
| 1002 | if ((err = snd_pcm_hw_params_any (p->handle, p->hwparams)) < 0) | ||
| 1003 | alsa_sound_perror ("Could not initialize hardware parameter structure", err); | ||
| 1004 | |||
| 1005 | if ((err = snd_pcm_hw_params_set_access (p->handle, p->hwparams, | ||
| 1006 | SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) | ||
| 1007 | alsa_sound_perror ("Could not set access type", err); | ||
| 1008 | |||
| 1009 | val = sd->format; | ||
| 1010 | if ((err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val)) < 0) | ||
| 1011 | alsa_sound_perror ("Could not set sound format", err); | ||
| 1012 | |||
| 1013 | val = sd->sample_rate; | ||
| 1014 | if ((err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0)) | ||
| 1015 | < 0) | ||
| 1016 | alsa_sound_perror ("Could not set sample rate", err); | ||
| 1017 | |||
| 1018 | val = sd->channels; | ||
| 1019 | if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0) | ||
| 1020 | alsa_sound_perror ("Could not set channel count", err); | ||
| 1021 | |||
| 1022 | |||
| 1023 | err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir); | ||
| 1024 | if (err < 0) | ||
| 1025 | alsa_sound_perror ("Unable to get period size for playback", err); | ||
| 1026 | |||
| 1027 | err = snd_pcm_hw_params_get_buffer_size (p->hwparams, &buffer_size); | ||
| 1028 | if (err < 0) | ||
| 1029 | alsa_sound_perror("Unable to get buffer size for playback", err); | ||
| 1030 | |||
| 1031 | if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0) | ||
| 1032 | alsa_sound_perror ("Could not set parameters", err); | ||
| 1033 | |||
| 1034 | err = snd_pcm_sw_params_current (p->handle, p->swparams); | ||
| 1035 | if (err < 0) | ||
| 1036 | alsa_sound_perror ("Unable to determine current swparams for playback", | ||
| 1037 | err); | ||
| 1038 | |||
| 1039 | /* Start the transfer when the buffer is almost full */ | ||
| 1040 | err = snd_pcm_sw_params_set_start_threshold (p->handle, p->swparams, | ||
| 1041 | (buffer_size / p->period_size) | ||
| 1042 | * p->period_size); | ||
| 1043 | if (err < 0) | ||
| 1044 | alsa_sound_perror ("Unable to set start threshold mode for playback", err); | ||
| 1045 | |||
| 1046 | /* Allow the transfer when at least period_size samples can be processed */ | ||
| 1047 | err = snd_pcm_sw_params_set_avail_min (p->handle, p->swparams, p->period_size); | ||
| 1048 | if (err < 0) | ||
| 1049 | alsa_sound_perror ("Unable to set avail min for playback", err); | ||
| 1050 | |||
| 1051 | /* Align all transfers to 1 period */ | ||
| 1052 | err = snd_pcm_sw_params_set_xfer_align (p->handle, p->swparams, | ||
| 1053 | p->period_size); | ||
| 1054 | if (err < 0) | ||
| 1055 | alsa_sound_perror ("Unable to set transfer align for playback", err); | ||
| 1056 | |||
| 1057 | err = snd_pcm_sw_params (p->handle, p->swparams); | ||
| 1058 | if (err < 0) | ||
| 1059 | alsa_sound_perror ("Unable to set sw params for playback\n", err); | ||
| 1060 | |||
| 1061 | snd_pcm_hw_params_free (p->hwparams); | ||
| 1062 | p->hwparams = NULL; | ||
| 1063 | snd_pcm_sw_params_free (p->swparams); | ||
| 1064 | p->swparams = NULL; | ||
| 1065 | |||
| 1066 | if ((err = snd_pcm_prepare (p->handle)) < 0) | ||
| 1067 | alsa_sound_perror ("Could not prepare audio interface for use", err); | ||
| 1068 | |||
| 1069 | if (sd->volume > 0) | ||
| 1070 | { | ||
| 1071 | int chn; | ||
| 1072 | snd_mixer_t *handle; | ||
| 1073 | snd_mixer_elem_t *e; | ||
| 1074 | char *file = sd->file ? sd->file : DEFAULT_ALSA_SOUND_DEVICE; | ||
| 1075 | |||
| 1076 | if (snd_mixer_open (&handle, 0) >= 0) | ||
| 1077 | { | ||
| 1078 | if (snd_mixer_attach (handle, file) >= 0 | ||
| 1079 | && snd_mixer_load (handle) >= 0 | ||
| 1080 | && snd_mixer_selem_register (handle, NULL, NULL) >= 0) | ||
| 1081 | for (e = snd_mixer_first_elem (handle); | ||
| 1082 | e; | ||
| 1083 | e = snd_mixer_elem_next (e)) | ||
| 1084 | { | ||
| 1085 | if (snd_mixer_selem_has_playback_volume (e)) | ||
| 1086 | { | ||
| 1087 | long pmin, pmax; | ||
| 1088 | snd_mixer_selem_get_playback_volume_range (e, &pmin, &pmax); | ||
| 1089 | long vol = pmin + (sd->volume * (pmax - pmin)) / 100; | ||
| 1090 | |||
| 1091 | for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) | ||
| 1092 | snd_mixer_selem_set_playback_volume (e, chn, vol); | ||
| 1093 | } | ||
| 1094 | } | ||
| 1095 | snd_mixer_close(handle); | ||
| 1096 | } | ||
| 1097 | } | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | |||
| 1101 | /* Close device SD if it is open. */ | ||
| 1102 | |||
| 1103 | static void | ||
| 1104 | alsa_close (sd) | ||
| 1105 | struct sound_device *sd; | ||
| 1106 | { | ||
| 1107 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1108 | if (p) | ||
| 1109 | { | ||
| 1110 | if (p->hwparams) | ||
| 1111 | snd_pcm_hw_params_free (p->hwparams); | ||
| 1112 | if (p->swparams) | ||
| 1113 | snd_pcm_sw_params_free (p->swparams); | ||
| 1114 | if (p->handle) | ||
| 1115 | { | ||
| 1116 | snd_pcm_drain(p->handle); | ||
| 1117 | snd_pcm_close (p->handle); | ||
| 1118 | } | ||
| 1119 | free (p); | ||
| 1120 | } | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | /* Choose device-dependent format for device SD from sound file S. */ | ||
| 1124 | |||
| 1125 | static void | ||
| 1126 | alsa_choose_format (sd, s) | ||
| 1127 | struct sound_device *sd; | ||
| 1128 | struct sound *s; | ||
| 1129 | { | ||
| 1130 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1131 | if (s->type == RIFF) | ||
| 1132 | { | ||
| 1133 | struct wav_header *h = (struct wav_header *) s->header; | ||
| 1134 | if (h->precision == 8) | ||
| 1135 | sd->format = SND_PCM_FORMAT_U8; | ||
| 1136 | else if (h->precision == 16) | ||
| 1137 | sd->format = SND_PCM_FORMAT_S16_LE; | ||
| 1138 | else | ||
| 1139 | error ("Unsupported WAV file format"); | ||
| 1140 | } | ||
| 1141 | else if (s->type == SUN_AUDIO) | ||
| 1142 | { | ||
| 1143 | struct au_header *header = (struct au_header *) s->header; | ||
| 1144 | switch (header->encoding) | ||
| 1145 | { | ||
| 1146 | case AU_ENCODING_ULAW_8: | ||
| 1147 | sd->format = SND_PCM_FORMAT_MU_LAW; | ||
| 1148 | break; | ||
| 1149 | case AU_ENCODING_ALAW_8: | ||
| 1150 | sd->format = SND_PCM_FORMAT_A_LAW; | ||
| 1151 | break; | ||
| 1152 | case AU_ENCODING_IEEE32: | ||
| 1153 | sd->format = SND_PCM_FORMAT_FLOAT_BE; | ||
| 1154 | break; | ||
| 1155 | case AU_ENCODING_IEEE64: | ||
| 1156 | sd->format = SND_PCM_FORMAT_FLOAT64_BE; | ||
| 1157 | break; | ||
| 1158 | case AU_ENCODING_8: | ||
| 1159 | sd->format = SND_PCM_FORMAT_S8; | ||
| 1160 | break; | ||
| 1161 | case AU_ENCODING_16: | ||
| 1162 | sd->format = SND_PCM_FORMAT_S16_BE; | ||
| 1163 | break; | ||
| 1164 | case AU_ENCODING_24: | ||
| 1165 | sd->format = SND_PCM_FORMAT_S24_BE; | ||
| 1166 | break; | ||
| 1167 | case AU_ENCODING_32: | ||
| 1168 | sd->format = SND_PCM_FORMAT_S32_BE; | ||
| 1169 | break; | ||
| 1170 | |||
| 1171 | default: | ||
| 1172 | error ("Unsupported AU file format"); | ||
| 1173 | } | ||
| 1174 | } | ||
| 1175 | else | ||
| 1176 | abort (); | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | |||
| 1180 | /* Write NBYTES bytes from BUFFER to device SD. */ | ||
| 1181 | |||
| 1182 | static void | ||
| 1183 | alsa_write (sd, buffer, nbytes) | ||
| 1184 | struct sound_device *sd; | ||
| 1185 | const char *buffer; | ||
| 1186 | int nbytes; | ||
| 1187 | { | ||
| 1188 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1189 | |||
| 1190 | /* The the third parameter to snd_pcm_writei is frames, not bytes. */ | ||
| 1191 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; | ||
| 1192 | int nwritten = 0; | ||
| 1193 | int err; | ||
| 1194 | |||
| 1195 | while (nwritten < nbytes) | ||
| 1196 | { | ||
| 1197 | if ((err = snd_pcm_writei (p->handle, | ||
| 1198 | buffer + nwritten, | ||
| 1199 | (nbytes - nwritten)/fact)) < 0) | ||
| 1200 | { | ||
| 1201 | fprintf(stderr, "Err %d/%s\n", err, snd_strerror(err)); | ||
| 1202 | if (err == -EPIPE) | ||
| 1203 | { /* under-run */ | ||
| 1204 | err = snd_pcm_prepare (p->handle); | ||
| 1205 | if (err < 0) | ||
| 1206 | alsa_sound_perror ("Can't recover from underrun, prepare failed", | ||
| 1207 | err); | ||
| 1208 | } | ||
| 1209 | else if (err == -ESTRPIPE) | ||
| 1210 | { | ||
| 1211 | while ((err = snd_pcm_resume (p->handle)) == -EAGAIN) | ||
| 1212 | sleep(1); /* wait until the suspend flag is released */ | ||
| 1213 | if (err < 0) | ||
| 1214 | { | ||
| 1215 | err = snd_pcm_prepare (p->handle); | ||
| 1216 | if (err < 0) | ||
| 1217 | alsa_sound_perror ("Can't recover from suspend, " | ||
| 1218 | "prepare failed", | ||
| 1219 | err); | ||
| 1220 | } | ||
| 1221 | } | ||
| 1222 | else | ||
| 1223 | alsa_sound_perror ("Error writing to sound device", err); | ||
| 1224 | |||
| 1225 | } | ||
| 1226 | else | ||
| 1227 | nwritten += err * fact; | ||
| 1228 | } | ||
| 1229 | } | ||
| 1230 | |||
| 1231 | static void | ||
| 1232 | snd_error_quiet (file, line, function, err, fmt) | ||
| 1233 | const char *file; | ||
| 1234 | int line; | ||
| 1235 | const char *function; | ||
| 1236 | int err; | ||
| 1237 | const char *fmt; | ||
| 1238 | { | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | /* Initialize device SD. Set up the interface functions in the device | ||
| 1242 | structure. */ | ||
| 1243 | |||
| 1244 | static int | ||
| 1245 | alsa_init (sd) | ||
| 1246 | struct sound_device *sd; | ||
| 1247 | { | ||
| 1248 | char *file; | ||
| 1249 | snd_pcm_t *handle; | ||
| 1250 | int err; | ||
| 1251 | |||
| 1252 | /* Open the sound device. Default is "default". */ | ||
| 1253 | if (sd->file) | ||
| 1254 | file = sd->file; | ||
| 1255 | else | ||
| 1256 | file = DEFAULT_ALSA_SOUND_DEVICE; | ||
| 1257 | |||
| 1258 | snd_lib_error_set_handler ((snd_lib_error_handler_t) snd_error_quiet); | ||
| 1259 | err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0); | ||
| 1260 | snd_lib_error_set_handler (NULL); | ||
| 1261 | if (err < 0) | ||
| 1262 | return 0; | ||
| 1263 | |||
| 1264 | sd->fd = -1; | ||
| 1265 | sd->open = alsa_open; | ||
| 1266 | sd->close = alsa_close; | ||
| 1267 | sd->configure = alsa_configure; | ||
| 1268 | sd->choose_format = alsa_choose_format; | ||
| 1269 | sd->write = alsa_write; | ||
| 1270 | sd->period_size = alsa_period_size; | ||
| 1271 | |||
| 1272 | return 1; | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | #endif /* HAVE_ALSA */ | ||
| 1276 | |||
| 1277 | |||
| 896 | /* END: Non Windows functions */ | 1278 | /* END: Non Windows functions */ |
| 897 | #else /* WINDOWSNT */ | 1279 | #else /* WINDOWSNT */ |
| 898 | 1280 | ||
| @@ -1056,10 +1438,11 @@ Internal use only, use `play-sound' instead.\n */) | |||
| 1056 | args[1] = sound; | 1438 | args[1] = sound; |
| 1057 | Frun_hook_with_args (2, args); | 1439 | Frun_hook_with_args (2, args); |
| 1058 | 1440 | ||
| 1059 | /* There is only one type of device we currently support, the VOX | 1441 | #ifdef HAVE_ALSA |
| 1060 | sound driver. Set up the device interface functions for that | 1442 | if (!alsa_init (current_sound_device)) |
| 1061 | device. */ | 1443 | #endif |
| 1062 | vox_init (current_sound_device); | 1444 | if (!vox_init (current_sound_device)) |
| 1445 | error ("No usable sound device driver found"); | ||
| 1063 | 1446 | ||
| 1064 | /* Open the device. */ | 1447 | /* Open the device. */ |
| 1065 | current_sound_device->open (current_sound_device); | 1448 | current_sound_device->open (current_sound_device); |
diff --git a/src/window.c b/src/window.c index 966960edd90..5dced198811 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6798,7 +6798,9 @@ foreach_window (f, fn, user_data) | |||
| 6798 | int (* fn) P_ ((struct window *, void *)); | 6798 | int (* fn) P_ ((struct window *, void *)); |
| 6799 | void *user_data; | 6799 | void *user_data; |
| 6800 | { | 6800 | { |
| 6801 | foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); | 6801 | /* Fdelete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ |
| 6802 | if (WINDOWP (FRAME_ROOT_WINDOW (f))) | ||
| 6803 | foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); | ||
| 6802 | } | 6804 | } |
| 6803 | 6805 | ||
| 6804 | 6806 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a271d64fdbb..32255f92da7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9492,7 +9492,8 @@ display_tool_bar_line (it, height) | |||
| 9492 | 9492 | ||
| 9493 | while (it->current_x < max_x) | 9493 | while (it->current_x < max_x) |
| 9494 | { | 9494 | { |
| 9495 | int x_before, x, n_glyphs_before, i, nglyphs; | 9495 | int x, n_glyphs_before, i, nglyphs; |
| 9496 | struct it it_before; | ||
| 9496 | 9497 | ||
| 9497 | /* Get the next display element. */ | 9498 | /* Get the next display element. */ |
| 9498 | if (!get_next_display_element (it)) | 9499 | if (!get_next_display_element (it)) |
| @@ -9504,22 +9505,23 @@ display_tool_bar_line (it, height) | |||
| 9504 | } | 9505 | } |
| 9505 | 9506 | ||
| 9506 | /* Produce glyphs. */ | 9507 | /* Produce glyphs. */ |
| 9507 | x_before = it->current_x; | 9508 | n_glyphs_before = row->used[TEXT_AREA]; |
| 9508 | n_glyphs_before = it->glyph_row->used[TEXT_AREA]; | 9509 | it_before = *it; |
| 9510 | |||
| 9509 | PRODUCE_GLYPHS (it); | 9511 | PRODUCE_GLYPHS (it); |
| 9510 | 9512 | ||
| 9511 | nglyphs = it->glyph_row->used[TEXT_AREA] - n_glyphs_before; | 9513 | nglyphs = row->used[TEXT_AREA] - n_glyphs_before; |
| 9512 | i = 0; | 9514 | i = 0; |
| 9513 | x = x_before; | 9515 | x = it_before.current_x; |
| 9514 | while (i < nglyphs) | 9516 | while (i < nglyphs) |
| 9515 | { | 9517 | { |
| 9516 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; | 9518 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; |
| 9517 | 9519 | ||
| 9518 | if (x + glyph->pixel_width > max_x) | 9520 | if (x + glyph->pixel_width > max_x) |
| 9519 | { | 9521 | { |
| 9520 | /* Glyph doesn't fit on line. */ | 9522 | /* Glyph doesn't fit on line. Backtrack. */ |
| 9521 | it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i; | 9523 | row->used[TEXT_AREA] = n_glyphs_before; |
| 9522 | it->current_x = x; | 9524 | *it = it_before; |
| 9523 | goto out; | 9525 | goto out; |
| 9524 | } | 9526 | } |
| 9525 | 9527 | ||
| @@ -9550,6 +9552,8 @@ display_tool_bar_line (it, height) | |||
| 9550 | /* Make line the desired height and center it vertically. */ | 9552 | /* Make line the desired height and center it vertically. */ |
| 9551 | if ((height -= it->max_ascent + it->max_descent) > 0) | 9553 | if ((height -= it->max_ascent + it->max_descent) > 0) |
| 9552 | { | 9554 | { |
| 9555 | /* Don't add more than one line height. */ | ||
| 9556 | height %= FRAME_LINE_HEIGHT (it->f); | ||
| 9553 | it->max_ascent += height / 2; | 9557 | it->max_ascent += height / 2; |
| 9554 | it->max_descent += (height + 1) / 2; | 9558 | it->max_descent += (height + 1) / 2; |
| 9555 | } | 9559 | } |
diff --git a/src/xfaces.c b/src/xfaces.c index fc2c8a768bf..15556ca88f8 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6400,6 +6400,12 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth) | |||
| 6400 | { | 6400 | { |
| 6401 | int i; | 6401 | int i; |
| 6402 | 6402 | ||
| 6403 | /* Any font is better than no font. */ | ||
| 6404 | if (! font1) | ||
| 6405 | return 0; | ||
| 6406 | if (! font2) | ||
| 6407 | return 1; | ||
| 6408 | |||
| 6403 | for (i = 0; i < DIM (font_sort_order); ++i) | 6409 | for (i = 0; i < DIM (font_sort_order); ++i) |
| 6404 | { | 6410 | { |
| 6405 | int xlfd_idx = font_sort_order[i]; | 6411 | int xlfd_idx = font_sort_order[i]; |
| @@ -6644,29 +6650,19 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6644 | if (needs_overstrike) | 6650 | if (needs_overstrike) |
| 6645 | *needs_overstrike = 0; | 6651 | *needs_overstrike = 0; |
| 6646 | 6652 | ||
| 6647 | /* Start with the first non-scalable font in the list. */ | 6653 | best = NULL; |
| 6648 | for (i = 0; i < nfonts; ++i) | ||
| 6649 | if (!font_scalable_p (fonts + i)) | ||
| 6650 | break; | ||
| 6651 | 6654 | ||
| 6652 | /* Find the best match among the non-scalable fonts. */ | 6655 | /* Find the best match among the non-scalable fonts. */ |
| 6653 | if (i < nfonts) | 6656 | for (i = 1; i < nfonts; ++i) |
| 6654 | { | 6657 | if (!font_scalable_p (fonts + i) |
| 6655 | best = fonts + i; | 6658 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) |
| 6656 | 6659 | { | |
| 6657 | for (i = 1; i < nfonts; ++i) | 6660 | best = fonts + i; |
| 6658 | if (!font_scalable_p (fonts + i) | ||
| 6659 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) | ||
| 6660 | { | ||
| 6661 | best = fonts + i; | ||
| 6662 | 6661 | ||
| 6663 | exact_p = exact_face_match_p (specified, best, avgwidth); | 6662 | exact_p = exact_face_match_p (specified, best, avgwidth); |
| 6664 | if (exact_p) | 6663 | if (exact_p) |
| 6665 | break; | 6664 | break; |
| 6666 | } | 6665 | } |
| 6667 | } | ||
| 6668 | else | ||
| 6669 | best = NULL; | ||
| 6670 | 6666 | ||
| 6671 | /* Unless we found an exact match among non-scalable fonts, see if | 6667 | /* Unless we found an exact match among non-scalable fonts, see if |
| 6672 | we can find a better match among scalable fonts. */ | 6668 | we can find a better match among scalable fonts. */ |
| @@ -6690,8 +6686,7 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6690 | for (i = 0; i < nfonts; ++i) | 6686 | for (i = 0; i < nfonts; ++i) |
| 6691 | if (font_scalable_p (fonts + i)) | 6687 | if (font_scalable_p (fonts + i)) |
| 6692 | { | 6688 | { |
| 6693 | if (best == NULL | 6689 | if (better_font_p (specified, fonts + i, best, 0, 0) |
| 6694 | || better_font_p (specified, fonts + i, best, 0, 0) | ||
| 6695 | || (!non_scalable_has_exact_height_p | 6690 | || (!non_scalable_has_exact_height_p |
| 6696 | && !better_font_p (specified, best, fonts + i, 0, 0))) | 6691 | && !better_font_p (specified, best, fonts + i, 0, 0))) |
| 6697 | { | 6692 | { |
| @@ -6719,6 +6714,10 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6719 | } | 6714 | } |
| 6720 | } | 6715 | } |
| 6721 | 6716 | ||
| 6717 | /* We should have found SOME font. */ | ||
| 6718 | if (best == NULL) | ||
| 6719 | abort (); | ||
| 6720 | |||
| 6722 | if (font_scalable_p (best)) | 6721 | if (font_scalable_p (best)) |
| 6723 | font_name = build_scalable_font_name (f, best, pt); | 6722 | font_name = build_scalable_font_name (f, best, pt); |
| 6724 | else | 6723 | else |
diff --git a/src/xterm.c b/src/xterm.c index 1c07c56241e..2070c65d76a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6097,6 +6097,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6097 | 6097 | ||
| 6098 | f = x_any_window_to_frame (dpyinfo, event.xkey.window); | 6098 | f = x_any_window_to_frame (dpyinfo, event.xkey.window); |
| 6099 | 6099 | ||
| 6100 | /* If mouse-highlight is an integer, input clears out | ||
| 6101 | mouse highlighting. */ | ||
| 6100 | if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) | 6102 | if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) |
| 6101 | && (f == 0 | 6103 | && (f == 0 |
| 6102 | || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) | 6104 | || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) |