Skip to content

Commit

Permalink
Fix "emacs -nw" on MS-Windows
Browse files Browse the repository at this point in the history
* src/w32term.c (w32_flip_buffers_if_dirty): Do nothing if F is
not a GUI frame.  This avoids rare crashes in "emacs -nw".
* src/w32console.c (initialize_w32_display): Set the
ENABLE_EXTENDED_FLAGS bit in 'prev_console_mode'.
  • Loading branch information
Eli-Zaretskii committed Jan 28, 2024
1 parent c4d1690 commit e1970c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/w32console.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
/* Remember original console settings. */
keyboard_handle = GetStdHandle (STD_INPUT_HANDLE);
GetConsoleMode (keyboard_handle, &prev_console_mode);
/* Make sure ENABLE_EXTENDED_FLAGS is set in console settings,
otherwise restoring the original setting of ENABLE_MOUSE_INPUT
will not work. */
prev_console_mode |= ENABLE_EXTENDED_FLAGS;

prev_screen = GetStdHandle (STD_OUTPUT_HANDLE);

Expand Down
5 changes: 3 additions & 2 deletions src/w32term.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,13 @@ w32_buffer_flipping_unblocked_hook (struct frame *f)

/* Flip buffers on F if drawing has happened. This function is not
called to flush the display connection of a frame (which doesn't
exist on MS Windows), but also called in some situations in
exist on MS Windows), but is called in some situations in
minibuf.c to make the contents of the back buffer visible. */
void
w32_flip_buffers_if_dirty (struct frame *f)
{
if (FRAME_OUTPUT_DATA (f)->paint_buffer
if (FRAME_W32_P (f) /* do nothing in TTY frames */
&& FRAME_OUTPUT_DATA (f)->paint_buffer
&& FRAME_OUTPUT_DATA (f)->paint_buffer_dirty
&& !f->garbaged && !buffer_flipping_blocked_p ())
w32_show_back_buffer (f);
Expand Down

0 comments on commit e1970c9

Please sign in to comment.