Make setup_scrollbar a method of scrollBar_t.
authorayin <ayin>
Tue, 29 Jan 2008 14:45:54 +0000 (14:45 +0000)
committerayin <ayin>
Tue, 29 Jan 2008 14:45:54 +0000 (14:45 +0000)
src/init.C
src/rxvt.h
src/scrollbar.C
src/scrollbar.h

index 0e0413b84870cd1c62a3b81fe05bb6bb6021acf1..364878512dee97733ff28fdcda63f006f3006564 100644 (file)
@@ -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 */
index 289af5ece6d07d7be742387a94cd1d454246719e..cf19e463def6e2435d50b973a31c2d0767724e89 100644 (file)
@@ -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);
index ab1c48696de69e0697e8efdc7ae5b17314570f7b..a55c1d668704e14ea0d2c1e1081875f5fbcac208 100644 (file)
@@ -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) -----------------------*/
index f78fb803fa471dcbeb67731f2abb67f13d3c63d5..386d879cf348714a303e786cb6749bdd57461acc 100644 (file)
@@ -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)
   {