emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113840: * window.h (struct window): Convert left_fr


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r113840: * window.h (struct window): Convert left_fringe_width
Date: Tue, 13 Aug 2013 12:17:32 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113840
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-08-13 16:13:04 +0400
message:
  * window.h (struct window): Convert left_fringe_width
  and right_fringe_width from Lisp_Objects to integers.
  Adjust comment.
  (WINDOW_FRINGE_COLS, WINDOW_LEFT_FRINGE_WIDTH)
  (WINDOW_RIGHT_FRINGE_WIDTH): Adjust users.
  * window.c (wset_left_fringe_width, wset_right_fringe_width):
  Remove.
  (make_window): Initialize new integer fields to -1.
  (Fsplit_window_internal): Use direct assignment.
  (Fset_window_configuration, save_window_save): Convert
  Lisp_Object to integer and back where appropriate.
  (Fset_window_fringes): Adjust user.  Return t if any fringe
  was actually changed, and mention this in docstring.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-13 08:58:15 +0000
+++ b/src/ChangeLog     2013-08-13 12:13:04 +0000
@@ -1,5 +1,21 @@
 2013-08-13  Dmitry Antipov  <address@hidden>
 
+       * window.h (struct window): Convert left_fringe_width
+       and right_fringe_width from Lisp_Objects to integers.
+       Adjust comment.
+       (WINDOW_FRINGE_COLS, WINDOW_LEFT_FRINGE_WIDTH)
+       (WINDOW_RIGHT_FRINGE_WIDTH): Adjust users.
+       * window.c (wset_left_fringe_width, wset_right_fringe_width):
+       Remove.
+       (make_window): Initialize new integer fields to -1.
+       (Fsplit_window_internal): Use direct assignment.
+       (Fset_window_configuration, save_window_save): Convert
+       Lisp_Object to integer and back where appropriate.
+       (Fset_window_fringes): Adjust user.  Return t if any fringe
+       was actually changed, and mention this in docstring.
+
+2013-08-13  Dmitry Antipov  <address@hidden>
+
        * keyboard.c (Fdiscard_input): Do not increment update_mode_lines.
        * nsfns.m (x_set_cursor_type):
        * w32fns.c (x_set_cursor_type):

=== modified file 'src/window.c'
--- a/src/window.c      2013-08-13 08:17:50 +0000
+++ b/src/window.c      2013-08-13 12:13:04 +0000
@@ -151,11 +151,6 @@
   w->display_table = val;
 }
 static void
-wset_left_fringe_width (struct window *w, Lisp_Object val)
-{
-  w->left_fringe_width = val;
-}
-static void
 wset_left_margin_cols (struct window *w, Lisp_Object val)
 {
   w->left_margin_cols = val;
@@ -191,11 +186,6 @@
   w->pointm = val;
 }
 static void
