summaryrefslogtreecommitdiff
path: root/src/w32term.c
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2015-12-12 14:38:11 +0100
committerMartin Rudalics <rudalics@gmx.at>2015-12-12 14:38:11 +0100
commit06f00d39ff73e0c6c87ffb09ef3d67e8d3446b01 (patch)
tree0ae87786918b3e085bff1171532f5bd222225eb8 /src/w32term.c
parent4b0e4213740ef32938063e1dd79f8462112ca33c (diff)
downloademacs-06f00d39ff73e0c6c87ffb09ef3d67e8d3446b01.tar.gz
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.c22
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,
int pixelwidth, pixelheight;
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
RECT rect;
+ MENUBARINFO info;
+ int menu_bar_height;
block_input ();
+ /* Get the height of the menu bar here. It's used below to detect
+ whether the menu bar is wrapped. It's also used to specify the
+ third argument for AdjustWindowRect. FRAME_EXTERNAL_MENU_BAR which
+ has been used before for that reason is unreliable because it only
+ specifies whether we _want_ a menu bar for this frame and not
+ whether this frame _has_ a menu bar. See bug#22105. */
+ info.cbSize = sizeof (info);
+ info.rcBar.top = info.rcBar.bottom = 0;
+ GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info);
+ menu_bar_height = info.rcBar.bottom - info.rcBar.top;
+
if (pixelwise)
{
pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
@@ -6135,17 +6148,11 @@ x_set_window_size (struct frame *f, bool change_gravity,
height of the frame then the wrapped menu bar lines are not
accounted for (Bug#15174 and Bug#18720). Here we add these
extra lines to the frame height. */
- MENUBARINFO info;
int default_menu_bar_height;
- int menu_bar_height;
/* Why is (apparently) SM_CYMENUSIZE needed here instead of
SM_CYMENU ?? */
default_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE);
- info.cbSize = sizeof (info);
- info.rcBar.top = info.rcBar.bottom = 0;
- GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info);
- menu_bar_height = info.rcBar.bottom - info.rcBar.top;
if ((default_menu_bar_height > 0)
&& (menu_bar_height > default_menu_bar_height)
@@ -6160,8 +6167,7 @@ x_set_window_size (struct frame *f, bool change_gravity,
rect.right = pixelwidth;
rect.bottom = pixelheight;
- AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
- FRAME_EXTERNAL_MENU_BAR (f));
+ AdjustWindowRect (&rect, f->output_data.w32->dwStyle, menu_bar_height > 0);
if (!(f->after_make_frame)
&& !(f->want_fullscreen & FULLSCREEN_WAIT)