repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 85f972b15db884250a43ac78bc6d92d02fe6ac15: path_to: revision_to:
commit 85f972b15db884250a43ac78bc6d92d02fe6ac15 Author: Emanuele GiaquintaDate: Mon Aug 22 17:23:56 2011 +0000 Convert scrollbar macros to inline functions. diff --git a/src/command.C b/src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -1668,7 +1668,7 @@ rxvt_term::x_cb (XEvent &ev)
&unused_root_x, &unused_root_y,
&ev.xbutton.x, &ev.xbutton.y,
&unused_mask);
- scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
+ scr_move_to (scrollBar.position (ev.xbutton.y) - csrO,
scrollBar.size ());
want_refresh = 1;
scrollBar.show (1);
@@ -2046,9 +2046,9 @@ rxvt_term::button_press (XButtonEvent &ev)
}
if (scrollBar.style == R_SB_XTERM
- || scrollbar_above_slider (ev.y)
- || scrollbar_below_slider (ev.y))
- scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ());
+ || scrollBar.above_slider (ev.y)
+ || scrollBar.below_slider (ev.y))
+ scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ());
scrollBar.state = STATE_MOTION;
break;
@@ -2061,13 +2061,13 @@ rxvt_term::button_press (XButtonEvent &ev)
case Button3:
if (scrollBar.style != R_SB_XTERM)
{
- if (scrollbar_above_slider (ev.y))
+ if (scrollBar.above_slider (ev.y))
# ifdef RXVT_SCROLL_FULL
scr_page (UP, nrow - 1);
# else
scr_page (UP, nrow / 4);
# endif
- else if (scrollbar_below_slider (ev.y))
+ else if (scrollBar.below_slider (ev.y))
# ifdef RXVT_SCROLL_FULL
scr_page (DN, nrow - 1);
# else
@@ -2080,7 +2080,7 @@ rxvt_term::button_press (XButtonEvent &ev)
{
scr_page ((ev.button == Button1 ? DN : UP),
(nrow
- * scrollbar_position (ev.y)
+ * scrollBar.position (ev.y)
/ scrollBar.size ()));
}
diff --git a/src/scrollbar.h b/src/scrollbar.h
--- a/src/scrollbar.h
+++ b/src/scrollbar.h
@@ -104,6 +104,19 @@ struct scrollBar_t
{
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 +162,6 @@ private:
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
-----END OF PAGE-----