diff options
| author | Glenn Morris | 2014-09-14 17:20:21 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-09-14 17:20:21 -0700 |
| commit | 11af46027d22daa11d0df7d5032e6925c990dad1 (patch) | |
| tree | 4d0d528afaf7449dba3cb73af0745980306c57d0 /src | |
| parent | 5ce52d05c93e0c006bbd145b938aa9fab7dfcb8d (diff) | |
| parent | d4dc0e1691a15efd1ea0a8793cf889e683a37933 (diff) | |
| download | emacs-11af46027d22daa11d0df7d5032e6925c990dad1.tar.gz emacs-11af46027d22daa11d0df7d5032e6925c990dad1.zip | |
Merge from emacs-24; up to 2014-07-09T02:04:12Z!rgm@gnu.org
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 37 | ||||
| -rw-r--r-- | src/nsterm.m | 17 | ||||
| -rw-r--r-- | src/sound.c | 17 | ||||
| -rw-r--r-- | src/w32.c | 56 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 17 |
6 files changed, 117 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 015ed3618cf..5f1dfbfe785 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,40 @@ | |||
| 1 | 2014-09-15 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of pipes. | ||
| 4 | (sys_write): When a write to a non-blocking pipe returns ENOSPC, | ||
| 5 | set errno to EAGAIN instead, to allow the caller to retry the | ||
| 6 | write after some waiting. Fixes deadlocks when Emacs exchanges a | ||
| 7 | lot of data through the pipe. (Bug#18420) | ||
| 8 | |||
| 9 | * sound.c (Fplay_sound_internal): Encode the sound file name in | ||
| 10 | the ANSI codepage. Expand it against data-directory, as per docs, | ||
| 11 | not against the current directory. No need to make a local copy | ||
| 12 | of the file name; pass the encoded file name directly to | ||
| 13 | do_play_sound. (Bug#18463) | ||
| 14 | |||
| 15 | * w32.c (ansi_encode_filename): If w32_get_short_filename returns | ||
| 16 | NULL, and the file name is not encodable in ANSI codepage, return | ||
| 17 | the string with "?" replacement characters, which will fail the | ||
| 18 | caller. This avoids returning a random value in that case. | ||
| 19 | |||
| 20 | 2014-09-15 Martin Rudalics <rudalics@gmx.at> | ||
| 21 | |||
| 22 | * window.c (Fresize_mini_window_internal): Set w->total_lines | ||
| 23 | from w->pixel_height (Bug#18422). | ||
| 24 | |||
| 25 | 2014-09-15 Jan Djärv <jan.h.d@swipnet.se> | ||
| 26 | |||
| 27 | * nsterm.m (updateFrameSize:, initFrameFromEmacs:) | ||
| 28 | (toggleFullScreen:): Take frame_resize_pixelwise into account when | ||
| 29 | setting resize increments (Bug#18435). | ||
| 30 | |||
| 31 | 2014-09-15 Eli Zaretskii <eliz@gnu.org> | ||
| 32 | |||
| 33 | * xdisp.c (pos_visible_p): Properly save and restore the iterator | ||
| 34 | state around the call to line_bottom, since it can move the | ||
| 35 | iterator to another screen line. This fixes off-by-one errors in | ||
| 36 | the reported row in some rare cases. | ||
| 37 | |||
| 1 | 2014-09-14 Jan Djärv <jan.h.d@swipnet.se> | 38 | 2014-09-14 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 39 | ||
| 3 | * callproc.c (init_callproc): Fix bug introduced at | 40 | * callproc.c (init_callproc): Fix bug introduced at |
diff --git a/src/nsterm.m b/src/nsterm.m index dc775fc417a..5f86369a8c4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -5849,10 +5849,13 @@ not_in_argv (NSString *arg) | |||
| 5849 | 5849 | ||
| 5850 | // Did resize increments change because of a font change? | 5850 | // Did resize increments change because of a font change? |
| 5851 | if (sz.width != FRAME_COLUMN_WIDTH (emacsframe) || | 5851 | if (sz.width != FRAME_COLUMN_WIDTH (emacsframe) || |
| 5852 | sz.height != FRAME_LINE_HEIGHT (emacsframe)) | 5852 | sz.height != FRAME_LINE_HEIGHT (emacsframe) || |
| 5853 | (frame_resize_pixelwise && sz.width != 1)) | ||
| 5853 | { | 5854 | { |
| 5854 | sz.width = FRAME_COLUMN_WIDTH (emacsframe); | 5855 | sz.width = frame_resize_pixelwise |
| 5855 | sz.height = FRAME_LINE_HEIGHT (emacsframe); | 5856 | ? 1 : FRAME_COLUMN_WIDTH (emacsframe); |
| 5857 | sz.height = frame_resize_pixelwise | ||
| 5858 | ? 1 : FRAME_LINE_HEIGHT (emacsframe); | ||
| 5856 | [win setResizeIncrements: sz]; | 5859 | [win setResizeIncrements: sz]; |
| 5857 | 5860 | ||
| 5858 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); | 5861 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); |
| @@ -6122,8 +6125,8 @@ if (cols > 0 && rows > 0) | |||
| 6122 | [win setDelegate: self]; | 6125 | [win setDelegate: self]; |
| 6123 | [win useOptimizedDrawing: YES]; | 6126 | [win useOptimizedDrawing: YES]; |
| 6124 | 6127 | ||
| 6125 | sz.width = FRAME_COLUMN_WIDTH (f); | 6128 | sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); |
| 6126 | sz.height = FRAME_LINE_HEIGHT (f); | 6129 | sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); |
| 6127 | [win setResizeIncrements: sz]; | 6130 | [win setResizeIncrements: sz]; |
| 6128 | 6131 | ||
| 6129 | [[win contentView] addSubview: self]; | 6132 | [[win contentView] addSubview: self]; |
| @@ -6470,8 +6473,8 @@ if (cols > 0 && rows > 0) | |||
| 6470 | (FRAME_DEFAULT_FACE (f)), | 6473 | (FRAME_DEFAULT_FACE (f)), |
| 6471 | f); | 6474 | f); |
| 6472 | 6475 | ||
| 6473 | sz.width = FRAME_COLUMN_WIDTH (f); | 6476 | sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); |
| 6474 | sz.height = FRAME_LINE_HEIGHT (f); | 6477 | sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); |
| 6475 | 6478 | ||
| 6476 | if (fs_state != FULLSCREEN_BOTH) | 6479 | if (fs_state != FULLSCREEN_BOTH) |
| 6477 | { | 6480 | { |
diff --git a/src/sound.c b/src/sound.c index 9351097138d..7ba14b36f33 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -88,6 +88,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 88 | #include <limits.h> | 88 | #include <limits.h> |
| 89 | #include <windows.h> | 89 | #include <windows.h> |
| 90 | #include <mmsystem.h> | 90 | #include <mmsystem.h> |
| 91 | |||
| 92 | #include "coding.h" | ||
| 93 | #include "w32.h" | ||
| 91 | /* END: Windows Specific Includes */ | 94 | /* END: Windows Specific Includes */ |
| 92 | 95 | ||
| 93 | #endif /* WINDOWSNT */ | 96 | #endif /* WINDOWSNT */ |
| @@ -1310,8 +1313,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1310 | struct gcpro gcpro1, gcpro2; | 1313 | struct gcpro gcpro1, gcpro2; |
| 1311 | Lisp_Object args[2]; | 1314 | Lisp_Object args[2]; |
| 1312 | #else /* WINDOWSNT */ | 1315 | #else /* WINDOWSNT */ |
| 1313 | Lisp_Object lo_file = {0}; | 1316 | Lisp_Object lo_file; |
| 1314 | char * psz_file = NULL; | ||
| 1315 | unsigned long ui_volume_tmp = UINT_MAX; | 1317 | unsigned long ui_volume_tmp = UINT_MAX; |
| 1316 | unsigned long ui_volume = UINT_MAX; | 1318 | unsigned long ui_volume = UINT_MAX; |
| 1317 | #endif /* WINDOWSNT */ | 1319 | #endif /* WINDOWSNT */ |
| @@ -1384,10 +1386,11 @@ Internal use only, use `play-sound' instead. */) | |||
| 1384 | 1386 | ||
| 1385 | #else /* WINDOWSNT */ | 1387 | #else /* WINDOWSNT */ |
| 1386 | 1388 | ||
| 1387 | lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); | 1389 | lo_file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory); |
| 1388 | len = XSTRING (lo_file)->size; | 1390 | lo_file = ENCODE_FILE (lo_file); |
| 1389 | psz_file = alloca (len + 1); | 1391 | /* Since UNICOWS.DLL includes only a stub for mciSendStringW, we |
| 1390 | strcpy (psz_file, XSTRING (lo_file)->data); | 1392 | need to encode the file in the ANSI codepage. */ |
| 1393 | lo_file = ansi_encode_filename (lo_file); | ||
| 1391 | if (INTEGERP (attrs[SOUND_VOLUME])) | 1394 | if (INTEGERP (attrs[SOUND_VOLUME])) |
| 1392 | { | 1395 | { |
| 1393 | ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]); | 1396 | ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]); |
| @@ -1409,7 +1412,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1409 | { | 1412 | { |
| 1410 | ui_volume = ui_volume_tmp * (UINT_MAX / 100); | 1413 | ui_volume = ui_volume_tmp * (UINT_MAX / 100); |
| 1411 | } | 1414 | } |
| 1412 | do_play_sound (psz_file, ui_volume); | 1415 | do_play_sound (SDATA (lo_file), ui_volume); |
| 1413 | 1416 | ||
| 1414 | #endif /* WINDOWSNT */ | 1417 | #endif /* WINDOWSNT */ |
| 1415 | 1418 | ||
| @@ -2391,6 +2391,8 @@ ansi_encode_filename (Lisp_Object filename) | |||
| 2391 | dostounix_filename (shortname); | 2391 | dostounix_filename (shortname); |
| 2392 | encoded_filename = build_string (shortname); | 2392 | encoded_filename = build_string (shortname); |
| 2393 | } | 2393 | } |
| 2394 | else | ||
| 2395 | encoded_filename = build_unibyte_string (fname); | ||
| 2394 | } | 2396 | } |
| 2395 | else | 2397 | else |
| 2396 | encoded_filename = build_unibyte_string (fname); | 2398 | encoded_filename = build_unibyte_string (fname); |
| @@ -7720,15 +7722,15 @@ fcntl (int s, int cmd, int options) | |||
| 7720 | if (cmd == F_DUPFD_CLOEXEC) | 7722 | if (cmd == F_DUPFD_CLOEXEC) |
| 7721 | return sys_dup (s); | 7723 | return sys_dup (s); |
| 7722 | 7724 | ||
| 7723 | if (winsock_lib == NULL) | ||
| 7724 | { | ||
| 7725 | errno = ENETDOWN; | ||
| 7726 | return -1; | ||
| 7727 | } | ||
| 7728 | |||
| 7729 | check_errno (); | 7725 | check_errno (); |
| 7730 | if (fd_info[s].flags & FILE_SOCKET) | 7726 | if (fd_info[s].flags & FILE_SOCKET) |
| 7731 | { | 7727 | { |
| 7728 | if (winsock_lib == NULL) | ||
| 7729 | { | ||
| 7730 | errno = ENETDOWN; | ||
| 7731 | return -1; | ||
| 7732 | } | ||
| 7733 | |||
| 7732 | if (cmd == F_SETFL && options == O_NONBLOCK) | 7734 | if (cmd == F_SETFL && options == O_NONBLOCK) |
| 7733 | { | 7735 | { |
| 7734 | unsigned long nblock = 1; | 7736 | unsigned long nblock = 1; |
| @@ -7745,13 +7747,36 @@ fcntl (int s, int cmd, int options) | |||
| 7745 | return SOCKET_ERROR; | 7747 | return SOCKET_ERROR; |
| 7746 | } | 7748 | } |
| 7747 | } | 7749 | } |
| 7750 | else if ((fd_info[s].flags & (FILE_PIPE | FILE_WRITE)) | ||
| 7751 | == (FILE_PIPE | FILE_WRITE)) | ||
| 7752 | { | ||
| 7753 | /* Force our writes to pipes be non-blocking. */ | ||
| 7754 | if (cmd == F_SETFL && options == O_NONBLOCK) | ||
| 7755 | { | ||
| 7756 | HANDLE h = (HANDLE)_get_osfhandle (s); | ||
| 7757 | DWORD pipe_mode = PIPE_NOWAIT; | ||
| 7758 | |||
| 7759 | if (!SetNamedPipeHandleState (h, &pipe_mode, NULL, NULL)) | ||
| 7760 | { | ||
| 7761 | DebPrint (("SetNamedPipeHandleState: %lu\n", GetLastError ())); | ||
| 7762 | return SOCKET_ERROR; | ||
| 7763 | } | ||
| 7764 | fd_info[s].flags |= FILE_NDELAY; | ||
| 7765 | return 0; | ||
| 7766 | } | ||
| 7767 | else | ||
| 7768 | { | ||
| 7769 | errno = EINVAL; | ||
| 7770 | return SOCKET_ERROR; | ||
| 7771 | } | ||
| 7772 | } | ||
| 7748 | errno = ENOTSOCK; | 7773 | errno = ENOTSOCK; |
| 7749 | return SOCKET_ERROR; | 7774 | return SOCKET_ERROR; |
| 7750 | } | 7775 | } |
| 7751 | 7776 | ||
| 7752 | 7777 | ||
| 7753 | /* Shadow main io functions: we need to handle pipes and sockets more | 7778 | /* Shadow main io functions: we need to handle pipes and sockets more |
| 7754 | intelligently, and implement non-blocking mode as well. */ | 7779 | intelligently. */ |
| 7755 | 7780 | ||
| 7756 | int | 7781 | int |
| 7757 | sys_close (int fd) | 7782 | sys_close (int fd) |
| @@ -8236,7 +8261,6 @@ sys_read (int fd, char * buffer, unsigned int count) | |||
| 8236 | /* From w32xfns.c */ | 8261 | /* From w32xfns.c */ |
| 8237 | extern HANDLE interrupt_handle; | 8262 | extern HANDLE interrupt_handle; |
| 8238 | 8263 | ||
| 8239 | /* For now, don't bother with a non-blocking mode */ | ||
| 8240 | int | 8264 | int |
| 8241 | sys_write (int fd, const void * buffer, unsigned int count) | 8265 | sys_write (int fd, const void * buffer, unsigned int count) |
| 8242 | { | 8266 | { |
| @@ -8388,6 +8412,22 @@ sys_write (int fd, const void * buffer, unsigned int count) | |||
| 8388 | nchars += n; | 8412 | nchars += n; |
| 8389 | if (n < 0) | 8413 | if (n < 0) |
| 8390 | { | 8414 | { |
| 8415 | /* When there's no buffer space in a pipe that is in the | ||
| 8416 | non-blocking mode, _write returns ENOSPC. We return | ||
| 8417 | EAGAIN instead, which should trigger the logic in | ||
| 8418 | send_process that enters waiting loop and calls | ||
| 8419 | wait_reading_process_output to allow process input to | ||
| 8420 | be accepted during the wait. Those calls to | ||
| 8421 | wait_reading_process_output allow sys_select to | ||
| 8422 | notice when process input becomes available, thus | ||
| 8423 | avoiding deadlock whereby each side of the pipe is | ||
| 8424 | blocked on write, waiting for the other party to read | ||
| 8425 | its end of the pipe. */ | ||
| 8426 | if (errno == ENOSPC | ||
| 8427 | && fd < MAXDESC | ||
| 8428 | && ((fd_info[fd].flags & (FILE_PIPE | FILE_NDELAY)) | ||
| 8429 | == (FILE_PIPE | FILE_NDELAY))) | ||
| 8430 | errno = EAGAIN; | ||
| 8391 | nchars = n; | 8431 | nchars = n; |
| 8392 | break; | 8432 | break; |
| 8393 | } | 8433 | } |
diff --git a/src/window.c b/src/window.c index 8736fe13c3b..ce651abdda9 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4796,10 +4796,10 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4796 | block_input (); | 4796 | block_input (); |
| 4797 | window_resize_apply (r, 0); | 4797 | window_resize_apply (r, 0); |
| 4798 | 4798 | ||
| 4799 | w->total_lines = XFASTINT (w->new_total); | ||
| 4800 | w->top_line = r->top_line + r->total_lines; | ||
| 4801 | w->pixel_height = XFASTINT (w->new_pixel); | 4799 | w->pixel_height = XFASTINT (w->new_pixel); |
| 4800 | w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f); | ||
| 4802 | w->pixel_top = r->pixel_top + r->pixel_height; | 4801 | w->pixel_top = r->pixel_top + r->pixel_height; |
| 4802 | w->top_line = r->top_line + r->total_lines; | ||
| 4803 | 4803 | ||
| 4804 | fset_redisplay (f); | 4804 | fset_redisplay (f); |
| 4805 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4805 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
diff --git a/src/xdisp.c b/src/xdisp.c index d02caba5c19..1c6362d0345 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1455,15 +1455,19 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1455 | glyph. */ | 1455 | glyph. */ |
| 1456 | int top_x = it.current_x; | 1456 | int top_x = it.current_x; |
| 1457 | int top_y = it.current_y; | 1457 | int top_y = it.current_y; |
| 1458 | /* Calling line_bottom_y may change it.method, it.position, etc. */ | ||
| 1459 | enum it_method it_method = it.method; | ||
| 1460 | int bottom_y = (last_height = 0, line_bottom_y (&it)); | ||
| 1461 | int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); | 1458 | int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
| 1459 | int bottom_y; | ||
| 1460 | struct it save_it; | ||
| 1461 | void *save_it_data = NULL; | ||
| 1462 | 1462 | ||
| 1463 | /* Calling line_bottom_y may change it.method, it.position, etc. */ | ||
| 1464 | SAVE_IT (save_it, it, save_it_data); | ||
| 1465 | last_height = 0; | ||
| 1466 | bottom_y = line_bottom_y (&it); | ||
| 1463 | if (top_y < window_top_y) | 1467 | if (top_y < window_top_y) |
| 1464 | visible_p = bottom_y > window_top_y; | 1468 | visible_p = bottom_y > window_top_y; |
| 1465 | else if (top_y < it.last_visible_y) | 1469 | else if (top_y < it.last_visible_y) |
| 1466 | visible_p = true; | 1470 | visible_p = 1; |
| 1467 | if (bottom_y >= it.last_visible_y | 1471 | if (bottom_y >= it.last_visible_y |
| 1468 | && it.bidi_p && it.bidi_it.scan_dir == -1 | 1472 | && it.bidi_p && it.bidi_it.scan_dir == -1 |
| 1469 | && IT_CHARPOS (it) < charpos) | 1473 | && IT_CHARPOS (it) < charpos) |
| @@ -1476,7 +1480,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1476 | move_it_to again with a slightly larger vertical limit, | 1480 | move_it_to again with a slightly larger vertical limit, |
| 1477 | and see if it actually moved vertically; if it did, we | 1481 | and see if it actually moved vertically; if it did, we |
| 1478 | didn't really reach CHARPOS, which is beyond window end. */ | 1482 | didn't really reach CHARPOS, which is beyond window end. */ |
| 1479 | struct it save_it = it; | ||
| 1480 | /* Why 10? because we don't know how many canonical lines | 1483 | /* Why 10? because we don't know how many canonical lines |
| 1481 | will the height of the next line(s) be. So we guess. */ | 1484 | will the height of the next line(s) be. So we guess. */ |
| 1482 | int ten_more_lines = 10 * default_line_pixel_height (w); | 1485 | int ten_more_lines = 10 * default_line_pixel_height (w); |
| @@ -1486,11 +1489,11 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1486 | if (it.current_y > top_y) | 1489 | if (it.current_y > top_y) |
| 1487 | visible_p = 0; | 1490 | visible_p = 0; |
| 1488 | 1491 | ||
| 1489 | it = save_it; | ||
| 1490 | } | 1492 | } |
| 1493 | RESTORE_IT (&it, &save_it, save_it_data); | ||
| 1491 | if (visible_p) | 1494 | if (visible_p) |
| 1492 | { | 1495 | { |
| 1493 | if (it_method == GET_FROM_DISPLAY_VECTOR) | 1496 | if (it.method == GET_FROM_DISPLAY_VECTOR) |
| 1494 | { | 1497 | { |
| 1495 | /* We stopped on the last glyph of a display vector. | 1498 | /* We stopped on the last glyph of a display vector. |
| 1496 | Try and recompute. Hack alert! */ | 1499 | Try and recompute. Hack alert! */ |