changeset 24756:4582b492a651

(maybe_generate_resize_event): Detect changes in the console window size. (w32_console_read_socket): Call maybe_generate_resize_event whenever input events are received, since we don't get told when the window size changes (as opposed to the buffer size, which we don't care about).
author Andrew Innes <andrewi@gnu.org>
date Sat, 22 May 1999 17:38:01 +0000
parents 3bb855a40bf6
children f4127409d184
files src/w32inevt.c
diffstat 1 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32inevt.c	Sat May 22 17:37:18 1999 +0000
+++ b/src/w32inevt.c	Sat May 22 17:38:01 1999 +0000
@@ -620,6 +620,22 @@
   SET_FRAME_GARBAGED (f);
 }
 
+static void
+maybe_generate_resize_event ()
+{
+  CONSOLE_SCREEN_BUFFER_INFO info;
+  FRAME_PTR f = get_frame ();
+
+  GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
+
+  /* It is okay to call this unconditionally, since it will do nothing
+     if the size hasn't actually changed.  */
+  change_frame_size (f,
+		     1 + info.srWindow.Bottom - info.srWindow.Top,
+		     1 + info.srWindow.Right - info.srWindow.Left,
+		     0, 0);
+}
+
 int 
 w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
 			 int expected)
@@ -672,9 +688,11 @@
 	      numchars -= add;
 	      break;
 
+#if 0
             case WINDOW_BUFFER_SIZE_EVENT:
 	      resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
 	      break;
+#endif
             
             case MENU_EVENT:
             case FOCUS_EVENT:
@@ -689,7 +707,12 @@
       if (ret > 0 || expected == 0)
 	break;
     }
-  
+
+  /* We don't get told about changes in the window size (only the buffer
+     size, which we no longer care about), so we have to check it
+     periodically.  */
+  maybe_generate_resize_event ();
+
   UNBLOCK_INPUT;
   return ret;
 }