[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r118172: Handle wrapped menu bar lines when resizing
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] trunk r118172: Handle wrapped menu bar lines when resizing frames with Windows API. |
Date: |
Tue, 21 Oct 2014 06:58:03 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 118172
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Tue 2014-10-21 08:57:28 +0200
message:
Handle wrapped menu bar lines when resizing frames with Windows API.
* w32fns.c (Fw32_frame_menu_bar_size): New function.
* w32term.c (x_set_window_size): Account for wrapped menu bar
lines when setting up frame height (Bug#15174 and Bug#18720).
(w32_add_wrapped_menu_bar_lines): New variable.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/w32fns.c w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-10-21 01:17:06 +0000
+++ b/src/ChangeLog 2014-10-21 06:57:28 +0000
@@ -1,3 +1,10 @@
+2014-10-21 Martin Rudalics <address@hidden>
+
+ * w32fns.c (Fw32_frame_menu_bar_size): New function.
+ * w32term.c (x_set_window_size): Account for wrapped menu bar
+ lines when setting up frame height (Bug#15174 and Bug#18720).
+ (w32_add_wrapped_menu_bar_lines): New variable.
+
2014-10-21 Stefan Monnier <address@hidden>
* xdisp.c (redisplay_window): Re-run pre-redisplay-function after we
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2014-10-14 12:45:41 +0000
+++ b/src/w32fns.c 2014-10-21 06:57:28 +0000
@@ -7366,6 +7366,34 @@
return Qt;
}
+DEFUN ("w32-frame-menu-bar-size", Fw32_frame_menu_bar_size,
Sw32_frame_menu_bar_size, 0, 1, 0,
+ doc: /* Return sizes of menu bar on frame FRAME.
+The return value is a list of three elements: The current width and
+height of FRAME's menu bar in pixels and the default height of the menu
+bar in pixels. If FRAME is omitted or nil, the selected frame is
+used. */)
+ (Lisp_Object frame)
+{
+ struct frame *f = decode_any_frame (frame);
+ MENUBARINFO info;
+ int width, height, default_height;
+
+ block_input ();
+
+ default_height = GetSystemMetrics (SM_CYMENUSIZE);
+ info.cbSize = sizeof (info);
+ info.rcBar.right = info.rcBar.left = 0;
+ info.rcBar.top = info.rcBar.bottom = 0;
+ GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info);
+ width = info.rcBar.right - info.rcBar.left;
+ height = info.rcBar.bottom - info.rcBar.top;
+
+ unblock_input ();
+
+ return list3 (make_number (width), make_number (height),
+ make_number (default_height));
+}
+
DEFUN ("w32-frame-rect", Fw32_frame_rect, Sw32_frame_rect, 0, 2, 0,
doc: /* Return boundary rectangle of FRAME in screen coordinates.
FRAME must be a live frame and defaults to the selected one.
@@ -8399,6 +8427,7 @@
defsubr (&Sw32_toggle_lock_key);
defsubr (&Sw32_window_exists_p);
defsubr (&Sw32_frame_rect);
+ defsubr (&Sw32_frame_menu_bar_size);
defsubr (&Sw32_battery_status);
#ifdef WINDOWSNT
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2014-10-09 04:23:09 +0000
+++ b/src/w32term.c 2014-10-21 06:57:28 +0000
@@ -6119,6 +6119,30 @@
pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
}
+ if (w32_add_wrapped_menu_bar_lines)
+ {
+ /* When the menu bar wraps sending a SetWindowPos shrinks the
+ height of the frame when 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)
+ && ((menu_bar_height % default_menu_bar_height) == 0))
+ pixelheight = pixelheight + menu_bar_height - default_menu_bar_height;
+ }
+
f->win_gravity = NorthWestGravity;
x_wm_set_size_hint (f, (long) 0, 0);
@@ -7080,6 +7104,21 @@
Windows 8. It is set to nil on Windows 9X. */);
w32_unicode_filenames = 0;
+
+ /* FIXME: The following two variables will be (hopefully) removed
+ before Emacs 25.1 gets released. */
+
+ DEFVAR_BOOL ("w32-add-wrapped-menu-bar-lines",
+ w32_add_wrapped_menu_bar_lines,
+ doc: /* Non-nil means frame resizing accounts for wrapped menu bar lines.
+A value of nil means frame resizing does not add the height of wrapped
+menu bar lines when sending a frame resize request to the Windows API.
+This usually means that the resulting frame height is off by the number
+of wrapped menu bar lines. If this is non-nil, Emacs adds the height of
+wrapped menu bar lines when sending frame resize requests to the Windows
+API. */);
+ w32_add_wrapped_menu_bar_lines = 1;
+
DEFVAR_BOOL ("w32-enable-frame-resize-hack",
w32_enable_frame_resize_hack,
doc: /* Non-nil means enable hack for frame resizing on Windows.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r118172: Handle wrapped menu bar lines when resizing frames with Windows API.,
Martin Rudalics <=