]> git.eshelyaron.com Git - emacs.git/commitdiff
Hack frame resizing on Windows (Bug#16028).
authorMartin Rudalics <rudalics@gmx.at>
Sat, 14 Dec 2013 11:06:00 +0000 (12:06 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Sat, 14 Dec 2013 11:06:00 +0000 (12:06 +0100)
* w32term.c (w32_enable_frame_resize_hack): New variable.
(x_set_window_size): Use it to hack frame resizing on Windows
(Bug#16028).

src/ChangeLog
src/w32term.c

index df145600556e1c94839bc35bf8644c9b2479e812..80367c81166b8320e6185a330dad0ff393b94fd5 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-14  Martin Rudalics  <rudalics@gmx.at>
+
+       * w32term.c (w32_enable_frame_resize_hack): New variable.
+       (x_set_window_size): Use it to hack frame resizing on Windows
+       (Bug#16028).
+
 2013-12-14  Eli Zaretskii  <eliz@gnu.org>
 
        * fileio.c (Fcopy_file) [WINDOWSNT]: Move most of the
index 3d6b653157b9983759326795f4343f2e4fd3d287..6537b2205fe7ce4757dc740d51731aca9ea2e4a2 100644 (file)
@@ -5747,8 +5747,12 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
                       SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
   }
 
-#if 0
-  /* The following mirrors what is done in xterm.c. It appears to be
+  /* If w32_enable_frame_resize_hack is non-nil, immediately apply the
+     new pixel sizes to the frame and its subwindows.  See discussion
+     of Bug#16028 for why we need this.  */
+
+  if (w32_enable_frame_resize_hack)
+    /* The following mirrors what is done in xterm.c. It appears to be
      for informing lisp of the new size immediately, while the actual
      resize will happen asynchronously. But on Windows, the menu bar
      automatically wraps when the frame is too narrow to contain it,
@@ -5775,25 +5779,19 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
 
      We pass 1 for DELAY since we can't run Lisp code inside of
      a BLOCK_INPUT.  */
-  change_frame_size (f, width, height, 0, 1, 0, 0);
-  FRAME_PIXEL_WIDTH (f) = pixelwidth;
-  FRAME_PIXEL_HEIGHT (f) = pixelheight;
-
-  /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
-     receive in the ConfigureNotify event; if we get what we asked
-     for, then the event won't cause the screen to become garbaged, so
-     we have to make sure to do it here.  */
-  SET_FRAME_GARBAGED (f);
-
-  /* If cursor was outside the new size, mark it as off.  */
-  mark_window_cursors_off (XWINDOW (f->root_window));
-
-  /* Clear out any recollection of where the mouse highlighting was,
-     since it might be in a place that's outside the new frame size.
-     Actually checking whether it is outside is a pain in the neck,
-     so don't try--just let the highlighting be done afresh with new size.  */
-  cancel_mouse_face (f);
-#endif
+    {
+      change_frame_size (f, width, height, 0, 1, 0, pixelwise);
+      SET_FRAME_GARBAGED (f);
+
+      /* If cursor was outside the new size, mark it as off.  */
+      mark_window_cursors_off (XWINDOW (f->root_window));
+
+      /* Clear out any recollection of where the mouse highlighting was,
+        since it might be in a place that's outside the new frame size.
+        Actually checking whether it is outside is a pain in the neck,
+        so don't try--just let the highlighting be done afresh with new size.  */
+      cancel_mouse_face (f);
+    }
 
   unblock_input ();
 }
@@ -6673,6 +6671,16 @@ systems of the NT family, including W2K, XP, Vista, Windows 7 and
 Windows 8.  It is set to nil on Windows 9X.  */);
   w32_unicode_filenames = 0;
 
+  DEFVAR_BOOL ("w32-enable-frame-resize-hack",
+              w32_enable_frame_resize_hack,
+     doc: /* Non-nil means enable hack for frame resizing on Windows.
+A value of nil means to resize frames by sending a corresponding request
+to the Windows API and changing the pixel sizes of the frame and its
+windows after the latter calls back.  If this is non-nil, Emacs changes
+the pixel sizes of the frame and its windows at the time it sends the
+resize request to the API.  */);
+  w32_enable_frame_resize_hack = 0;
+
   /* Tell Emacs about this window system.  */
   Fprovide (Qw32, Qnil);
 }