-wset_right_fringe_width (struct window *w, Lisp_Object val)
-{
-  w->right_fringe_width = val;
-}
-static void
 wset_right_margin_cols (struct window *w, Lisp_Object val)
 {
   w->right_margin_cols = val;
@@ -3481,6 +3471,7 @@
   /* Initialize non-Lisp data.  Note that allocate_window zeroes out all
      non-Lisp data, so do it only for slots which should not be zero.  */
   w->nrows_scale_factor = w->ncols_scale_factor = 1;
+  w->left_fringe_width = w->right_fringe_width = -1;
   w->phys_cursor_type = -1;
   w->phys_cursor_width = -1;
   w->column_number_displayed = -1;
@@ -3950,8 +3941,8 @@
   /* Get special geometry settings from reference window.  */
   wset_left_margin_cols (n, r->left_margin_cols);
   wset_right_margin_cols (n, r->right_margin_cols);
-  wset_left_fringe_width (n, r->left_fringe_width);
-  wset_right_fringe_width (n, r->right_fringe_width);
+  n->left_fringe_width = r->left_fringe_width;
+  n->right_fringe_width = r->right_fringe_width;
   n->fringes_outside_margins = r->fringes_outside_margins;
   wset_scroll_bar_width (n, r->scroll_bar_width);
   wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
@@ -5693,8 +5684,8 @@
          wset_display_table (w, p->display_table);
          wset_left_margin_cols (w, p->left_margin_cols);
          wset_right_margin_cols (w, p->right_margin_cols);
-         wset_left_fringe_width (w, p->left_fringe_width);
-         wset_right_fringe_width (w, p->right_fringe_width);
+         w->left_fringe_width = XINT (p->left_fringe_width);
+         w->right_fringe_width = XINT (p->right_fringe_width);
          w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
          wset_scroll_bar_width (w, p->scroll_bar_width);
          wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
@@ -5994,8 +5985,8 @@
       p->display_table = w->display_table;
       p->left_margin_cols = w->left_margin_cols;
       p->right_margin_cols = w->right_margin_cols;
-      p->left_fringe_width = w->left_fringe_width;
-      p->right_fringe_width = w->right_fringe_width;
+      p->left_fringe_width = make_number (w->left_fringe_width);
+      p->right_fringe_width = make_number (w->right_fringe_width);
       p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
       p->scroll_bar_width = w->scroll_bar_width;
       p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
@@ -6221,25 +6212,28 @@
 the command `set-fringe-style'.
 If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes
 outside of the display margins.  By default, fringes are drawn between
-display marginal areas and the text area.  */)
-  (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, 
Lisp_Object outside_margins)
+display marginal areas and the text area.
+
+Return t if any fringe was actually changed and nil otherwise.  */)
+  (Lisp_Object window, Lisp_Object left_width,
+   Lisp_Object right_width, Lisp_Object outside_margins)
 {
   struct window *w = decode_live_window (window);
-  int outside = !NILP (outside_margins);
-
-  if (!NILP (left_width))
-    CHECK_NATNUM (left_width);
-  if (!NILP (right_width))
-    CHECK_NATNUM (right_width);
-
-  /* Do nothing on a tty.  */
+  int left, right, outside = !NILP (outside_margins);
+
+  left = (NILP (left_width) ? -1
+         : (CHECK_NATNUM (left_width), XINT (left_width)));
+  right = (NILP (right_width) ? -1
+          : (CHECK_NATNUM (right_width), XINT (right_width)));
+
+  /* Do nothing on a tty or if nothing to actually change.  */
   if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
-      && (!EQ (w->left_fringe_width, left_width)
-         || !EQ (w->right_fringe_width, right_width)
+      && (w->left_fringe_width != left
+         || w->right_fringe_width != right
          || w->fringes_outside_margins != outside))
     {
-      wset_left_fringe_width (w, left_width);
-      wset_right_fringe_width (w, right_width);
+      w->left_fringe_width = left;
+      w->right_fringe_width = right;
       w->fringes_outside_margins = outside;
 
       adjust_window_margins (w);
@@ -6249,6 +6243,7 @@
 
       ++windows_or_buffers_changed;
       adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
+      return Qt;
     }
 
   return Qnil;

=== modified file 'src/window.h'
--- a/src/window.h      2013-08-12 09:34:00 +0000
+++ b/src/window.h      2013-08-13 12:13:04 +0000
@@ -146,11 +146,6 @@
     Lisp_Object left_margin_cols;
     Lisp_Object right_margin_cols;
 
-    /* Width of left and right fringes.
-       A value of nil or t means use frame values.  */
-    Lisp_Object left_fringe_width;
-    Lisp_Object right_fringe_width;
-
     /* Pixel width of scroll bars.
        A value of nil or t means use frame values.  */
     Lisp_Object scroll_bar_width;
@@ -269,6 +264,11 @@
     /* This is handy for undrawing the cursor.  */
     int phys_cursor_ascent, phys_cursor_height;
 
+    /* Width of left and right fringes, in pixels.
+       A value of -1 means use frame values.  */
+    int left_fringe_width;
+    int right_fringe_width;
+
     /* Non-zero if this window is a minibuffer window.  */
     unsigned mini : 1;
 
@@ -635,10 +635,10 @@
    able to split windows horizontally nicely.  */
 
 #define WINDOW_FRINGE_COLS(W)                  \
-  ((INTEGERP (W->left_fringe_width)            \
-    || INTEGERP (W->right_fringe_width))       \
-   ? ((WINDOW_LEFT_FRINGE_WIDTH (W)            \
-       + WINDOW_RIGHT_FRINGE_WIDTH (W)         \
+  ((W->left_fringe_width >= 0                  \
+    && W->right_fringe_width >= 0)             \
+   ? ((W->left_fringe_width                    \
+       + W->right_fringe_width                 \
        + WINDOW_FRAME_COLUMN_WIDTH (W) - 1)    \
       / WINDOW_FRAME_COLUMN_WIDTH (W))         \
    : FRAME_FRINGE_COLS (WINDOW_XFRAME (W)))
@@ -658,13 +658,11 @@
 /* Pixel-width of the left and right fringe.  */
 
 #define WINDOW_LEFT_FRINGE_WIDTH(W)                    \
-  (INTEGERP (W->left_fringe_width)                     \
-   ? XFASTINT (W->left_fringe_width)                   \
+  (W->left_fringe_width >= 0 ? W->left_fringe_width    \
    : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
 
 #define WINDOW_RIGHT_FRINGE_WIDTH(W)                   \
-  (INTEGERP (W->right_fringe_width)                    \
-   ? XFASTINT (W->right_fringe_width)                  \
+  (W->right_fringe_width >= 0 ? W->right_fringe_width  \
    : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
 
 /* Total width of fringes in pixels.  */


reply via email to

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