From: Martin Rudalics Date: Sat, 11 Jan 2014 09:31:09 +0000 (+0100) Subject: Fix handling of internal borders (Bug#16348). X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~6^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7d7ccb8829db98eca38cd2bfb31132a7f1adc022;p=emacs.git Fix handling of internal borders (Bug#16348). * dispnew.c (adjust_frame_glyphs_for_window_redisplay): Remove internal border width from pixel width of windows. (change_frame_size_1): Don't return early when frame's pixel size changes - we still have to record the new sizes in the frame structure. * w32fns.c (x_set_tool_bar_lines): Clear internal border width also when toolbar gets larger. * window.c (check_frame_size): Include internal_border_width in check. * xdisp.c (Ftool_bar_height): Fix doc-string typo. * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): In non-toolkit/non-GTK version clear internal border. * xterm.c (x_clear_under_internal_border): New function for non-toolkit/non-GTK version. (x_after_update_window_line): In non-toolkit/non-GTK version don't do that. (handle_one_xevent, x_set_window_size): Call x_clear_under_internal_border in non-toolkit/non-GTK version. * xterm.h (x_clear_under_internal_border): Extern it. --- diff --git a/src/ChangeLog b/src/ChangeLog index 9be8ee136e4..d015326e5ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2014-01-10 Martin Rudalics + + Fix handling of internal borders (Bug#16348). + * dispnew.c (adjust_frame_glyphs_for_window_redisplay): Remove + internal border width from pixel width of windows. + (change_frame_size_1): Don't return early when frame's pixel + size changes - we still have to record the new sizes in the + frame structure. + * w32fns.c (x_set_tool_bar_lines): Clear internal border width + also when toolbar gets larger. + * window.c (check_frame_size): Include internal_border_width in + check. + * xdisp.c (Ftool_bar_height): Fix doc-string typo. + * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): In + non-toolkit/non-GTK version clear internal border. + * xterm.c (x_clear_under_internal_border): New function for + non-toolkit/non-GTK version. + (x_after_update_window_line): In non-toolkit/non-GTK version + don't do that. + (handle_one_xevent, x_set_window_size): Call + x_clear_under_internal_border in non-toolkit/non-GTK version. + * xterm.h (x_clear_under_internal_border): Extern it. + 2014-01-07 Paul Eggert Fix misdisplay of interlaced GIFs with libgif5 (Bug#16372). diff --git a/src/dispnew.c b/src/dispnew.c index c3cca33b187..e11d143d0b5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2055,7 +2055,8 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) w->left_col = 0; w->pixel_top = 0; w->top_line = 0; - w->pixel_width = FRAME_PIXEL_WIDTH (f); + w->pixel_width = (FRAME_PIXEL_WIDTH (f) + - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); w->total_cols = FRAME_TOTAL_COLS (f); w->pixel_height = FRAME_MENU_BAR_HEIGHT (f); w->total_lines = FRAME_MENU_BAR_LINES (f); @@ -5515,7 +5516,11 @@ change_frame_size_1 (struct frame *f, int new_width, int new_height, example, fullscreen and remove/add scroll bar. */ if (new_text_height == FRAME_TEXT_HEIGHT (f) && new_text_width == FRAME_TEXT_WIDTH (f) - && new_root_width == old_root_width) + && new_root_width == old_root_width + && (FRAME_PIXEL_HEIGHT (f) == + FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height)) + && (FRAME_PIXEL_WIDTH (f) == + FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width))) return; block_input (); diff --git a/src/w32fns.c b/src/w32fns.c index 03779be036c..d6f3fe7a3eb 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1713,26 +1713,23 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) /* If the tool bar gets smaller, the internal border below it has to be cleared. It was formerly part of the display of the larger tool bar, and updating windows won't clear it. */ - if (delta < 0) + if (FRAME_INTERNAL_BORDER_WIDTH (f) != 0) { int height = FRAME_INTERNAL_BORDER_WIDTH (f); int width = FRAME_PIXEL_WIDTH (f); int y = nlines * unit; + HDC hdc = get_frame_dc (f); block_input (); - { - HDC hdc = get_frame_dc (f); - w32_clear_area (f, hdc, 0, y, width, height); - release_frame_dc (f, hdc); - } + w32_clear_area (f, hdc, 0, y, width, height); + release_frame_dc (f, hdc); unblock_input (); - - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); } - run_window_configuration_change_hook (f); + if (delta < 0 && WINDOWP (f->tool_bar_window)) + clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); + run_window_configuration_change_hook (f); } diff --git a/src/window.c b/src/window.c index f85627ac49f..bd319f5be8f 100644 --- a/src/window.c +++ b/src/window.c @@ -3155,6 +3155,7 @@ check_frame_size (struct frame *frame, int *width, int *height, bool pixelwise) min_height = 2 * min_height; min_height += FRAME_TOP_MARGIN_HEIGHT (frame); + min_height += FRAME_INTERNAL_BORDER_WIDTH (frame); if (*height < min_height) *height = min_height; @@ -4047,6 +4048,8 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) have implicitly given us a zero or negative height. */ if (pixelwise) { + /* Note: This does not include the size for internal borders + since these are not part of the frame's text area. */ new_pixel_size = max (horflag ? size : (size diff --git a/src/xdisp.c b/src/xdisp.c index 404c8a61e52..de553a71f97 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12109,7 +12109,7 @@ DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height, 0, 2, 0, doc: /* Return the number of lines occupied by the tool bar of FRAME. If FRAME is nil or omitted, use the selected frame. Optional argument -PIXELWISE non-nil means return the height of the tool bar inpixels. */) +PIXELWISE non-nil means return the height of the tool bar in pixels. */) (Lisp_Object frame, Lisp_Object pixelwise) { int height = 0; diff --git a/src/xfns.c b/src/xfns.c index a78c2bf6b76..debc707dba2 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -998,6 +998,8 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) FRAME_MENU_BAR_LINES (f) = nlines; FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); + if (FRAME_X_WINDOW (f)) + x_clear_under_internal_border (f); /* If the menu bar height gets changed, the internal border below the top margin has to be cleared. Also, if the menu bar gets @@ -1110,8 +1112,11 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) FRAME_TOOL_BAR_LINES (f) = nlines; FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); - ++windows_or_buffers_changed; resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); +#if !defined USE_X_TOOLKIT && !defined USE_GTK + if (FRAME_X_WINDOW (f)) + x_clear_under_internal_border (f); +#endif adjust_frame_glyphs (f); /* We also have to make sure that the internal border at the top of diff --git a/src/xterm.c b/src/xterm.c index f47d73cf7ed..105aaed2972 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -593,6 +593,32 @@ XTframe_up_to_date (struct frame *f) } +/* Clear under internal border if any for non-toolkit builds. */ + + +#if !defined USE_X_TOOLKIT && !defined USE_GTK +void +x_clear_under_internal_border (struct frame *f) +{ + if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) + { + Display *display = FRAME_X_DISPLAY (f); + Window window = FRAME_X_WINDOW (f); + int border = FRAME_INTERNAL_BORDER_WIDTH (f); + int width = FRAME_PIXEL_WIDTH (f); + int height = FRAME_PIXEL_HEIGHT (f); + int margin = FRAME_TOP_MARGIN_HEIGHT (f); + + block_input (); + x_clear_area (display, window, 0, 0, border, height); + x_clear_area (display, window, 0, margin, width, border); + x_clear_area (display, window, width - border, 0, border, height); + x_clear_area (display, window, 0, height - border, width, border); + unblock_input (); + } +} +#endif + /* Draw truncation mark bitmaps, continuation mark bitmaps, overlay arrow bitmaps, or clear the fringes if no bitmaps are required before DESIRED_ROW is made current. This function is called from @@ -602,38 +628,42 @@ XTframe_up_to_date (struct frame *f) static void x_after_update_window_line (struct window *w, struct glyph_row *desired_row) { - struct frame *f; - int width, height; - eassert (w); if (!desired_row->mode_line_p && !w->pseudo_window_p) desired_row->redraw_fringe_bitmaps_p = 1; +#ifdef USE_X_TOOLKIT /* When a window has disappeared, make sure that no rest of full-width rows stays visible in the internal border. Could check here if updated window is the leftmost/rightmost window, but I guess it's not worth doing since vertically split windows are almost never used, internal border is rarely set, and the overhead is very small. */ - if (windows_or_buffers_changed - && desired_row->full_width_p - && (f = XFRAME (w->frame), - width = FRAME_INTERNAL_BORDER_WIDTH (f), - width != 0) - && (height = desired_row->visible_height, - height > 0)) - { - int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); + { + struct frame *f; + int width, height; + + if (windows_or_buffers_changed + && desired_row->full_width_p + && (f = XFRAME (w->frame), + width = FRAME_INTERNAL_BORDER_WIDTH (f), + width != 0) + && (height = desired_row->visible_height, + height > 0)) + { + int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); - block_input (); - x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - 0, y, width, height); - x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - FRAME_PIXEL_WIDTH (f) - width, - y, width, height); - unblock_input (); - } + block_input (); + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + 0, y, width, height); + x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_PIXEL_WIDTH (f) - width, + y, width, height); + unblock_input (); + } + } +#endif } static void @@ -6618,7 +6648,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f)) { change_frame_size (f, width, height, 0, 1, 0, 1); - SET_FRAME_GARBAGED (f); + x_clear_under_internal_border (f); + SET_FRAME_GARBAGED (f); cancel_mouse_face (f); } @@ -8635,6 +8666,9 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b #else /* not USE_GTK */ x_set_window_size_1 (f, change_gravity, width, height, pixelwise); +#if !defined USE_X_TOOLKIT + x_clear_under_internal_border (f); +#endif #endif /* not USE_GTK */ diff --git a/src/xterm.h b/src/xterm.h index 7278f990528..3e79d46702c 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1049,6 +1049,10 @@ extern void x_session_close (void); extern Lisp_Object Qx_gtk_map_stock; +#if !defined USE_X_TOOLKIT && !defined USE_GTK +extern void x_clear_under_internal_border (struct frame *f); +#endif + /* Is the frame embedded into another application? */ #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)