diff options
author | Martin Rudalics <rudalics@gmx.at> | 2013-12-31 10:48:54 +0100 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2013-12-31 10:48:54 +0100 |
commit | 9b3c0a162e7876bab09c299ff4d803b632bf3ac8 (patch) | |
tree | 99d5899a5f57df9c1c1ba33cdb66cddafa4ae499 /src/xfns.c | |
parent | b29daf07584497968831af6687bf0fde2d216418 (diff) |
Some more fixes following pixelwise resize changes including one for Bug#16306.
* gtkutil.c (x_wm_set_size_hint): Have size hints respect value
of frame_resize_pixelwise.
* widget.c (pixel_to_text_size): New function.
(update_wm_hints): Have size hints respect value of
frame_resize_pixelwise.
(EmacsFrameResize): Alway process resize requests pixelwise.
* window.c (grow_mini_window): Make sure mini window is at least
one line tall.
* xdisp.c (display_menu_bar): Make sure menubar extends till
right end of frame.
* xfns.c (x_set_menu_bar_lines): Resize frame windows pixelwise.
(x_set_tool_bar_lines): Calculate pixelwise.
* xterm.c (x_wm_set_size_hint): Have size hints respect value of
frame_resize_pixelwise.
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/xfns.c b/src/xfns.c index 7200c5fb2e..3b49ab5af7 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -997,7 +997,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) #else /* not USE_X_TOOLKIT && not USE_GTK */ FRAME_MENU_BAR_LINES (f) = nlines; FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); - resize_frame_windows (f, FRAME_LINES (f), 0, 0); + resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); /* If the menu bar height gets changed, the internal border below the top margin has to be cleared. Also, if the menu bar gets @@ -1052,7 +1052,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) int nlines; #if ! defined (USE_GTK) int delta, root_height; - Lisp_Object root_window; + int unit = FRAME_LINE_HEIGHT (f); #endif /* Treat tool bars like menu bars. */ @@ -1089,20 +1089,29 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) /* Make sure we redisplay all windows in this frame. */ windows_or_buffers_changed = 60; - delta = nlines - FRAME_TOOL_BAR_LINES (f); + /* DELTA is in pixels now. */ + delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit; - /* Don't resize the tool-bar to more than we have room for. */ - root_window = FRAME_ROOT_WINDOW (f); - root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window)); - if (root_height - delta < 1) + /* Don't resize the tool-bar to more than we have room for. Note: The + calculations below and the subsequent call to resize_frame_windows + are inherently flawed because they can make the toolbar higher than + the containing frame. */ + if (delta > 0) { - delta = root_height - 1; - nlines = FRAME_TOOL_BAR_LINES (f) + delta; + root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f))); + if (root_height - delta < unit) + { + delta = root_height - unit; + /* When creating a new frame and toolbar mode is enabled, we + need at least one toolbar line. */ + nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1); + } } FRAME_TOOL_BAR_LINES (f) = nlines; FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); - resize_frame_windows (f, FRAME_LINES (f), 0, 0); + ++windows_or_buffers_changed; + resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); adjust_frame_glyphs (f); /* We also have to make sure that the internal border at the top of @@ -1124,7 +1133,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int height = FRAME_INTERNAL_BORDER_WIDTH (f); int width = FRAME_PIXEL_WIDTH (f); - int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f); + int y = nlines * unit; /* height can be zero here. */ if (height > 0 && width > 0) @@ -1139,7 +1148,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); } - run_window_configuration_change_hook (f); + run_window_configuration_change_hook (f); #endif /* USE_GTK */ } |