]> git.eshelyaron.com Git - emacs.git/commitdiff
* window.h (WINDOW_FRINGE_EXTENDED_P): New macro.
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 13 Aug 2013 15:29:25 +0000 (19:29 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 13 Aug 2013 15:29:25 +0000 (19:29 +0400)
* nsterm.m (ns_set_vertical_scroll_bar): Use it.  Use convenient
bool instead of BOOL.
* w32term.h (struct scroll_bar): Convert fringe_extended_p
from Lisp_Object to bitfield.  Adjust comment.
* w32term.c (x_scroll_bar_create): Adjust user.
Use WINDOW_FRINGE_EXTENDED_P and bool for boolean.
* xterm.c (XTset_vertical_scroll_bar): Likewise.
Use bool for boolean.
* xterm.h (struct scroll_bar): Prefer commonly used `unsigned'
to `unsigned int' when defining a bitfield.

src/ChangeLog
src/nsterm.m
src/w32term.c
src/w32term.h
src/window.h
src/xterm.c
src/xterm.h

index 0c8de0460343291680d5e519c7e886287fbc3b3e..34ec9e971fe411485094bf6734adb1898f3e102f 100644 (file)
@@ -1,3 +1,17 @@
+2013-08-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.h (WINDOW_FRINGE_EXTENDED_P): New macro.
+       * nsterm.m (ns_set_vertical_scroll_bar): Use it.  Use convenient
+       bool instead of BOOL.
+       * w32term.h (struct scroll_bar): Convert fringe_extended_p
+       from Lisp_Object to bitfield.  Adjust comment.
+       * w32term.c (x_scroll_bar_create): Adjust user.
+       Use WINDOW_FRINGE_EXTENDED_P and bool for boolean.
+       * xterm.c (XTset_vertical_scroll_bar): Likewise.
+       Use bool for boolean.
+       * xterm.h (struct scroll_bar): Prefer commonly used `unsigned'
+       to `unsigned int' when defining a bitfield.
+
 2013-08-13  Paul Eggert  <eggert@cs.ucla.edu>
 
        * decompress.c (Fzlib_decompress_region): Try to clarify 'avail_out'.
index e519244ac9997c9c130986b3d070b4f256ed9024..e1a60028ffc79db03f9dd93b3bc5be0b5c2f3111 100644 (file)
@@ -3703,7 +3703,7 @@ ns_set_vertical_scroll_bar (struct window *window,
   int window_y, window_height;
   int top, left, height, width, sb_width, sb_left;
   EmacsScroller *bar;
-  BOOL fringe_extended_p;
+  bool fringe_extended_p;
 
   /* optimization; display engine sends WAY too many of these.. */
   if (!NILP (window->vertical_scroll_bar))
@@ -3740,16 +3740,7 @@ ns_set_vertical_scroll_bar (struct window *window,
   v = [view frame];
   r.origin.y = (v.size.height - r.size.height - r.origin.y);
 
-  if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (window))
-    fringe_extended_p = (WINDOW_LEFTMOST_P (window)
-                        && WINDOW_LEFT_FRINGE_WIDTH (window)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
-                            || WINDOW_LEFT_MARGIN_COLS (window) == 0));
-  else
-    fringe_extended_p = (WINDOW_RIGHTMOST_P (window)
-                        && WINDOW_RIGHT_FRINGE_WIDTH (window)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
-                            || WINDOW_RIGHT_MARGIN_COLS (window) == 0));
+  fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
 
   XSETWINDOW (win, window);
   block_input ();
index 15812f93ff5fc784ec3595b18c690a7bba830e19..2b30673c75d05eed17fae64c238f9e40df58afd6 100644 (file)
@@ -3770,7 +3770,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
   XSETINT (bar->start, 0);
   XSETINT (bar->end, 0);
   bar->dragging = Qnil;
-  bar->fringe_extended_p = Qnil;
+  bar->fringe_extended_p = 0;
 
   /* Requires geometry to be set before call to create the real window */
 
