]> git.eshelyaron.com Git - emacs.git/commitdiff
(maybe_generate_resize_event): Detect changes in the
authorAndrew Innes <andrewi@gnu.org>
Sat, 22 May 1999 17:38:01 +0000 (17:38 +0000)
committerAndrew Innes <andrewi@gnu.org>
Sat, 22 May 1999 17:38:01 +0000 (17:38 +0000)
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).

src/w32inevt.c

index ce20bd452d801f85fc57de6aec0989b304bfd3c2..2a2cf63b17e876946a78a588340e3a47f43d7986 100644 (file)
@@ -620,6 +620,22 @@ resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
   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 @@ w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
              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 @@ w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
       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;
 }