emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115971: Fix handling of internal borders (Bug#16348


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r115971: Fix handling of internal borders (Bug#16348).
Date: Sat, 11 Jan 2014 09:31:32 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115971
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sat 2014-01-11 10:31:09 +0100
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
  src/xterm.h                    xterm.h-20091113204419-o5vbwnq5f7feedwu-228
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-11 03:55:50 +0000
+++ b/src/ChangeLog     2014-01-11 09:31:09 +0000
@@ -1,3 +1,26 @@
+2014-01-10  Martin Rudalics  <address@hidden>
+
+       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  <address@hidden>
 
        Fix misdisplay of interlaced GIFs with libgif5 (Bug#16372).

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2014-01-01 07:43:34 +0000
+++ b/src/dispnew.c     2014-01-11 09:31:09 +0000
@@ -2055,7 +2055,8 @@
     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 @@
      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 ();

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-01-04 09:31:30 +0000
+++ b/src/w32fns.c      2014-01-11 09:31:09 +0000
@@ -1713,26 +1713,23 @@
   /* 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);
     }
 
+  if (delta < 0 && WINDOWP (f->tool_bar_window))
+    clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
+
   run_window_configuration_change_hook (f);
-
 }
 
 

=== modified file 'src/window.c'
--- a/src/window.c      2014-01-02 15:58:48 +0000
+++ b/src/window.c      2014-01-11 09:31:09 +0000
@@ -3155,6 +3155,7 @@
        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 @@
      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

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-01-06 16:28:26 +0000
+++ b/src/xdisp.c       2014-01-11 09:31:09 +0000
@@ -12109,7 +12109,7 @@
        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;

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-01-02 15:58:48 +0000
+++ b/src/xfns.c        2014-01-11 09:31:09 +0000
@@ -998,6 +998,8 @@
   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 @@
 
   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

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2014-01-02 15:58:48 +0000
+++ b/src/xterm.c       2014-01-11 09:31:09 +0000
@@ -593,6 +593,32 @@
 }
 
 
+/* 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 @@
 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));
-
-      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 ();
-    }
+  {
+    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 ();
+      }
+  }
+#endif
 }
 
 static void
@@ -6618,7 +6648,8 @@
               || 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 @@
 #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 */
 

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2014-01-01 07:43:34 +0000
+++ b/src/xterm.h       2014-01-11 09:31:09 +0000
@@ -1049,6 +1049,10 @@
 
 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]