aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2014-09-30 19:19:31 -0400
committerStefan Monnier2014-09-30 19:19:31 -0400
commit07bec0fc67ee0b26685f0ec7f28d9b73f67bf3de (patch)
tree222adf06960f86aa8b2f560217d39c9fe39d3996 /src
parent6aed001ad31d41f028d77e66e597b7b3ab4e31ae (diff)
parentd3b7a90bc2ad20192d1afd23eb1aa6a18ceda569 (diff)
downloademacs-07bec0fc67ee0b26685f0ec7f28d9b73f67bf3de.tar.gz
emacs-07bec0fc67ee0b26685f0ec7f28d9b73f67bf3de.zip
Merge from emacs-24
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog40
-rw-r--r--src/dispnew.c5
-rw-r--r--src/w32fns.c47
-rw-r--r--src/w32term.c54
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c60
6 files changed, 156 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7dfa2f80775..257cc34c909 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,43 @@
12014-09-30 Eli Zaretskii <eliz@gnu.org>
2
3 * w32fns.c (w32_createwindow): Accept an additional argument, an
4 array of 2 values specifying the coordinates of the frame's
5 top-left corner. Use these values instead of calling x_get_arg,
6 which can cons Lisp objects, and therefore cannot be called except
7 from the main thread. Remove redundant tests for the default
8 values.
9 (my_create_window): Move the calculation of the coordinates of the
10 frame's top-left edge here. Pass them to the input thread via the
11 second parameter of the WM_EMACS_CREATEWINDOW message. See
12 http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00892.html
13 for the details.
14
152014-09-30 Eli Zaretskii <eliz@gnu.org>
16
17 * xdisp.c (cursor_row_fully_visible_p): Update commentary.
18 (redisplay_window): Treat the frame's frozen_window_starts flag
19 the same way as the optional_new_start flag for the window: only
20 obey it if the glyph row showing point will be fully visible.
21 Likewise when the window start is in a continuation line. If,
22 after trying everything under the 'force_start' label, point is
23 still not fully visible, give up and scroll the window. Add
24 debugging traces. (Bug#18545)
25
26 * window.c (Frecenter): Set the window's redisplay flag.
27
282014-09-30 Eli Zaretskii <eliz@gnu.org>
29
30 * w32term.c (w32_read_socket): Don't use frame dimensions for
31 resizing if GetClientRect returned an empty (0, 0, 0, 0)
32 rectangle. Check the return value of GetClientRect, and don't use
33 the results if it didn't succeed.
34
35 * dispnew.c (change_frame_size_1): Recompute the frame dimensions
36 in columns and lines after correcting the pixel dimensions in
37 check_frame_size.
38 (adjust_decode_mode_spec_buffer): Add assertion to avoid passing
39 negative values to xrealloc. (Bug#18528)
40
12014-09-30 Paul Eggert <eggert@cs.ucla.edu> 412014-09-30 Paul Eggert <eggert@cs.ucla.edu>
2 42
3 * alloc.c: Remove now-unnecessary check. 43 * alloc.c: Remove now-unnecessary check.
diff --git a/src/dispnew.c b/src/dispnew.c
index 078c1ea2164..54657d976ad 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2137,8 +2137,11 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2137static void 2137static void
2138adjust_decode_mode_spec_buffer (struct frame *f) 2138adjust_decode_mode_spec_buffer (struct frame *f)
2139{ 2139{
2140 ssize_t frame_message_buf_size = FRAME_MESSAGE_BUF_SIZE (f);
2141
2142 eassert (frame_message_buf_size >= 0);
2140 f->decode_mode_spec_buffer = xrealloc (f->decode_mode_spec_buffer, 2143 f->decode_mode_spec_buffer = xrealloc (f->decode_mode_spec_buffer,
2141 FRAME_MESSAGE_BUF_SIZE (f) + 1); 2144 frame_message_buf_size + 1);
2142} 2145}
2143 2146
2144 2147
diff --git a/src/w32fns.c b/src/w32fns.c
index 0a8bde1f661..98eb8e9f97b 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1956,13 +1956,12 @@ w32_createhscrollbar (struct frame *f, struct scroll_bar * bar)
1956} 1956}
1957 1957
1958static void 1958static void
1959w32_createwindow (struct frame *f) 1959w32_createwindow (struct frame *f, int *coords)
1960{ 1960{
1961 HWND hwnd; 1961 HWND hwnd;
1962 RECT rect; 1962 RECT rect;
1963 Lisp_Object top = Qunbound; 1963 int top;
1964 Lisp_Object left = Qunbound; 1964 int left;
1965 struct w32_display_info *dpyinfo = &one_w32_display_info;
1966 1965
1967 rect.left = rect.top = 0; 1966 rect.left = rect.top = 0;
1968 rect.right = FRAME_PIXEL_WIDTH (f); 1967 rect.right = FRAME_PIXEL_WIDTH (f);
@@ -1977,25 +1976,21 @@ w32_createwindow (struct frame *f)
1977 1976
1978 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition) 1977 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)
1979 { 1978 {
1980 XSETINT (left, f->left_pos); 1979 left = f->left_pos;
1981 XSETINT (top, f->top_pos); 1980 top = f->top_pos;
1982 } 1981 }
1983 else if (EQ (left, Qunbound) && EQ (top, Qunbound)) 1982 else
1984 { 1983 {
1985 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero 1984 left = coords[0];
1986 for anything that is not a number and is not Qunbound. */ 1985 top = coords[1];
1987 left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
1988 top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
1989 } 1986 }
1990 1987
1991 FRAME_W32_WINDOW (f) = hwnd 1988 FRAME_W32_WINDOW (f) = hwnd
1992 = CreateWindow (EMACS_CLASS, 1989 = CreateWindow (EMACS_CLASS,
1993 f->namebuf, 1990 f->namebuf,
1994 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, 1991 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
1995 EQ (left, Qunbound) ? CW_USEDEFAULT : XINT (left), 1992 left, top,
1996 EQ (top, Qunbound) ? CW_USEDEFAULT : XINT (top), 1993 rect.right - rect.left, rect.bottom - rect.top,
1997 rect.right - rect.left,
1998 rect.bottom - rect.top,
1999 NULL, 1994 NULL,
2000 NULL, 1995 NULL,
2001 hinst, 1996 hinst,
@@ -2516,7 +2511,8 @@ w32_msg_pump (deferred_msg * msg_buf)
2516 the patch for XP is not publicly available until XP SP3, 2511 the patch for XP is not publicly available until XP SP3,
2517 and older versions will never be patched. */ 2512 and older versions will never be patched. */
2518 CoInitialize (NULL); 2513 CoInitialize (NULL);
2519 w32_createwindow ((struct frame *) msg.wParam); 2514 w32_createwindow ((struct frame *) msg.wParam,
2515 (int *) msg.lParam);
2520 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 2516 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
2521 emacs_abort (); 2517 emacs_abort ();
2522 break; 2518 break;
@@ -4136,8 +4132,25 @@ static void
4136my_create_window (struct frame * f) 4132my_create_window (struct frame * f)
4137{ 4133{
4138 MSG msg; 4134 MSG msg;
4135 static int coords[2];
4136 Lisp_Object left, top;
4137 struct w32_display_info *dpyinfo = &one_w32_display_info;
4138
4139 /* When called with RES_TYPE_NUMBER, x_get_arg will return zero for
4140 anything that is not a number and is not Qunbound. */
4141 left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
4142 top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
4143 if (EQ (left, Qunbound))
4144 coords[0] = CW_USEDEFAULT;
4145 else
4146 coords[0] = XINT (left);
4147 if (EQ (top, Qunbound))
4148 coords[1] = CW_USEDEFAULT;
4149 else
4150 coords[1] = XINT (top);
4139 4151
4140 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) 4152 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW,
4153 (WPARAM)f, (LPARAM)coords))
4141 emacs_abort (); 4154 emacs_abort ();
4142 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 4155 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
4143} 4156}
diff --git a/src/w32term.c b/src/w32term.c
index 4f8482736c3..2a4c30af12d 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5144,30 +5144,38 @@ w32_read_socket (struct terminal *terminal,
5144 RECT rect; 5144 RECT rect;
5145 int rows, columns, width, height, text_width, text_height; 5145 int rows, columns, width, height, text_width, text_height;
5146 5146
5147 GetClientRect (msg.msg.hwnd, &rect); 5147 if (GetClientRect (msg.msg.hwnd, &rect)
5148 5148 /* GetClientRect evidently returns (0, 0, 0, 0) if
5149 height = rect.bottom - rect.top; 5149 called on a minimized frame. Such "dimensions"
5150 width = rect.right - rect.left; 5150 aren't useful anyway. */
5151 text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, width); 5151 && !(rect.bottom == 0
5152 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, height); 5152 && rect.top == 0
5153 /* rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); */ 5153 && rect.left == 0
5154 /* columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); */ 5154 && rect.right == 0))
5155
5156 /* TODO: Clip size to the screen dimensions. */
5157
5158 /* Even if the number of character rows and columns has
5159 not changed, the font size may have changed, so we need
5160 to check the pixel dimensions as well. */
5161
5162 if (width != FRAME_PIXEL_WIDTH (f)
5163 || height != FRAME_PIXEL_HEIGHT (f)
5164 || text_width != FRAME_TEXT_WIDTH (f)
5165 || text_height != FRAME_TEXT_HEIGHT (f))
5166 { 5155 {
5167 change_frame_size (f, text_width, text_height, 0, 1, 0, 1); 5156 height = rect.bottom - rect.top;
5168 SET_FRAME_GARBAGED (f); 5157 width = rect.right - rect.left;
5169 cancel_mouse_face (f); 5158 text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, width);
5170 f->win_gravity = NorthWestGravity; 5159 text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, height);
5160 /* rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); */
5161 /* columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); */
5162
5163 /* TODO: Clip size to the screen dimensions. */
5164
5165 /* Even if the number of character rows and columns
5166 has not changed, the font size may have changed,
5167 so we need to check the pixel dimensions as well. */
5168
5169 if (width != FRAME_PIXEL_WIDTH (f)
5170 || height != FRAME_PIXEL_HEIGHT (f)
5171 || text_width != FRAME_TEXT_WIDTH (f)
5172 || text_height != FRAME_TEXT_HEIGHT (f))
5173 {
5174 change_frame_size (f, text_width, text_height, 0, 1, 0, 1);
5175 SET_FRAME_GARBAGED (f);
5176 cancel_mouse_face (f);
5177 f->win_gravity = NorthWestGravity;
5178 }
5171 } 5179 }
5172 } 5180 }
5173 5181
diff --git a/src/window.c b/src/window.c
index f05ea561263..456a8bce691 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5914,6 +5914,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5914 w->start_at_line_beg = (bytepos == BEGV_BYTE 5914 w->start_at_line_beg = (bytepos == BEGV_BYTE
5915 || FETCH_BYTE (bytepos - 1) == '\n'); 5915 || FETCH_BYTE (bytepos - 1) == '\n');
5916 5916
5917 wset_redisplay (w);
5918
5917 return Qnil; 5919 return Qnil;
5918} 5920}
5919 5921
diff --git a/src/xdisp.c b/src/xdisp.c
index bf620085727..c27f46677bb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15002,6 +15002,10 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
15002 If FORCE_P is non-zero, return 0 even if partial visible cursor row 15002 If FORCE_P is non-zero, return 0 even if partial visible cursor row
15003 is higher than window. 15003 is higher than window.
15004 15004
15005 If CURRENT_MATRIX_P is non-zero, use the information from the
15006 window's current glyph matrix; otherwise use the desired glyph
15007 matrix.
15008
15005 A value of 0 means the caller should do scrolling 15009 A value of 0 means the caller should do scrolling
15006 as if point had gone off the screen. */ 15010 as if point had gone off the screen. */
15007 15011
@@ -16175,26 +16179,48 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16175 16179
16176 /* If someone specified a new starting point but did not insist, 16180 /* If someone specified a new starting point but did not insist,
16177 check whether it can be used. */ 16181 check whether it can be used. */
16178 if (w->optional_new_start 16182 if ((w->optional_new_start || window_frozen_p (w))
16179 && CHARPOS (startp) >= BEGV 16183 && CHARPOS (startp) >= BEGV
16180 && CHARPOS (startp) <= ZV) 16184 && CHARPOS (startp) <= ZV)
16181 { 16185 {
16186 ptrdiff_t it_charpos;
16187
16182 w->optional_new_start = 0; 16188 w->optional_new_start = 0;
16183 start_display (&it, w, startp); 16189 start_display (&it, w, startp);
16184 move_it_to (&it, PT, 0, it.last_visible_y, -1, 16190 move_it_to (&it, PT, 0, it.last_visible_y, -1,
16185 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); 16191 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
16186 if (IT_CHARPOS (it) == PT) 16192 /* Record IT's position now, since line_bottom_y might change
16187 w->force_start = 1; 16193 that. */
16188 /* IT may overshoot PT if text at PT is invisible. */ 16194 it_charpos = IT_CHARPOS (it);
16189 else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT) 16195 /* Make sure we set the force_start flag only if the cursor row
16190 w->force_start = 1; 16196 will be fully visible. Otherwise, the code under force_start
16197 label below will try to move point back into view, which is
16198 not what the code which sets optional_new_start wants. */
16199 if ((it.current_y == 0 || line_bottom_y (&it) < it.last_visible_y)
16200 && !w->force_start)
16201 {
16202 if (it_charpos == PT)
16203 w->force_start = 1;
16204 /* IT may overshoot PT if text at PT is invisible. */
16205 else if (it_charpos > PT && CHARPOS (startp) <= PT)
16206 w->force_start = 1;
16207#ifdef GLYPH_DEBUG
16208 if (w->force_start)
16209 {
16210 if (window_frozen_p (w))
16211 debug_method_add (w, "set force_start from frozen window start");
16212 else
16213 debug_method_add (w, "set force_start from optional_new_start");
16214 }
16215#endif
16216 }
16191 } 16217 }
16192 16218
16193 force_start: 16219 force_start:
16194 16220
16195 /* Handle case where place to start displaying has been specified, 16221 /* Handle case where place to start displaying has been specified,
16196 unless the specified location is outside the accessible range. */ 16222 unless the specified location is outside the accessible range. */
16197 if (w->force_start || window_frozen_p (w)) 16223 if (w->force_start)
16198 { 16224 {
16199 /* We set this later on if we have to adjust point. */ 16225 /* We set this later on if we have to adjust point. */
16200 int new_vpos = -1; 16226 int new_vpos = -1;
@@ -16239,7 +16265,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16239 goto need_larger_matrices; 16265 goto need_larger_matrices;
16240 } 16266 }
16241 16267
16242 if (w->cursor.vpos < 0 && !window_frozen_p (w)) 16268 if (w->cursor.vpos < 0)
16243 { 16269 {
16244 /* If point does not appear, try to move point so it does 16270 /* If point does not appear, try to move point so it does
16245 appear. The desired matrix has been built above, so we 16271 appear. The desired matrix has been built above, so we
@@ -16332,6 +16358,11 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16332 } 16358 }
16333 */ 16359 */
16334 } 16360 }
16361 if (w->cursor.vpos < 0 || !cursor_row_fully_visible_p (w, 0, 0))
16362 {
16363 clear_glyph_matrix (w->desired_matrix);
16364 goto try_to_scroll;
16365 }
16335 16366
16336#ifdef GLYPH_DEBUG 16367#ifdef GLYPH_DEBUG
16337 debug_method_add (w, "forced window start"); 16368 debug_method_add (w, "forced window start");
@@ -16396,7 +16427,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16396 || CHARPOS (startp) == BEGV 16427 || CHARPOS (startp) == BEGV
16397 || !window_outdated (w))) 16428 || !window_outdated (w)))
16398 { 16429 {
16399 int d1, d2, d3, d4, d5, d6; 16430 int d1, d2, d5, d6;
16431 int rtop, rbot;
16400 16432
16401 /* If first window line is a continuation line, and window start 16433 /* If first window line is a continuation line, and window start
16402 is inside the modified region, but the first change is before 16434 is inside the modified region, but the first change is before
@@ -16421,14 +16453,20 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16421 && compute_window_start_on_continuation_line (w) 16453 && compute_window_start_on_continuation_line (w)
16422 /* It doesn't make sense to force the window start like we 16454 /* It doesn't make sense to force the window start like we
16423 do at label force_start if it is already known that point 16455 do at label force_start if it is already known that point
16424 will not be visible in the resulting window, because 16456 will not be fully visible in the resulting window, because
16425 doing so will move point from its correct position 16457 doing so will move point from its correct position
16426 instead of scrolling the window to bring point into view. 16458 instead of scrolling the window to bring point into view.
16427 See bug#9324. */ 16459 See bug#9324. */
16428 && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6)) 16460 && pos_visible_p (w, PT, &d1, &d2, &rtop, &rbot, &d5, &d6)
16461 /* A very tall row could need more than the window height,
16462 in which case we accept that it is partially visible. */
16463 && (rtop != 0) == (rbot != 0))
16429 { 16464 {
16430 w->force_start = 1; 16465 w->force_start = 1;
16431 SET_TEXT_POS_FROM_MARKER (startp, w->start); 16466 SET_TEXT_POS_FROM_MARKER (startp, w->start);
16467#ifdef GLYPH_DEBUG
16468 debug_method_add (w, "recomputed window start in continuation line");
16469#endif
16432 goto force_start; 16470 goto force_start;
16433 } 16471 }
16434 16472