From: Dmitry Antipov Date: Tue, 13 Aug 2013 15:29:25 +0000 (+0400) Subject: * window.h (WINDOW_FRINGE_EXTENDED_P): New macro. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~277 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c8ae93b0890e61c5fbc151216d9169968e532f30;p=emacs.git * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 0c8de046034..34ec9e971fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2013-08-13 Dmitry Antipov + + * 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 * decompress.c (Fzlib_decompress_region): Try to clarify 'avail_out'. diff --git a/src/nsterm.m b/src/nsterm.m index e519244ac99..e1a60028ffc 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -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 (); diff --git a/src/w32term.c b/src/w32term.c index 15812f93ff5..2b30673c75d 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -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); diff --git a/src/w32term.h b/src/w32term.h index 3c9cce35221..8a1bbd11766 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -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. */ diff --git a/src/window.h b/src/window.h index a9afbc7f4a3..9d41a14cd23 100644 --- a/src/window.h +++ b/src/window.h @@ -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; diff --git a/src/xterm.c b/src/xterm.c index 6f57836c9aa..15ad3bdf851 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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? */ diff --git a/src/xterm.h b/src/xterm.h index 5324ef628e7..fbc2f05a375 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -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. */