diff options
| author | Martin Rudalics | 2015-12-12 14:38:11 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2015-12-12 14:38:11 +0100 |
| commit | 06f00d39ff73e0c6c87ffb09ef3d67e8d3446b01 (patch) | |
| tree | 0ae87786918b3e085bff1171532f5bd222225eb8 /src | |
| parent | 4b0e4213740ef32938063e1dd79f8462112ca33c (diff) | |
| download | emacs-06f00d39ff73e0c6c87ffb09ef3d67e8d3446b01.tar.gz emacs-06f00d39ff73e0c6c87ffb09ef3d67e8d3446b01.zip | |
Fix frame height calculations with added menu bar on Windows (Bug#22105)
* doc/lispref/frames.texi (Parameter Access): Mention pitfalls
when simultaneously specifying multiple parameters for
`modify-frame-parameters' that all may change the frame's size.
* src/w32fns.c (x_set_menu_bar_lines): Don't set
windows_or_buffers_changed here.
(my_create_tip_window, Fx_show_tip): Call AdjustWindowRect
with third argument false.
* src/w32menu.c (set_frame_menubar): Set
windows_or_buffers_changed here.
* src/w32term.c (x_set_window_size): Determine third argument of
AdjustWindowRect from whether the frame has a menu bar and not
from whether it wants one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 11 | ||||
| -rw-r--r-- | src/w32menu.c | 5 | ||||
| -rw-r--r-- | src/w32term.c | 22 |
3 files changed, 21 insertions, 17 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 208c9805e91..f9ce762f0e9 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1666,10 +1666,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1666 | FRAME_MENU_BAR_LINES (f) = 0; | 1666 | FRAME_MENU_BAR_LINES (f) = 0; |
| 1667 | FRAME_MENU_BAR_HEIGHT (f) = 0; | 1667 | FRAME_MENU_BAR_HEIGHT (f) = 0; |
| 1668 | if (nlines) | 1668 | if (nlines) |
| 1669 | { | 1669 | FRAME_EXTERNAL_MENU_BAR (f) = 1; |
| 1670 | FRAME_EXTERNAL_MENU_BAR (f) = 1; | ||
| 1671 | windows_or_buffers_changed = 23; | ||
| 1672 | } | ||
| 1673 | else | 1670 | else |
| 1674 | { | 1671 | { |
| 1675 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | 1672 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) |
| @@ -4620,8 +4617,7 @@ my_create_tip_window (struct frame *f) | |||
| 4620 | rect.right = FRAME_PIXEL_WIDTH (f); | 4617 | rect.right = FRAME_PIXEL_WIDTH (f); |
| 4621 | rect.bottom = FRAME_PIXEL_HEIGHT (f); | 4618 | rect.bottom = FRAME_PIXEL_HEIGHT (f); |
| 4622 | 4619 | ||
| 4623 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, | 4620 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, false); |
| 4624 | FRAME_EXTERNAL_MENU_BAR (f)); | ||
| 4625 | 4621 | ||
| 4626 | tip_window = FRAME_W32_WINDOW (f) | 4622 | tip_window = FRAME_W32_WINDOW (f) |
| 4627 | = CreateWindow (EMACS_CLASS, | 4623 | = CreateWindow (EMACS_CLASS, |
| @@ -6681,8 +6677,7 @@ Text larger than the specified size is clipped. */) | |||
| 6681 | rect.left = rect.top = 0; | 6677 | rect.left = rect.top = 0; |
| 6682 | rect.right = width; | 6678 | rect.right = width; |
| 6683 | rect.bottom = height; | 6679 | rect.bottom = height; |
| 6684 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, | 6680 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, false); |
| 6685 | FRAME_EXTERNAL_MENU_BAR (f)); | ||
| 6686 | 6681 | ||
| 6687 | /* Position and size tooltip, and put it in the topmost group. | 6682 | /* Position and size tooltip, and put it in the topmost group. |
| 6688 | The add-on of FRAME_COLUMN_WIDTH to the 5th argument is a | 6683 | The add-on of FRAME_COLUMN_WIDTH to the 5th argument is a |
diff --git a/src/w32menu.c b/src/w32menu.c index 6af69f482d4..964b965fac1 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -494,7 +494,10 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 494 | /* Force the window size to be recomputed so that the frame's text | 494 | /* Force the window size to be recomputed so that the frame's text |
| 495 | area remains the same, if menubar has just been created. */ | 495 | area remains the same, if menubar has just been created. */ |
| 496 | if (old_widget == NULL) | 496 | if (old_widget == NULL) |
| 497 | adjust_frame_size (f, -1, -1, 2, false, Qmenu_bar_lines); | 497 | { |
| 498 | windows_or_buffers_changed = 23; | ||
| 499 | adjust_frame_size (f, -1, -1, 2, false, Qmenu_bar_lines); | ||
| 500 | } | ||
| 498 | } | 501 | } |
| 499 | 502 | ||
| 500 | unblock_input (); | 503 | unblock_input (); |
diff --git a/src/w32term.c b/src/w32term.c index f48e72553a5..0b8bef239f8 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -6115,9 +6115,22 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6115 | int pixelwidth, pixelheight; | 6115 | int pixelwidth, pixelheight; |
| 6116 | Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); | 6116 | Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); |
| 6117 | RECT rect; | 6117 | RECT rect; |
| 6118 | MENUBARINFO info; | ||
| 6119 | int menu_bar_height; | ||
| 6118 | 6120 | ||
| 6119 | block_input (); | 6121 | block_input (); |
| 6120 | 6122 | ||
| 6123 | /* Get the height of the menu bar here. It's used below to detect | ||
| 6124 | whether the menu bar is wrapped. It's also used to specify the | ||
| 6125 | third argument for AdjustWindowRect. FRAME_EXTERNAL_MENU_BAR which | ||
| 6126 | has been used before for that reason is unreliable because it only | ||
| 6127 | specifies whether we _want_ a menu bar for this frame and not | ||
| 6128 | whether this frame _has_ a menu bar. See bug#22105. */ | ||
| 6129 | info.cbSize = sizeof (info); | ||
| 6130 | info.rcBar.top = info.rcBar.bottom = 0; | ||
| 6131 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); | ||
| 6132 | menu_bar_height = info.rcBar.bottom - info.rcBar.top; | ||
| 6133 | |||
| 6121 | if (pixelwise) | 6134 | if (pixelwise) |
| 6122 | { | 6135 | { |
| 6123 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); | 6136 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); |
| @@ -6135,17 +6148,11 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6135 | height of the frame then the wrapped menu bar lines are not | 6148 | height of the frame then the wrapped menu bar lines are not |
| 6136 | accounted for (Bug#15174 and Bug#18720). Here we add these | 6149 | accounted for (Bug#15174 and Bug#18720). Here we add these |
| 6137 | extra lines to the frame height. */ | 6150 | extra lines to the frame height. */ |
| 6138 | MENUBARINFO info; | ||
| 6139 | int default_menu_bar_height; | 6151 | int default_menu_bar_height; |
| 6140 | int menu_bar_height; | ||
| 6141 | 6152 | ||
| 6142 | /* Why is (apparently) SM_CYMENUSIZE needed here instead of | 6153 | /* Why is (apparently) SM_CYMENUSIZE needed here instead of |
| 6143 | SM_CYMENU ?? */ | 6154 | SM_CYMENU ?? */ |
| 6144 | default_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE); | 6155 | default_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE); |
| 6145 | info.cbSize = sizeof (info); | ||
| 6146 | info.rcBar.top = info.rcBar.bottom = 0; | ||
| 6147 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); | ||
| 6148 | menu_bar_height = info.rcBar.bottom - info.rcBar.top; | ||
| 6149 | 6156 | ||
| 6150 | if ((default_menu_bar_height > 0) | 6157 | if ((default_menu_bar_height > 0) |
| 6151 | && (menu_bar_height > default_menu_bar_height) | 6158 | && (menu_bar_height > default_menu_bar_height) |
| @@ -6160,8 +6167,7 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6160 | rect.right = pixelwidth; | 6167 | rect.right = pixelwidth; |
| 6161 | rect.bottom = pixelheight; | 6168 | rect.bottom = pixelheight; |
| 6162 | 6169 | ||
| 6163 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, | 6170 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, menu_bar_height > 0); |
| 6164 | FRAME_EXTERNAL_MENU_BAR (f)); | ||
| 6165 | 6171 | ||
| 6166 | if (!(f->after_make_frame) | 6172 | if (!(f->after_make_frame) |
| 6167 | && !(f->want_fullscreen & FULLSCREEN_WAIT) | 6173 | && !(f->want_fullscreen & FULLSCREEN_WAIT) |