From: ayin Date: Tue, 29 Jan 2008 14:45:54 +0000 (+0000) Subject: Make setup_scrollbar a method of scrollBar_t. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=cba3c2f2a5a3208dd596efb5e006d6944b0af6c9;p=dana%2Furxvt.git Make setup_scrollbar a method of scrollBar_t. --- diff --git a/src/init.C b/src/init.C index 0e0413b8..36487851 100644 --- a/src/init.C +++ b/src/init.C @@ -487,7 +487,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) # endif #endif - setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]); + scrollBar.setup (this); #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ diff --git a/src/rxvt.h b/src/rxvt.h index 289af5ec..cf19e463 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1481,7 +1481,6 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { void resize_scrollbar (); int scrollbar_mapping (int map); int scrollbar_show (int update); - void setup_scrollbar (const char *scrollalign, const char *scrollstyle, const char *thickness); // xdefaults.C void get_options (int argc, const char *const *argv); diff --git a/src/scrollbar.C b/src/scrollbar.C index ab1c4869..a55c1d66 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -175,10 +175,16 @@ rxvt_term::scrollbar_show (int update) } void -rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, const char *thickness) +scrollBar_t::setup (rxvt_term *term) { int i; short style, width; + const char *scrollalign, *scrollstyle, *thickness; + + this->term = term; + scrollalign = term->rs[Rs_scrollBar_align]; + scrollstyle = term->rs[Rs_scrollstyle]; + thickness = term->rs[Rs_scrollBar_thickness]; # if defined(RXVT_SCROLLBAR) style = R_SB_RXVT; @@ -224,24 +230,24 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co width = min (i, SB_WIDTH_MAXIMUM); # ifdef RXVT_SCROLLBAR - if (! option (Opt_scrollBar_floating) && style == R_SB_RXVT) + if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) scrollBar.shadow = SHADOW_WIDTH; # endif - scrollBar.style = style; - scrollBar.width = width; + this->style = style; + this->width = width; /* scrollBar.align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { if (strncasecmp (scrollalign, "top", 3) == 0) - scrollBar.align = R_SB_ALIGN_TOP; + align = R_SB_ALIGN_TOP; else if (strncasecmp (scrollalign, "bottom", 6) == 0) - scrollBar.align = R_SB_ALIGN_BOTTOM; + align = R_SB_ALIGN_BOTTOM; } - scrollBar.last_bot = scrollBar.last_state = -1; + last_bot = last_state = -1; /* cursor scrollBar: Black-on-White */ - scrollBar.leftptr_cursor = XCreateFontCursor (dpy, XC_left_ptr); + leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr); } /*----------------------- end-of-file (C source) -----------------------*/ diff --git a/src/scrollbar.h b/src/scrollbar.h index f78fb803..386d879c 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -18,6 +18,7 @@ enum sb_state { }; struct scrollBar_t { + rxvt_term *term; char state; /* scrollbar state */ char init; /* scrollbar has been initialised */ unsigned int beg; /* slider sub-window begin height */ @@ -35,6 +36,7 @@ struct scrollBar_t { Window win; Cursor leftptr_cursor; int (rxvt_term::*update)(int, int, int, int); + void setup (rxvt_term *); bool upButton (int y) {