Fix crashes in a text-mode session on Windows.
src/w32console.c (initialize_w32_display): Return the dimensions of the console window via 2 additional arguments, not via the current frame. This avoids crashes due to overrunning the bounds of frame's decode_mode_spec_buffer, which is not resized following the change of the frame dimensions from the initial 10x10. src/w32term.h (w32_initialize_display_info): Adjust prototype. src/term.c (init_tty): Take dimensions of the frame from the values returned by initialize_w32_display.
This commit is contained in:
parent
7f203aa1fd
commit
9337e20653
4 changed files with 24 additions and 14 deletions
|
@ -1,5 +1,16 @@
|
|||
2013-06-03 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* w32console.c (initialize_w32_display): Return the dimensions of
|
||||
the console window via 2 additional arguments, not via the current
|
||||
frame. This avoids crashes due to overrunning the bounds of
|
||||
frame's decode_mode_spec_buffer, which is not resized following
|
||||
the change of the frame dimensions from the initial 10x10.
|
||||
|
||||
* w32term.h (w32_initialize_display_info): Adjust prototype.
|
||||
|
||||
* term.c (init_tty): Take dimensions of the frame from the values
|
||||
returned by initialize_w32_display.
|
||||
|
||||
* Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables.
|
||||
(ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS).
|
||||
(LIBES): Add $(GFILENOTIFY_LIBS).
|
||||
|
|
|
@ -3189,12 +3189,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
|
|||
#ifdef WINDOWSNT
|
||||
{
|
||||
struct frame *f = XFRAME (selected_frame);
|
||||
int height, width;
|
||||
|
||||
initialize_w32_display (terminal);
|
||||
initialize_w32_display (terminal, &width, &height);
|
||||
|
||||
FrameRows (tty) = FRAME_LINES (f);
|
||||
FrameCols (tty) = FRAME_COLS (f);
|
||||
tty->specified_window = FRAME_LINES (f);
|
||||
FrameRows (tty) = height;
|
||||
FrameCols (tty) = width;
|
||||
tty->specified_window = height;
|
||||
|
||||
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
|
||||
terminal->char_ins_del_ok = 1;
|
||||
|
|
|
@ -601,7 +601,7 @@ w32_face_attributes (struct frame *f, int face_id)
|
|||
}
|
||||
|
||||
void
|
||||
initialize_w32_display (struct terminal *term)
|
||||
initialize_w32_display (struct terminal *term, int *width, int *height)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||
Mouse_HLInfo *hlinfo;
|
||||
|
@ -722,23 +722,21 @@ initialize_w32_display (struct terminal *term)
|
|||
|| info.srWindow.Right - info.srWindow.Left < 40
|
||||
|| info.srWindow.Right - info.srWindow.Left > 100)))
|
||||
{
|
||||
FRAME_LINES (SELECTED_FRAME ()) = 25;
|
||||
SET_FRAME_COLS (SELECTED_FRAME (), 80);
|
||||
*height = 25;
|
||||
*width = 80;
|
||||
}
|
||||
|
||||
else if (w32_use_full_screen_buffer)
|
||||
{
|
||||
FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */
|
||||
SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */
|
||||
*height = info.dwSize.Y; /* lines per page */
|
||||
*width = info.dwSize.X; /* characters per line */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Lines per page. Use buffer coords instead of buffer size. */
|
||||
FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom -
|
||||
info.srWindow.Top;
|
||||
*height = 1 + info.srWindow.Bottom - info.srWindow.Top;
|
||||
/* Characters per line. Use buffer coords instead of buffer size. */
|
||||
SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right -
|
||||
info.srWindow.Left);
|
||||
*width = 1 + info.srWindow.Right - info.srWindow.Left;
|
||||
}
|
||||
|
||||
if (os_subtype == OS_NT)
|
||||
|
|
|
@ -683,7 +683,7 @@ extern Lisp_Object w32_get_watch_object (void *);
|
|||
extern Lisp_Object lispy_file_action (DWORD);
|
||||
|
||||
extern void w32_initialize_display_info (Lisp_Object);
|
||||
extern void initialize_w32_display (struct terminal *);
|
||||
extern void initialize_w32_display (struct terminal *, int *, int *);
|
||||
|
||||
/* Keypad command key support. W32 doesn't have virtual keys defined
|
||||
for the function keys on the keypad (they are mapped to the standard
|
||||
|
|
Loading…
Add table
Reference in a new issue