-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: b329cb990e5d7ca1af4e685614697e1d45955b04: path_to: revision_to:
commit b329cb990e5d7ca1af4e685614697e1d45955b04 Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com> Date: Mon Jan 28 10:54:54 2008 +0000 Replace scrollbar {up,dn}Button macros with methods. diff --git a/src/command.C b/src/command.C
--- a/src/command.C +++ b/src/command.C @@ -1968,15 +1968,9 @@ rxvt_term::button_press (XButtonEvent &ev) * arrow buttons - send up/down * click on scrollbar - send pageup/down */ - if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_upButton (ev.y)) - || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_upButton (ev.y))) + if (scrollBar.upButton (ev.y)) tt_printf ("\033[A"); - else if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_dnButton (ev.y)) - || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_dnButton (ev.y))) + else if (scrollBar.dnButton (ev.y)) tt_printf ("\033[B"); else switch (ev.button) @@ -1998,20 +1992,10 @@ rxvt_term::button_press (XButtonEvent &ev) { char upordown = 0; - if (scrollBar.style == R_SB_NEXT) - { - if (scrollbarnext_upButton (ev.y)) - upordown = -1; /* up */ - else if (scrollbarnext_dnButton (ev.y)) - upordown = 1; /* down */ - } - else if (scrollBar.style == R_SB_RXVT) - { - if (scrollbarrxvt_upButton (ev.y)) - upordown = -1; /* up */ - else if (scrollbarrxvt_dnButton (ev.y)) - upordown = 1; /* down */ - } + if (scrollBar.upButton (ev.y)) + upordown = -1; /* up */ + else if (scrollBar.dnButton (ev.y)) + upordown = 1; /* down */ if (upordown) { diff --git a/src/scrollbar.h b/src/scrollbar.h
--- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -5,6 +5,11 @@ struct rxvt_term; +#define R_SB_NEXT 1 +#define R_SB_XTERM 2 +#define R_SB_PLAIN 4 +#define R_SB_RXVT 8 + struct scrollBar_t { char state; /* scrollbar state */ char init; /* scrollbar has been initialised */ @@ -28,6 +33,23 @@ struct scrollBar_t { void setMotion() { state = 'm'; } void setUp() { state = 'U'; } void setDn() { state = 'D'; } + + bool upButton (int y) + { + if (style == R_SB_NEXT) + return y > end && y <= end + width + 1; + if (style == R_SB_RXVT) + return y < beg; + return false; + } + bool dnButton (int y) + { + if (style == R_SB_NEXT) + return y > end + width + 1; + if (style == R_SB_RXVT) + return y > end; + return false; + } }; #define scrollbar_TotalWidth() (scrollBar.width + scrollBar.shadow * 2) @@ -36,13 +58,7 @@ struct scrollBar_t { #define scrollbar_isDn() (scrollBar.state == 'D') #define scrollbar_isUpDn() (scrollbar_isUp () || scrollbar_isDn ()) -#define scrollbarnext_dnval() (scrollBar.end + (scrollBar.width + 1)) -#define scrollbarnext_upButton(y) ((y) > scrollBar.end \ - && (y) <= scrollbarnext_dnval ()) -#define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval()) #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT -#define scrollbarrxvt_upButton(y) ((y) < scrollBar.beg) -#define scrollbarrxvt_dnButton(y) ((y) > scrollBar.end) #define SCROLLRXVT_MINHEIGHT 10 #define scrollbar_minheight() (scrollBar.style == R_SB_NEXT \ @@ -58,11 +74,6 @@ struct scrollBar_t { #define R_SB_ALIGN_TOP 1 #define R_SB_ALIGN_BOTTOM 2 -#define R_SB_NEXT 1 -#define R_SB_XTERM 2 -#define R_SB_PLAIN 4 -#define R_SB_RXVT 8 - #define SB_WIDTH_NEXT 19 #define SB_WIDTH_XTERM 15 #define SB_WIDTH_PLAIN 7
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 09:17:35 2024