--- rxvt-unicode/src/scrollbar.h 2011/08/22 17:09:46 1.24 +++ rxvt-unicode/src/scrollbar.h 2011/08/28 18:48:41 1.27 @@ -2,6 +2,7 @@ #define SCROLLBAR_H #include +#include "rxvtutil.h" struct rxvt_term; @@ -56,12 +57,12 @@ rxvt_term *term; sb_state state; /* scrollbar state */ char init; /* scrollbar has been initialised */ - unsigned int beg; /* slider sub-window begin height */ - unsigned int end; /* slider sub-window end height */ - unsigned int top; /* slider top position */ - unsigned int bot; /* slider bottom position */ + int beg; /* slider sub-window begin height */ + int end; /* slider sub-window end height */ + int top; /* slider top position */ + int bot; /* slider bottom position */ sb_style style; /* style: rxvt, xterm, next */ - unsigned int width; /* scrollbar width */ + int width; /* scrollbar width */ int shadow; /* scrollbar shadow width */ int last_bot; /* scrollbar last bottom position */ int last_top; /* scrollbar last top position */ @@ -72,7 +73,7 @@ int (scrollBar_t::*update)(int); void setup (rxvt_term *); void resize (); - int map (int); + void map (int); int show (int); void destroy (); @@ -92,18 +93,31 @@ return y > end; return false; } - unsigned min_height () + int min_height () { return style == R_SB_NEXT ? SB_THUMB_MIN_HEIGHT : 10; } - unsigned size () + int size () { - return end - beg - min_height (); + return max (end - beg - min_height (), 0); } - unsigned total_width () + int total_width () { return width + shadow * 2; } + bool above_slider (int y) + { + return y < top; + } + bool below_slider (int y) + { + return y > bot; + } + int position (int y) + { + return y - beg; + } + #if defined(NEXT_SCROLLBAR) GC blackGC, @@ -149,10 +163,6 @@ void init_next (); }; -#define scrollbar_above_slider(y) ((y) < scrollBar.top) -#define scrollbar_below_slider(y) ((y) > scrollBar.bot) -#define scrollbar_position(y) ((y) - scrollBar.beg) - /* * +-------------+ * | | <---< SB_PADDING