aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/display.texi11
-rw-r--r--doc/lispref/frames.texi55
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32term.c77
5 files changed, 117 insertions, 40 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 274d9fa4fea..047a7c6f3b7 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12014-03-14 Martin Rudalics <rudalics@gmx.at>
2
3 * display.texi (Temporary Displays): Say that
4 with-temp-buffer-window makes its buffer current.
5 * frames.texi (Size and Position): Describe new option
6 `frame-resize-pixelwise'. Rewrite descriptions of
7 `set-frame-size', `set-frame-height' and `set-frame-width'.
8
12014-03-09 Martin Rudalics <rudalics@gmx.at> 92014-03-09 Martin Rudalics <rudalics@gmx.at>
2 10
3 * elisp.texi (Top): Rename section "Width" to "Size of Displayed 11 * elisp.texi (Top): Rename section "Width" to "Size of Displayed
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index bffb840bfeb..5037f0c9032 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1175,12 +1175,11 @@ is current, and the window it was displayed in is selected.
1175@end defvar 1175@end defvar
1176 1176
1177@defmac with-temp-buffer-window buffer-or-name action quit-function forms@dots{} 1177@defmac with-temp-buffer-window buffer-or-name action quit-function forms@dots{}
1178This macro is similar to @code{with-output-to-temp-buffer}. 1178This macro is similar to @code{with-output-to-temp-buffer}. Like that
1179Like that construct, it executes @var{forms} while arranging to insert 1179construct, it executes @var{forms} while arranging to insert any output
1180any output they print into the buffer named @var{buffer-or-name}. 1180they print into the buffer named @var{buffer-or-name} and displays the
1181Finally, the buffer is displayed in some window, but not selected. 1181buffer in some window. Unlike @code{with-output-to-temp-buffer},
1182Unlike @code{with-output-to-temp-buffer}, this does not switch to Help 1182however, this makes the buffer current and does not switch to Help mode.
1183mode.
1184 1183
1185The argument @var{buffer-or-name} specifies the temporary buffer. 1184The argument @var{buffer-or-name} specifies the temporary buffer.
1186It can be either a buffer, which must already exist, or a string, 1185It can be either a buffer, which must already exist, or a string,
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 206f14e751e..59881afb903 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1147,21 +1147,46 @@ font. If you don't supply @var{frame}, these functions use the selected
1147frame. 1147frame.
1148@end defun 1148@end defun
1149 1149
1150@defun set-frame-size frame cols rows 1150@defopt frame-resize-pixelwise
1151If this option is @code{nil}, a frame's size is usually rounded to a
1152multiple of the current values of that frame's @code{frame-char-height}
1153and @code{frame-char-width}. If this is non-@code{nil}, no rounding
1154occurs, hence frame sizes can increase/decrease by one pixel.
1155
1156Setting this causes the next resize operation to pass the corresponding
1157size hints to the window manager. This means that this variable should
1158be set only in a user's initial file; applications should never bind it
1159temporarily.
1160
1161The precise semantics of a value of @code{nil} for this option depends
1162on the toolkit used: Dragging the frame border with the mouse is usually
1163always done character-wise. Calling @code{set-frame-size} (see below)
1164with arguments that do not specify the frame size as an integer multiple
1165of its character size may be, however, either ignored or cause a
1166rounding (GTK+, Windows) or get accepted (Lucid, Motif). This also
1167means that with some toolkits and a display whose size is not an
1168integral multiple of your default font, you may have to set this to
1169non-@code{nil} in order to fully maximize a frame.
1170@end defopt
1171
1172@defun set-frame-size frame width height pixelwise
1151This function sets the size of @var{frame}, measured in characters; 1173This function sets the size of @var{frame}, measured in characters;
1152@var{cols} and @var{rows} specify the new width and height. 1174@var{width} and @var{height} specify the new width in columns and the
1175new height in lines.
1153 1176
1154To set the size based on values measured in pixels, use 1177The optional argument @var{pixelwise} non-@code{nil} means to measure
1155@code{frame-char-height} and @code{frame-char-width} to convert 1178the new width and height in units of pixels instead. Note that if
1156them to units of characters. 1179@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
1180fully honor the request if it does not increase/decrease the frame size
1181to a multiple of its character size.
1157@end defun 1182@end defun
1158 1183
1159@defun set-frame-height frame lines &optional pretend 1184@defun set-frame-height frame height &optional pretend pixelwise
1160This function resizes @var{frame} to a height of @var{lines} lines. The 1185This function resizes @var{frame} to a height of @var{height} lines. The
1161sizes of existing windows in @var{frame} are altered proportionally to 1186sizes of existing windows in @var{frame} are altered proportionally to
1162fit. 1187fit.
1163 1188
1164If @var{pretend} is non-@code{nil}, then Emacs displays @var{lines} 1189If @var{pretend} is non-@code{nil}, then Emacs displays @var{height}
1165lines of output in @var{frame}, but does not change its value for the 1190lines of output in @var{frame}, but does not change its value for the
1166actual height of the frame. This is only useful on text terminals. 1191actual height of the frame. This is only useful on text terminals.
1167Using a smaller height than the terminal actually implements may be 1192Using a smaller height than the terminal actually implements may be
@@ -1170,12 +1195,24 @@ terminal malfunctions when using its whole screen. Setting the frame
1170height ``for real'' does not always work, because knowing the correct 1195height ``for real'' does not always work, because knowing the correct
1171actual size may be necessary for correct cursor positioning on 1196actual size may be necessary for correct cursor positioning on
1172text terminals. 1197text terminals.
1198
1199The optional fourth argument @var{pixelwise} non-@code{nil} means that
1200@var{frame} should be @var{height} pixels high. Note that if
1201@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
1202fully honor the request if it does not increase/decrease the frame
1203height to a multiple of its character height.
1173@end defun 1204@end defun
1174 1205
1175@defun set-frame-width frame width &optional pretend 1206@defun set-frame-width frame width &optional pretend pixelwise
1176This function sets the width of @var{frame}, measured in characters. 1207This function sets the width of @var{frame}, measured in characters.
1177The argument @var{pretend} has the same meaning as in 1208The argument @var{pretend} has the same meaning as in
1178@code{set-frame-height}. 1209@code{set-frame-height}.
1210
1211The optional fourth argument @var{pixelwise} non-@code{nil} means that
1212@var{frame} should be @var{width} pixels wide. Note that if
1213@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
1214fully honor the request if it does not increase/decrease the frame width
1215to a multiple of its character width.
1179@end defun 1216@end defun
1180 1217
1181@c FIXME? Belongs more in Emacs manual than here? 1218@c FIXME? Belongs more in Emacs manual than here?
diff --git a/src/ChangeLog b/src/ChangeLog
index 013409ff406..0512b0d9b68 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-03-14 Martin Rudalics <rudalics@gmx.at>
2
3 * w32term.c (x_set_window_size): When frame-resize-pixelwise is
4 nil, always resize character wise to avoid potential loss of the
5 mode line (Bug#16923 related).
6
12014-03-12 Martin Rudalics <rudalics@gmx.at> 72014-03-12 Martin Rudalics <rudalics@gmx.at>
2 8
3 * frame.c (x_set_frame_parameters): Always calculate new sizes 9 * frame.c (x_set_frame_parameters): Always calculate new sizes
diff --git a/src/w32term.c b/src/w32term.c
index 5c93103f2c5..2981320e136 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5648,6 +5648,31 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
5648 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); 5648 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
5649 } 5649 }
5650 5650
5651 if (!frame_resize_pixelwise)
5652 {
5653 /* If we don't resize frames pixelwise, round sizes to multiples
5654 of character sizes. Otherwise, Windows may clip our frame
5655 rectangle at a character size boundary and we risk losing our
5656 mode line. Bug#16923 might be a consequence of this.
5657
5658 So far, this is a Windows specific problem; other toolkits may
5659 prefer to not resize the frame if the delta is not large enough
5660 (GTK) or resize the frame pixelwise as requested (Lucid,
5661 Motif). Windows just doesn't call us back (probably because of
5662 the size hint settings which it apparently interprets strictly)
5663 neither when the user tries to mouse-drag a frame border by,
5664 nor when calling `set-frame-size' with a delta of less than the
5665 canonical character size. If w32_enable_frame_resize_hack is
5666 enabled (which it now is by default) we'd then below resize the
5667 frame's root window in preparation of a WM_SIZE message to come
5668 which, however, is not going to happen. */
5669 int unit_width = FRAME_COLUMN_WIDTH (f);
5670 int unit_height = FRAME_LINE_HEIGHT (f);
5671
5672 pixelwidth = (pixelwidth / unit_width) * unit_width;
5673 pixelheight = (pixelheight / unit_height) * unit_height;
5674 }
5675
5651 f->win_gravity = NorthWestGravity; 5676 f->win_gravity = NorthWestGravity;
5652 x_wm_set_size_hint (f, (long) 0, 0); 5677 x_wm_set_size_hint (f, (long) 0, 0);
5653 5678
@@ -5670,39 +5695,40 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
5670 } 5695 }
5671 5696
5672 /* If w32_enable_frame_resize_hack is non-nil, immediately apply the 5697 /* If w32_enable_frame_resize_hack is non-nil, immediately apply the
5673 new pixel sizes to the frame and its subwindows. See discussion 5698 new pixel sizes to the frame and its subwindows. This approach is
5674 of Bug#16028 for why we need this. */ 5699 fragile because Windows might not honor the resize request issued
5700 by my_set_window_pos with a WM_SIZE message (see previous comment).
5675 5701
5676 if (w32_enable_frame_resize_hack) 5702 Jason Rumney earlier refused to call change_frame_size right here
5677 /* The following mirrors what is done in xterm.c. It appears to be 5703 with the following argument:
5678 for informing lisp of the new size immediately, while the actual 5704
5679 resize will happen asynchronously. But on Windows, the menu bar 5705 The following mirrors what is done in xterm.c. It appears to be for
5680 automatically wraps when the frame is too narrow to contain it, 5706 informing lisp of the new size immediately, while the actual resize
5681 and that causes any calculations made here to come out wrong. The 5707 will happen asynchronously. But on Windows, the menu bar
5682 end is some nasty buggy behavior, including the potential loss 5708 automatically wraps when the frame is too narrow to contain it, and
5683 of the minibuffer. 5709 that causes any calculations made here to come out wrong. The end
5710 is some nasty buggy behavior, including the potential loss of the
5711 minibuffer.
5684 5712
5685 Disabling this code is either not sufficient to fix the problems 5713 Disabling this code is either not sufficient to fix the problems
5686 completely, or it causes fresh problems, but at least it removes 5714 completely, or it causes fresh problems, but at least it removes
5687 the most problematic symptom of the minibuffer becoming unusable. 5715 the most problematic symptom of the minibuffer becoming unusable.
5688 5716
5689 ----------------------------------------------------------------- 5717 However, as the discussion about how to handle frame size
5690 5718 parameters on Windows (Bug#1348, Bug#16028) shows, that cure seems
5691 Now, strictly speaking, we can't be sure that this is accurate, 5719 worse than the disease. In particular, menu bar wrapping looks
5692 but the window manager will get around to dealing with the size 5720 like a non-issue - maybe so because Windows eventually gets back to
5693 change request eventually, and we'll hear how it went when the 5721 us with the correct client rectangle anyway. But we have to avoid
5694 ConfigureNotify event gets here. 5722 calling change_frame_size with a delta of less than one canoncial
5723 character size when frame_resize_pixelwise is nil, as explained in
5724 the comment above. */
5695 5725
5696 We could just not bother storing any of this information here, 5726 if (w32_enable_frame_resize_hack)
5697 and let the ConfigureNotify event set everything up, but that
5698 might be kind of confusing to the Lisp code, since size changes
5699 wouldn't be reported in the frame parameters until some random
5700 point in the future when the ConfigureNotify event arrives.
5701 5727
5702 We pass 1 for DELAY since we can't run Lisp code inside of
5703 a BLOCK_INPUT. */
5704 { 5728 {
5705 change_frame_size (f, width, height, 0, 1, 0, pixelwise); 5729 change_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, pixelwidth),
5730 FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelheight),
5731 0, 1, 0, 1);
5706 SET_FRAME_GARBAGED (f); 5732 SET_FRAME_GARBAGED (f);
5707 5733
5708 /* If cursor was outside the new size, mark it as off. */ 5734 /* If cursor was outside the new size, mark it as off. */
@@ -5711,7 +5737,8 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
5711 /* Clear out any recollection of where the mouse highlighting was, 5737 /* Clear out any recollection of where the mouse highlighting was,
5712 since it might be in a place that's outside the new frame size. 5738 since it might be in a place that's outside the new frame size.
5713 Actually checking whether it is outside is a pain in the neck, 5739 Actually checking whether it is outside is a pain in the neck,
5714 so don't try--just let the highlighting be done afresh with new size. */ 5740 so don't try--just let the highlighting be done afresh with new
5741 size. */
5715 cancel_mouse_face (f); 5742 cancel_mouse_face (f);
5716 } 5743 }
5717 5744