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/w32term.c | |
| 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/w32term.c')
| -rw-r--r-- | src/w32term.c | 22 |
1 files changed, 14 insertions, 8 deletions
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) |