@@ -3834,7 +3834,7 @@ w32_set_vertical_scroll_bar (struct window *w,
   struct scroll_bar *bar;
   int top, height, left, sb_left, width, sb_width;
   int window_y, window_height;
-  int fringe_extended_p;
+  bool fringe_extended_p;
 
   /* Get window dimensions.  */
   window_box (w, -1, 0, &window_y, 0, &window_height);
@@ -3858,16 +3858,7 @@ w32_set_vertical_scroll_bar (struct window *w,
   else
     sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
 
-  if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
-    fringe_extended_p = (WINDOW_LEFTMOST_P (w)
-                        && WINDOW_LEFT_FRINGE_WIDTH (w)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
-                            || WINDOW_LEFT_MARGIN_COLS (w) == 0));
-  else
-    fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
-                        && WINDOW_RIGHT_FRINGE_WIDTH (w)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
-                            || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
+  fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
 
   /* Does the scroll bar exist yet?  */
   if (NILP (w->vertical_scroll_bar))
@@ -3896,11 +3887,11 @@ w32_set_vertical_scroll_bar (struct window *w,
       hwnd = SCROLL_BAR_W32_WINDOW (bar);
 
       /* If already correctly positioned, do nothing.  */
-      if ( XINT (bar->left) == sb_left
-           && XINT (bar->top) == top
-           && XINT (bar->width) ==  sb_width
-           && XINT (bar->height) == height
-          && !NILP (bar->fringe_extended_p) == fringe_extended_p )
+      if (XINT (bar->left) == sb_left
+         && XINT (bar->top) == top
+         && XINT (bar->width) == sb_width
+         && XINT (bar->height) == height
+         && bar->fringe_extended_p == fringe_extended_p)
         {
           /* Redraw after clear_frame. */
           if (!my_show_window (f, hwnd, SW_NORMAL))
@@ -3950,7 +3941,7 @@ w32_set_vertical_scroll_bar (struct window *w,
           unblock_input ();
         }
     }
-  bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+  bar->fringe_extended_p = fringe_extended_p;
 
   w32_set_scroll_bar_thumb (bar, portion, position, whole);
   XSETVECTOR (barobj, bar);
index 3c9cce35221c846fca2e8cf9e19e1d193686d347..8a1bbd11766658e8fb498a0ca33b54466313385d 100644 (file)
@@ -451,9 +451,9 @@ struct scroll_bar {
      being dragged, this is Qnil.  */
   Lisp_Object dragging;
 
-  /* t if the background of the fringe that is adjacent to a scroll
+  /* 1 if the background of the fringe that is adjacent to a scroll
      bar is extended to the gap between the fringe and the bar.  */
-  Lisp_Object fringe_extended_p;
+  unsigned fringe_extended_p : 1;
 };
 
 /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
index a9afbc7f4a3cdd0ab17c02c7cf57d8c211e9ae40..9d41a14cd23e5a39c001a2c0f6353d885d26932d 100644 (file)
@@ -828,13 +828,25 @@ wset_next_buffers (struct window *w, Lisp_Object val)
 #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X)     \
   (window_box_left ((W), TEXT_AREA) + (X))
 
-/* This is the window in which the terminal's cursor should
-   be left when nothing is being done with it.  This must
-   always be a leaf window, and its buffer is selected by
-   the top level editing loop at the end of each command.
-
-   This value is always the same as
-    FRAME_SELECTED_WINDOW (selected_frame).  */
+/* Nonzero if the background of the window W's fringe that is adjacent to
+   a scroll bar is extended to the gap between the fringe and the bar.  */
+
+#define WINDOW_FRINGE_EXTENDED_P(w)                    \
+  (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)          \
+   ? (WINDOW_LEFTMOST_P (w)                            \
+      && WINDOW_LEFT_FRINGE_WIDTH (w)                  \
+      && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)       \
+         || WINDOW_LEFT_MARGIN_COLS (w) == 0))         \
+   : (WINDOW_RIGHTMOST_P (w)                           \
+      && WINDOW_RIGHT_FRINGE_WIDTH (w)                 \
+      && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)       \
+         || WINDOW_RIGHT_MARGIN_COLS (w) == 0)))
+
+/* This is the window in which the terminal's cursor should be left when
+   nothing is being done with it.  This must always be a leaf window, and its
+   buffer is selected by the top level editing loop at the end of each command.
+
+   This value is always the same as FRAME_SELECTED_WINDOW (selected_frame).  */
 
 extern Lisp_Object selected_window;
 
index 6f57836c9aad887c216284e76f395732ba8b83d8..15ad3bdf851543a0816ebe5ec0f87ec83d1813e5 100644 (file)
@@ -5155,7 +5155,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
   int top, height, left, sb_left, width, sb_width;
   int window_y, window_height;
 #ifdef USE_TOOLKIT_SCROLL_BARS
-  int fringe_extended_p;
+  bool fringe_extended_p;
 #endif
 
   /* Get window dimensions.  */
@@ -5188,16 +5188,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
 #endif
 
 #ifdef USE_TOOLKIT_SCROLL_BARS
-  if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
-    fringe_extended_p = (WINDOW_LEFTMOST_P (w)
-                        && WINDOW_LEFT_FRINGE_WIDTH (w)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
-                            || WINDOW_LEFT_MARGIN_COLS (w) == 0));
-  else
-    fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
-                        && WINDOW_RIGHT_FRINGE_WIDTH (w)
-                        && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
-                            || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
+  fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
 #endif
 
   /* Does the scroll bar exist yet?  */
index 5324ef628e7cea18b265dffa0a861ba15395b775..fbc2f05a37507a94ed5b0bffa088da841010720f 100644 (file)
@@ -815,7 +815,7 @@ struct scroll_bar
 
   /* 1 if the background of the fringe that is adjacent to a scroll
      bar is extended to the gap between the fringe and the bar.  */
-  unsigned int fringe_extended_p : 1;
+  unsigned fringe_extended_p : 1;
 };
 
 /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */