]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix handling of internal borders (Bug#16348).
authorMartin Rudalics <rudalics@gmx.at>
Sat, 11 Jan 2014 09:31:09 +0000 (10:31 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Sat, 11 Jan 2014 09:31:09 +0000 (10:31 +0100)
* 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.

src/ChangeLog
src/dispnew.c
src/w32fns.c
src/window.c
src/xdisp.c
src/xfns.c
src/xterm.c
src/xterm.h

index 9be8ee136e4d2c0f5aa200dfa4abb8761e141b70..d015326e5eae87ddaeecf67edf762e52be20710c 100644 (file)
@@ -1,3 +1,26 @@
+2014-01-10  Martin Rudalics  <rudalics@gmx.at>
+
+       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  <eggert@cs.ucla.edu>
 
        Fix misdisplay of interlaced GIFs with libgif5 (Bug#16372).
index c3cca33b187617ee2ac3a6adbd26acd3ec6fae37..e11d143d0b5bc5e85c0a86d9fc0dab8da3878e4e 100644 (file)
@@ -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 ();
index 03779be036ccccc81f277a65c9cacbb13bc7113d..d6f3fe7a3eb3a03d7f6288c79063324c279b9a59 100644 (file)
@@ -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);
 }
 
 
index f85627ac49f2613c50cf2dcfbb65f684e84a3d99..bd319f5be8f39a1d86429682ddfd9a3fc36c68d1 100644 (file)
@@ -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
index 404c8a61e529b29577745675f4bd028d5d51e1f2..de553a71f977c17d028fe8b06717614a75b301cf 100644 (file)
@@ -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;
index a78c2bf6b769148db9be9ff6da0626d1ff634c5d..debc707dba28259a884166f52940598a6f1e908c 100644 (file)
@@ -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
index f47d73cf7ed2c5562f15f52073eb9deeeaf83c0f..105aaed297251ad19240ef96d5a8eeaef3e525f8 100644 (file)
@@ -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 */
 
index 7278f990528d8d23d1598a16aa6bb60ee36393a6..3e79d46702c60a4bf588331388abfdc479cac780 100644 (file)
@@ -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)