diff options
| author | Martin Rudalics | 2014-03-14 11:38:46 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-03-14 11:38:46 +0100 |
| commit | cfd5e825ae51150889b3a5d1b46d617cdab85b23 (patch) | |
| tree | 8ba3f46a76a4a0ebb83f3ca7a37d66142ae265d3 /src | |
| parent | 56759cf12aeea9a51020ad19784d6ca6c55ab36e (diff) | |
| download | emacs-cfd5e825ae51150889b3a5d1b46d617cdab85b23.tar.gz emacs-cfd5e825ae51150889b3a5d1b46d617cdab85b23.zip | |
Document pixelwise frame resizing and fix related bug on Windows.
* w32term.c (x_set_window_size): When frame-resize-pixelwise is
nil, always resize character wise to avoid potential loss of the
mode line (Bug#16923 related).
* display.texi (Temporary Displays): Say that
with-temp-buffer-window makes its buffer current.
* frames.texi (Size and Position): Describe new option
`frame-resize-pixelwise'. Rewrite descriptions of
`set-frame-size', `set-frame-height' and `set-frame-width'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32term.c | 77 |
2 files changed, 58 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 013409ff406..0512b0d9b68 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-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 | |||
| 1 | 2014-03-12 Martin Rudalics <rudalics@gmx.at> | 7 | 2014-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 | ||