diff options
| author | Eli Zaretskii | 2013-06-20 20:36:24 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-06-20 20:36:24 +0300 |
| commit | b932cad7124e7c1a20fc2b127201b7dee15a142f (patch) | |
| tree | be909f3696d19eb80426661cf13326e4cfa8e3a8 /src | |
| parent | 5013fc0876296bde339d1cbbdfb19a0cfa1c4079 (diff) | |
| download | emacs-b932cad7124e7c1a20fc2b127201b7dee15a142f.tar.gz emacs-b932cad7124e7c1a20fc2b127201b7dee15a142f.zip | |
Yet another attempt at fixing bugs #14602, 14630, 14669.
src/w32fns.c (w32_wnd_proc): Don't compute the header line and mode
line dimensions here, to avoid race conditions with the main
thread.
src/w32term.c (w32_draw_window_cursor): Compute the header line and
mode line dimensions here.
<w32_system_caret_window, w32_system_caret_hdr_height>:
<w32_system_caret_mode_height>: New variables.
src/w32term.h: Declare them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/w32fns.c | 26 | ||||
| -rw-r--r-- | src/w32term.c | 6 | ||||
| -rw-r--r-- | src/w32term.h | 3 |
4 files changed, 43 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 82856eb91a8..2aeccc222cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-06-20 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32fns.c (w32_wnd_proc): Don't compute the header line and mode | ||
| 4 | line dimensions here, to avoid race conditions with the main | ||
| 5 | thread. (Bug#14062, bug#14630, bug#14669) | ||
| 6 | |||
| 7 | * w32term.c (w32_draw_window_cursor): Compute the header line and | ||
| 8 | mode line dimensions here. | ||
| 9 | <w32_system_caret_window, w32_system_caret_hdr_height>: | ||
| 10 | <w32_system_caret_mode_height>: New variables. | ||
| 11 | |||
| 12 | * w32term.h: Declare them. | ||
| 13 | |||
| 1 | 2013-06-20 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2013-06-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 15 | ||
| 3 | * alloc.c (die): Move "assertion failed" string here ... | 16 | * alloc.c (die): Move "assertion failed" string here ... |
diff --git a/src/w32fns.c b/src/w32fns.c index 970c44ce264..46fb02d96a1 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -3175,23 +3175,39 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3175 | HIMC context; | 3175 | HIMC context; |
| 3176 | struct window *w; | 3176 | struct window *w; |
| 3177 | 3177 | ||
| 3178 | /* Implementation note: The code below does something that | ||
| 3179 | one shouldn't do: it accesses the window object from a | ||
| 3180 | separate thread, while the main (a.k.a. "Lisp") thread | ||
| 3181 | runs and can legitimately delete and even GC it. That is | ||
| 3182 | why we are extra careful not to futz with a window that | ||
| 3183 | is different from the one recorded when the system caret | ||
| 3184 | coordinates were last modified. That is also why we are | ||
| 3185 | careful not to move the IME window if the window | ||
| 3186 | described by W was deleted, as indicated by its buffer | ||
| 3187 | field being reset to nil. */ | ||
| 3178 | f = x_window_to_frame (dpyinfo, hwnd); | 3188 | f = x_window_to_frame (dpyinfo, hwnd); |
| 3179 | w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 3189 | w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
| 3190 | /* Punt if someone changed the frame's selected window | ||
| 3191 | behind our back. */ | ||
| 3192 | if (w != w32_system_caret_window) | ||
| 3193 | break; | ||
| 3180 | 3194 | ||
| 3181 | form.dwStyle = CFS_RECT; | 3195 | form.dwStyle = CFS_RECT; |
| 3182 | form.ptCurrentPos.x = w32_system_caret_x; | 3196 | form.ptCurrentPos.x = w32_system_caret_x; |
| 3183 | form.ptCurrentPos.y = w32_system_caret_y; | 3197 | form.ptCurrentPos.y = w32_system_caret_y; |
| 3184 | 3198 | ||
| 3185 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); | 3199 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); |
| 3186 | form.rcArea.top = WINDOW_TOP_EDGE_Y (w); | 3200 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) |
| 3187 | if (BUFFERP (w->contents) | 3201 | + w32_system_caret_hdr_height); |
| 3188 | && FRAMEP (WINDOW_FRAME (w))) | ||
| 3189 | form.rcArea.top += WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 3190 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) | 3202 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) |
| 3191 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | 3203 | - WINDOW_RIGHT_MARGIN_WIDTH (w) |
| 3192 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); | 3204 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); |
| 3193 | form.rcArea.bottom = (WINDOW_BOTTOM_EDGE_Y (w) | 3205 | form.rcArea.bottom = (WINDOW_BOTTOM_EDGE_Y (w) |
| 3194 | - WINDOW_MODE_LINE_HEIGHT (w)); | 3206 | - w32_system_caret_mode_height); |
| 3207 | |||
| 3208 | /* Punt if the window was deleted behind our back. */ | ||
| 3209 | if (!BUFFERP (w->contents)) | ||
| 3210 | break; | ||
| 3195 | 3211 | ||
| 3196 | context = get_ime_context_fn (hwnd); | 3212 | context = get_ime_context_fn (hwnd); |
| 3197 | 3213 | ||
diff --git a/src/w32term.c b/src/w32term.c index 617492e189f..d3174c65bf0 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -151,6 +151,9 @@ HWND w32_system_caret_hwnd; | |||
| 151 | int w32_system_caret_height; | 151 | int w32_system_caret_height; |
| 152 | int w32_system_caret_x; | 152 | int w32_system_caret_x; |
| 153 | int w32_system_caret_y; | 153 | int w32_system_caret_y; |
| 154 | struct window *w32_system_caret_window; | ||
| 155 | int w32_system_caret_hdr_height; | ||
| 156 | int w32_system_caret_mode_height; | ||
| 154 | DWORD dwWindowsThreadId = 0; | 157 | DWORD dwWindowsThreadId = 0; |
| 155 | HANDLE hWindowsThread = NULL; | 158 | HANDLE hWindowsThread = NULL; |
| 156 | DWORD dwMainThreadId = 0; | 159 | DWORD dwMainThreadId = 0; |
| @@ -5328,6 +5331,9 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 5328 | w32_system_caret_y | 5331 | w32_system_caret_y |
| 5329 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | 5332 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) |
| 5330 | + glyph_row->ascent - w->phys_cursor_ascent); | 5333 | + glyph_row->ascent - w->phys_cursor_ascent); |
| 5334 | w32_system_caret_window = w; | ||
| 5335 | w32_system_caret_hdr_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 5336 | w32_system_caret_mode_height = WINDOW_MODE_LINE_HEIGHT (w); | ||
| 5331 | 5337 | ||
| 5332 | PostMessage (hwnd, WM_IME_STARTCOMPOSITION, 0, 0); | 5338 | PostMessage (hwnd, WM_IME_STARTCOMPOSITION, 0, 0); |
| 5333 | 5339 | ||
diff --git a/src/w32term.h b/src/w32term.h index be0b4a6f350..ace58758302 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -750,6 +750,9 @@ extern HWND w32_system_caret_hwnd; | |||
| 750 | extern int w32_system_caret_height; | 750 | extern int w32_system_caret_height; |
| 751 | extern int w32_system_caret_x; | 751 | extern int w32_system_caret_x; |
| 752 | extern int w32_system_caret_y; | 752 | extern int w32_system_caret_y; |
| 753 | extern struct window *w32_system_caret_window; | ||
| 754 | extern int w32_system_caret_hdr_height; | ||
| 755 | extern int w32_system_caret_mode_height; | ||
| 753 | 756 | ||
| 754 | #ifdef _MSC_VER | 757 | #ifdef _MSC_VER |
| 755 | #ifndef EnumSystemLocales | 758 | #ifndef EnumSystemLocales |