aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2014-01-11 10:31:09 +0100
committerMartin Rudalics2014-01-11 10:31:09 +0100
commit7d7ccb8829db98eca38cd2bfb31132a7f1adc022 (patch)
treea10aca13dd3d5c942f3eacf52942ef128433cb30
parentbada50fc50d34e0e2ffd00fd64957cfb397c6eee (diff)
downloademacs-7d7ccb8829db98eca38cd2bfb31132a7f1adc022.tar.gz
emacs-7d7ccb8829db98eca38cd2bfb31132a7f1adc022.zip
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.
-rw-r--r--src/ChangeLog23
-rw-r--r--src/dispnew.c9
-rw-r--r--src/w32fns.c17
-rw-r--r--src/window.c3
-rw-r--r--src/xdisp.c2
-rw-r--r--src/xfns.c7
-rw-r--r--src/xterm.c76
-rw-r--r--src/xterm.h4
8 files changed, 106 insertions, 35 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9be8ee136e4..d015326e5ea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,26 @@
12014-01-10 Martin Rudalics <rudalics@gmx.at>
2
3 Fix handling of internal borders (Bug#16348).
4 * dispnew.c (adjust_frame_glyphs_for_window_redisplay): Remove
5 internal border width from pixel width of windows.
6 (change_frame_size_1): Don't return early when frame's pixel
7 size changes - we still have to record the new sizes in the
8 frame structure.
9 * w32fns.c (x_set_tool_bar_lines): Clear internal border width
10 also when toolbar gets larger.
11 * window.c (check_frame_size): Include internal_border_width in
12 check.
13 * xdisp.c (Ftool_bar_height): Fix doc-string typo.
14 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): In
15 non-toolkit/non-GTK version clear internal border.
16 * xterm.c (x_clear_under_internal_border): New function for
17 non-toolkit/non-GTK version.
18 (x_after_update_window_line): In non-toolkit/non-GTK version
19 don't do that.
20 (handle_one_xevent, x_set_window_size): Call
21 x_clear_under_internal_border in non-toolkit/non-GTK version.
22 * xterm.h (x_clear_under_internal_border): Extern it.
23
12014-01-07 Paul Eggert <eggert@cs.ucla.edu> 242014-01-07 Paul Eggert <eggert@cs.ucla.edu>
2 25
3 Fix misdisplay of interlaced GIFs with libgif5 (Bug#16372). 26 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)
2055 w->left_col = 0; 2055 w->left_col = 0;
2056 w->pixel_top = 0; 2056 w->pixel_top = 0;
2057 w->top_line = 0; 2057 w->top_line = 0;
2058 w->pixel_width = FRAME_PIXEL_WIDTH (f); 2058 w->pixel_width = (FRAME_PIXEL_WIDTH (f)
2059 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
2059 w->total_cols = FRAME_TOTAL_COLS (f); 2060 w->total_cols = FRAME_TOTAL_COLS (f);
2060 w->pixel_height = FRAME_MENU_BAR_HEIGHT (f); 2061 w->pixel_height = FRAME_MENU_BAR_HEIGHT (f);
2061 w->total_lines = FRAME_MENU_BAR_LINES (f); 2062 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,
5515 example, fullscreen and remove/add scroll bar. */ 5516 example, fullscreen and remove/add scroll bar. */
5516 if (new_text_height == FRAME_TEXT_HEIGHT (f) 5517 if (new_text_height == FRAME_TEXT_HEIGHT (f)
5517 && new_text_width == FRAME_TEXT_WIDTH (f) 5518 && new_text_width == FRAME_TEXT_WIDTH (f)
5518 && new_root_width == old_root_width) 5519 && new_root_width == old_root_width
5520 && (FRAME_PIXEL_HEIGHT (f) ==
5521 FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height))
5522 && (FRAME_PIXEL_WIDTH (f) ==
5523 FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width)))
5519 return; 5524 return;
5520 5525
5521 block_input (); 5526 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)
1713 /* If the tool bar gets smaller, the internal border below it 1713 /* If the tool bar gets smaller, the internal border below it
1714 has to be cleared. It was formerly part of the display 1714 has to be cleared. It was formerly part of the display
1715 of the larger tool bar, and updating windows won't clear it. */ 1715 of the larger tool bar, and updating windows won't clear it. */
1716 if (delta < 0) 1716 if (FRAME_INTERNAL_BORDER_WIDTH (f) != 0)
1717 { 1717 {
1718 int height = FRAME_INTERNAL_BORDER_WIDTH (f); 1718 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
1719 int width = FRAME_PIXEL_WIDTH (f); 1719 int width = FRAME_PIXEL_WIDTH (f);
1720 int y = nlines * unit; 1720 int y = nlines * unit;
1721 HDC hdc = get_frame_dc (f);
1721 1722
1722 block_input (); 1723 block_input ();
1723 { 1724 w32_clear_area (f, hdc, 0, y, width, height);
1724 HDC hdc = get_frame_dc (f); 1725 release_frame_dc (f, hdc);
1725 w32_clear_area (f, hdc, 0, y, width, height);
1726 release_frame_dc (f, hdc);
1727 }
1728 unblock_input (); 1726 unblock_input ();
1729
1730 if (WINDOWP (f->tool_bar_window))
1731 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
1732 } 1727 }
1733 1728
1734 run_window_configuration_change_hook (f); 1729 if (delta < 0 && WINDOWP (f->tool_bar_window))
1730 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
1735 1731
1732 run_window_configuration_change_hook (f);
1736} 1733}
1737 1734
1738 1735
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)
3155 min_height = 2 * min_height; 3155 min_height = 2 * min_height;
3156 3156
3157 min_height += FRAME_TOP_MARGIN_HEIGHT (frame); 3157 min_height += FRAME_TOP_MARGIN_HEIGHT (frame);
3158 min_height += FRAME_INTERNAL_BORDER_WIDTH (frame);
3158 3159
3159 if (*height < min_height) 3160 if (*height < min_height)
3160 *height = min_height; 3161 *height = min_height;
@@ -4047,6 +4048,8 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4047 have implicitly given us a zero or negative height. */ 4048 have implicitly given us a zero or negative height. */
4048 if (pixelwise) 4049 if (pixelwise)
4049 { 4050 {
4051 /* Note: This does not include the size for internal borders
4052 since these are not part of the frame's text area. */
4050 new_pixel_size = max (horflag 4053 new_pixel_size = max (horflag
4051 ? size 4054 ? size
4052 : (size 4055 : (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,
12109 0, 2, 0, 12109 0, 2, 0,
12110 doc: /* Return the number of lines occupied by the tool bar of FRAME. 12110 doc: /* Return the number of lines occupied by the tool bar of FRAME.
12111If FRAME is nil or omitted, use the selected frame. Optional argument 12111If FRAME is nil or omitted, use the selected frame. Optional argument
12112PIXELWISE non-nil means return the height of the tool bar inpixels. */) 12112PIXELWISE non-nil means return the height of the tool bar in pixels. */)
12113 (Lisp_Object frame, Lisp_Object pixelwise) 12113 (Lisp_Object frame, Lisp_Object pixelwise)
12114{ 12114{
12115 int height = 0; 12115 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)
998 FRAME_MENU_BAR_LINES (f) = nlines; 998 FRAME_MENU_BAR_LINES (f) = nlines;
999 FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); 999 FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
1000 resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); 1000 resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
1001 if (FRAME_X_WINDOW (f))
1002 x_clear_under_internal_border (f);
1001 1003
1002 /* If the menu bar height gets changed, the internal border below 1004 /* If the menu bar height gets changed, the internal border below
1003 the top margin has to be cleared. Also, if the menu bar gets 1005 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)
1110 1112
1111 FRAME_TOOL_BAR_LINES (f) = nlines; 1113 FRAME_TOOL_BAR_LINES (f) = nlines;
1112 FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); 1114 FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
1113 ++windows_or_buffers_changed;
1114 resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); 1115 resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
1116#if !defined USE_X_TOOLKIT && !defined USE_GTK
1117 if (FRAME_X_WINDOW (f))
1118 x_clear_under_internal_border (f);
1119#endif
1115 adjust_frame_glyphs (f); 1120 adjust_frame_glyphs (f);
1116 1121
1117 /* We also have to make sure that the internal border at the top of 1122 /* 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)
593} 593}
594 594
595 595
596/* Clear under internal border if any for non-toolkit builds. */
597
598
599#if !defined USE_X_TOOLKIT && !defined USE_GTK
600void
601x_clear_under_internal_border (struct frame *f)
602{
603 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
604 {
605 Display *display = FRAME_X_DISPLAY (f);
606 Window window = FRAME_X_WINDOW (f);
607 int border = FRAME_INTERNAL_BORDER_WIDTH (f);
608 int width = FRAME_PIXEL_WIDTH (f);
609 int height = FRAME_PIXEL_HEIGHT (f);
610 int margin = FRAME_TOP_MARGIN_HEIGHT (f);
611
612 block_input ();
613 x_clear_area (display, window, 0, 0, border, height);
614 x_clear_area (display, window, 0, margin, width, border);
615 x_clear_area (display, window, width - border, 0, border, height);
616 x_clear_area (display, window, 0, height - border, width, border);
617 unblock_input ();
618 }
619}
620#endif
621
596/* Draw truncation mark bitmaps, continuation mark bitmaps, overlay 622/* Draw truncation mark bitmaps, continuation mark bitmaps, overlay
597 arrow bitmaps, or clear the fringes if no bitmaps are required 623 arrow bitmaps, or clear the fringes if no bitmaps are required
598 before DESIRED_ROW is made current. This function is called from 624 before DESIRED_ROW is made current. This function is called from
@@ -602,38 +628,42 @@ XTframe_up_to_date (struct frame *f)
602static void 628static void
603x_after_update_window_line (struct window *w, struct glyph_row *desired_row) 629x_after_update_window_line (struct window *w, struct glyph_row *desired_row)
604{ 630{
605 struct frame *f;
606 int width, height;
607
608 eassert (w); 631 eassert (w);
609 632
610 if (!desired_row->mode_line_p && !w->pseudo_window_p) 633 if (!desired_row->mode_line_p && !w->pseudo_window_p)
611 desired_row->redraw_fringe_bitmaps_p = 1; 634 desired_row->redraw_fringe_bitmaps_p = 1;
612 635
636#ifdef USE_X_TOOLKIT
613 /* When a window has disappeared, make sure that no rest of 637 /* When a window has disappeared, make sure that no rest of
614 full-width rows stays visible in the internal border. Could 638 full-width rows stays visible in the internal border. Could
615 check here if updated window is the leftmost/rightmost window, 639 check here if updated window is the leftmost/rightmost window,
616 but I guess it's not worth doing since vertically split windows 640 but I guess it's not worth doing since vertically split windows
617 are almost never used, internal border is rarely set, and the 641 are almost never used, internal border is rarely set, and the
618 overhead is very small. */ 642 overhead is very small. */
619 if (windows_or_buffers_changed 643 {
620 && desired_row->full_width_p 644 struct frame *f;
621 && (f = XFRAME (w->frame), 645 int width, height;
622 width = FRAME_INTERNAL_BORDER_WIDTH (f), 646
623 width != 0) 647 if (windows_or_buffers_changed
624 && (height = desired_row->visible_height, 648 && desired_row->full_width_p
625 height > 0)) 649 && (f = XFRAME (w->frame),
626 { 650 width = FRAME_INTERNAL_BORDER_WIDTH (f),
627 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 651 width != 0)
652 && (height = desired_row->visible_height,
653 height > 0))
654 {
655 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
628 656
629 block_input (); 657 block_input ();
630 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 658 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
631 0, y, width, height); 659 0, y, width, height);
632 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 660 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
633 FRAME_PIXEL_WIDTH (f) - width, 661 FRAME_PIXEL_WIDTH (f) - width,
634 y, width, height); 662 y, width, height);
635 unblock_input (); 663 unblock_input ();
636 } 664 }
665 }
666#endif
637} 667}
638 668
639static void 669static void
@@ -6618,7 +6648,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6618 || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f)) 6648 || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f))
6619 { 6649 {
6620 change_frame_size (f, width, height, 0, 1, 0, 1); 6650 change_frame_size (f, width, height, 0, 1, 0, 1);
6621 SET_FRAME_GARBAGED (f); 6651 x_clear_under_internal_border (f);
6652 SET_FRAME_GARBAGED (f);
6622 cancel_mouse_face (f); 6653 cancel_mouse_face (f);
6623 } 6654 }
6624 6655
@@ -8635,6 +8666,9 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
8635#else /* not USE_GTK */ 8666#else /* not USE_GTK */
8636 8667
8637 x_set_window_size_1 (f, change_gravity, width, height, pixelwise); 8668 x_set_window_size_1 (f, change_gravity, width, height, pixelwise);
8669#if !defined USE_X_TOOLKIT
8670 x_clear_under_internal_border (f);
8671#endif
8638 8672
8639#endif /* not USE_GTK */ 8673#endif /* not USE_GTK */
8640 8674
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);
1049 1049
1050extern Lisp_Object Qx_gtk_map_stock; 1050extern Lisp_Object Qx_gtk_map_stock;
1051 1051
1052#if !defined USE_X_TOOLKIT && !defined USE_GTK
1053extern void x_clear_under_internal_border (struct frame *f);
1054#endif
1055
1052/* Is the frame embedded into another application? */ 1056/* Is the frame embedded into another application? */
1053 1057
1054#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0) 1058#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)