diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 81 | ||||
| -rw-r--r-- | src/w32term.c | 5 |
2 files changed, 52 insertions, 34 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 8dca03265b7..311f9021c85 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1677,6 +1677,12 @@ x_clear_under_internal_border (struct frame *f) | |||
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | 1679 | ||
| 1680 | /** | ||
| 1681 | * x_set_internal_border_width: | ||
| 1682 | * | ||
| 1683 | * Set width of frame F's internal border to ARG pixels. ARG < 0 is | ||
| 1684 | * treated like ARG = 0. | ||
| 1685 | */ | ||
| 1680 | void | 1686 | void |
| 1681 | x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 1687 | x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 1682 | { | 1688 | { |
| @@ -1700,44 +1706,59 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva | |||
| 1700 | } | 1706 | } |
| 1701 | 1707 | ||
| 1702 | 1708 | ||
| 1709 | /** | ||
| 1710 | * x_set_menu_bar_lines: | ||
| 1711 | * | ||
| 1712 | * Set number of lines of frame F's menu bar to VALUE. An integer | ||
| 1713 | * greater zero specifies 1 line and turns the menu bar on if it was off | ||
| 1714 | * before. Any other value specifies 0 lines and turns the menu bar off | ||
| 1715 | * if it was on before. | ||
| 1716 | */ | ||
| 1703 | void | 1717 | void |
| 1704 | x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | 1718 | x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) |
| 1705 | { | 1719 | { |
| 1706 | int nlines; | ||
| 1707 | |||
| 1708 | /* Right now, menu bars don't work properly in minibuf-only frames; | 1720 | /* Right now, menu bars don't work properly in minibuf-only frames; |
| 1709 | most of the commands try to apply themselves to the minibuffer | 1721 | most of the commands try to apply themselves to the minibuffer |
| 1710 | frame itself, and get an error because you can't switch buffers | 1722 | frame itself, and get an error because you can't switch buffers in |
| 1711 | in or split the minibuffer window. */ | 1723 | or split the minibuffer window. Child frames don't like menu bars |
| 1712 | if (FRAME_MINIBUF_ONLY_P (f) || FRAME_PARENT_FRAME (f)) | 1724 | either. */ |
| 1713 | return; | 1725 | if (!FRAME_MINIBUF_ONLY_P (f) && !FRAME_PARENT_FRAME (f)) |
| 1726 | { | ||
| 1727 | boolean old = FRAME_EXTERNAL_MENU_BAR (f); | ||
| 1728 | boolean new = (INTEGERP (value) && XINT (value) > 0) ? true : false; | ||
| 1714 | 1729 | ||
| 1715 | if (INTEGERP (value)) | 1730 | FRAME_MENU_BAR_LINES (f) = 0; |
| 1716 | nlines = XINT (value); | 1731 | FRAME_MENU_BAR_HEIGHT (f) = 0; |
| 1717 | else | ||
| 1718 | nlines = 0; | ||
| 1719 | 1732 | ||
| 1720 | FRAME_MENU_BAR_LINES (f) = 0; | 1733 | if (old != new) |
| 1721 | FRAME_MENU_BAR_HEIGHT (f) = 0; | 1734 | { |
| 1722 | if (nlines) | 1735 | FRAME_EXTERNAL_MENU_BAR (f) = new; |
| 1723 | FRAME_EXTERNAL_MENU_BAR (f) = 1; | ||
| 1724 | else | ||
| 1725 | { | ||
| 1726 | if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | ||
| 1727 | free_frame_menubar (f); | ||
| 1728 | FRAME_EXTERNAL_MENU_BAR (f) = 0; | ||
| 1729 | 1736 | ||
| 1730 | /* Adjust the frame size so that the client (text) dimensions | 1737 | if (!old) |
| 1731 | remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being | 1738 | /* Make menu bar when there was none. Emacs 25 waited until |
| 1732 | set correctly. Note that we resize twice: The first time upon | 1739 | the next redisplay for this to take effect. */ |
| 1733 | a request from the window manager who wants to keep the height | 1740 | set_frame_menubar (f, false, true); |
| 1734 | of the outer rectangle (including decorations) unchanged, and a | 1741 | else |
| 1735 | second time because we want to keep the height of the inner | 1742 | { |
| 1736 | rectangle (without the decorations unchanged). */ | 1743 | /* Remove menu bar. */ |
| 1737 | adjust_frame_size (f, -1, -1, 2, true, Qmenu_bar_lines); | 1744 | free_frame_menubar (f); |
| 1745 | |||
| 1746 | /* Adjust the frame size so that the client (text) dimensions | ||
| 1747 | remain the same. Note that we resize twice: The first time | ||
| 1748 | upon a request from the window manager who wants to keep | ||
| 1749 | the height of the outer rectangle (including decorations) | ||
| 1750 | unchanged, and a second time because we want to keep the | ||
| 1751 | height of the inner rectangle (without the decorations | ||
| 1752 | unchanged). */ | ||
| 1753 | adjust_frame_size (f, -1, -1, 2, false, Qmenu_bar_lines); | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | if (FRAME_W32_WINDOW (f)) | ||
| 1757 | x_clear_under_internal_border (f); | ||
| 1738 | 1758 | ||
| 1739 | /* Not sure whether this is needed. */ | 1759 | /* Don't store anything but 1 or 0 in the parameter. */ |
| 1740 | x_clear_under_internal_border (f); | 1760 | store_frame_param (f, Qmenu_bar_lines, make_number (new ? 1 : 0)); |
| 1761 | } | ||
| 1741 | } | 1762 | } |
| 1742 | } | 1763 | } |
| 1743 | 1764 | ||
| @@ -1820,7 +1841,7 @@ x_change_tool_bar_height (struct frame *f, int height) | |||
| 1820 | here. */ | 1841 | here. */ |
| 1821 | adjust_frame_glyphs (f); | 1842 | adjust_frame_glyphs (f); |
| 1822 | SET_FRAME_GARBAGED (f); | 1843 | SET_FRAME_GARBAGED (f); |
| 1823 | if (FRAME_X_WINDOW (f)) | 1844 | if (FRAME_W32_WINDOW (f)) |
| 1824 | x_clear_under_internal_border (f); | 1845 | x_clear_under_internal_border (f); |
| 1825 | } | 1846 | } |
| 1826 | 1847 | ||
diff --git a/src/w32term.c b/src/w32term.c index b3608accb34..a2537e204d8 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -6272,10 +6272,7 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6272 | 6272 | ||
| 6273 | /* Get the height of the menu bar here. It's used below to detect | 6273 | /* Get the height of the menu bar here. It's used below to detect |
| 6274 | whether the menu bar is wrapped. It's also used to specify the | 6274 | whether the menu bar is wrapped. It's also used to specify the |
| 6275 | third argument for AdjustWindowRect. FRAME_EXTERNAL_MENU_BAR which | 6275 | third argument for AdjustWindowRect. See bug#22105. */ |
| 6276 | has been used before for that reason is unreliable because it only | ||
| 6277 | specifies whether we _want_ a menu bar for this frame and not | ||
| 6278 | whether this frame _has_ a menu bar. See bug#22105. */ | ||
| 6279 | info.cbSize = sizeof (info); | 6276 | info.cbSize = sizeof (info); |
| 6280 | info.rcBar.top = info.rcBar.bottom = 0; | 6277 | info.rcBar.top = info.rcBar.bottom = 0; |
| 6281 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); | 6278 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); |