diff options
| author | Eli Zaretskii | 2019-09-24 10:28:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-09-24 10:28:44 +0300 |
| commit | d32d9373b5348db87c85fd2717f1b5a524bc207f (patch) | |
| tree | 13b5c91e12bb65f5cd5995af440ae02cca4963fe /src | |
| parent | 61a2b3ca7d4afe3e3f77b77f59de3ad2f7159bfd (diff) | |
| download | emacs-d32d9373b5348db87c85fd2717f1b5a524bc207f.tar.gz emacs-d32d9373b5348db87c85fd2717f1b5a524bc207f.zip | |
Resurrect support for negative frame geometry parameters on MS-Windows
* src/w32fns.c (my_create_window): Avoid assertion violations
in XFIXNUM when the 'top' or 'left' frame parameters are
neither fixnums nor 'unbound', in which case
f->size_hint_flags are set by gui_figure_window_size.
(Bug#37415)
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 34abd026f95..bb28c01795f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -5413,6 +5413,11 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 5413 | return 0; | 5413 | return 0; |
| 5414 | } | 5414 | } |
| 5415 | 5415 | ||
| 5416 | /* This function is called from the main (a.k.a. "Lisp") thread, and | ||
| 5417 | prepares the coordinates to be used by w32_createwindow (which runs | ||
| 5418 | in the input thread), when necessary. The calls to | ||
| 5419 | gui_display_get_arg must be done here, because they can cons Lisp | ||
| 5420 | objects, and that can only be done in the Lisp thread. */ | ||
| 5416 | static void | 5421 | static void |
| 5417 | my_create_window (struct frame * f) | 5422 | my_create_window (struct frame * f) |
| 5418 | { | 5423 | { |
| @@ -5421,20 +5426,33 @@ my_create_window (struct frame * f) | |||
| 5421 | Lisp_Object left, top; | 5426 | Lisp_Object left, top; |
| 5422 | struct w32_display_info *dpyinfo = &one_w32_display_info; | 5427 | struct w32_display_info *dpyinfo = &one_w32_display_info; |
| 5423 | 5428 | ||
| 5424 | /* When called with RES_TYPE_NUMBER, gui_display_get_arg will return | 5429 | /* If f->size_hint_flags is set, it means gui_figure_window_size |
| 5425 | zero for anything that is not a number and is not Qunbound. */ | 5430 | already processed the 'top' and 'left' frame parameters and set |
| 5426 | left = gui_display_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", | 5431 | f->top_pos and f->left_pos accordingly. w32_createwindow will |
| 5427 | RES_TYPE_NUMBER); | 5432 | then use those value disregarding coords[]. So we don't need to |
| 5428 | top = gui_display_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", | 5433 | compute coords[] in that case. */ |
| 5429 | RES_TYPE_NUMBER); | 5434 | if (!(f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)) |
| 5430 | if (EQ (left, Qunbound)) | 5435 | { |
| 5431 | coords[0] = CW_USEDEFAULT; | 5436 | /* When called with RES_TYPE_NUMBER, and there's no 'top' or |
| 5432 | else | 5437 | 'left' parameters in the frame's parameter alist, |
| 5433 | coords[0] = XFIXNUM (left); | 5438 | gui_display_get_arg will return zero for anything that is |
| 5434 | if (EQ (top, Qunbound)) | 5439 | neither a number nor Qunbound. If frame parameter alist does |
| 5435 | coords[1] = CW_USEDEFAULT; | 5440 | have 'left' or 'top', they are interpreted by |
| 5436 | else | 5441 | gui_figure_window_size, which was already called, and which |
| 5437 | coords[1] = XFIXNUM (top); | 5442 | sets f->size_hint_flags. */ |
| 5443 | left = gui_display_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", | ||
| 5444 | RES_TYPE_NUMBER); | ||
| 5445 | top = gui_display_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", | ||
| 5446 | RES_TYPE_NUMBER); | ||
| 5447 | if (EQ (left, Qunbound)) | ||
| 5448 | coords[0] = CW_USEDEFAULT; | ||
| 5449 | else | ||
| 5450 | coords[0] = XFIXNUM (left); | ||
| 5451 | if (EQ (top, Qunbound)) | ||
| 5452 | coords[1] = CW_USEDEFAULT; | ||
| 5453 | else | ||
| 5454 | coords[1] = XFIXNUM (top); | ||
| 5455 | } | ||
| 5438 | 5456 | ||
| 5439 | if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, | 5457 | if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, |
| 5440 | (WPARAM)f, (LPARAM)coords)) | 5458 | (WPARAM)f, (LPARAM)coords)) |