*** empty log message ***
authorroot <root>
Mon, 16 Jan 2006 18:09:28 +0000 (18:09 +0000)
committerroot <root>
Mon, 16 Jan 2006 18:09:28 +0000 (18:09 +0000)
src/scrollbar-rxvt.C

index 87a7c88284e280589f053880755c2d0c641dd478..740603ceb661ce5efbb26451a21ba6125651bd3a 100644 (file)
 #define SHADOW_WIDTH 1
 
 static void  
-rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h)
+draw_shadow (rxvt_term *term, int x, int y, int w, int h)
 {       
-  int             shadow;
+  int shadow;
     
   shadow = (w == 0 || h == 0) ? 1 : SHADOW_WIDTH;
   w += x - 1;
   h += y - 1;
   for (; shadow-- > 0; x++, y++, w--, h--)
     {     
-      XDrawLine (display, win, topShadow, x, y, w, y);
-      XDrawLine (display, win, topShadow, x, y, x, h);
-      XDrawLine (display, win, botShadow, w, h, w, y + 1);
-      XDrawLine (display, win, botShadow, w, h, x + 1, h);
+      XDrawLine (term->display->display, term->scrollBar.win, term->topShadowGC, x, y, w, y);
+      XDrawLine (term->display->display, term->scrollBar.win, term->topShadowGC, x, y, x, h);
+      XDrawLine (term->display->display, term->scrollBar.win, term->botShadowGC, w, h, w, y + 1);
+      XDrawLine (term->display->display, term->scrollBar.win, term->botShadowGC, w, h, x + 1, h);
     }           
 }                 
 
 /* draw triangular button with a shadow of 2 pixels */
-void
-rxvt_term::Draw_button (int x, int y, int state, int dirn)
+static void
+draw_button (rxvt_term *term, int x, int y, int state, int dirn)
 {
-  unsigned int    sz, sz2;
-  XPoint          pt[3];
-  GC              top, bot;
+  unsigned int sz, sz2;
+  XPoint pt[3];
+  GC top, bot;
 
-  sz = scrollBar.width;
+  sz = term->scrollBar.width;
   sz2 = sz / 2;
   switch (state)
     {
       case +1:
-        top = topShadowGC;
-        bot = botShadowGC;
+        top = term->topShadowGC;
+        bot = term->botShadowGC;
         break;
       case -1:
-        top = botShadowGC;
-        bot = topShadowGC;
+        top = term->botShadowGC;
+        bot = term->topShadowGC;
         break;
       default:
-        top = bot = scrollbarGC;
+        top = bot = term->scrollbarGC;
         break;
     }
 
@@ -86,17 +86,17 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn)
       pt[2].y = y + sz - 1;
     }
 
-  XFillPolygon (display->display, scrollBar.win, scrollbarGC,
+  XFillPolygon (term->display->display, term->scrollBar.win, term->scrollbarGC,
                 pt, 3, Convex, CoordModeOrigin);
 
   /* draw base */
-  XDrawLine (display->display, scrollBar.win, (dirn == UP ? bot : top),
+  XDrawLine (term->display->display, term->scrollBar.win, (dirn == UP ? bot : top),
              pt[0].x, pt[0].y, pt[1].x, pt[1].y);
 
   /* draw shadow on left */
   pt[1].x = x + sz2 - 1;
   pt[1].y = y + (dirn == UP ? 0 : sz - 1);
-  XDrawLine (display->display, scrollBar.win, top,
+  XDrawLine (term->display->display, term->scrollBar.win, top,
              pt[0].x, pt[0].y, pt[1].x, pt[1].y);
 
 #if SHADOW_WIDTH > 1
@@ -114,7 +114,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn)
       pt[1].y--;
     }
 
-  XDrawLine (display->display, scrollBar.win, top,
+  XDrawLine (term->display->display, term->scrollBar.win, top,
              pt[0].x, pt[0].y, pt[1].x, pt[1].y);
 #endif
 
@@ -123,7 +123,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn)
   /*  pt[2].x = x + sz2; */
   pt[1].y = y + (dirn == UP ? sz - 1 : 0);
   pt[2].y = y + (dirn == UP ? 0 : sz - 1);
-  XDrawLine (display->display, scrollBar.win, bot,
+  XDrawLine (term->display->display, term->scrollBar.win, bot,
              pt[2].x, pt[2].y, pt[1].x, pt[1].y);
 
 #if SHADOW_WIDTH > 1
@@ -140,7 +140,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn)
       pt[1].y++;
     }
 
-  XDrawLine (display->display, scrollBar.win, bot,
+  XDrawLine (term->display->display, term->scrollBar.win, bot,
              pt[2].x, pt[2].y, pt[1].x, pt[1].y);
 #endif
 }
@@ -202,21 +202,14 @@ rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scro
 
   if (sbshadow)
     /* trough shadow */
-    rxvt_Draw_Shadow (display->display, scrollBar.win,
-                     botShadowGC, topShadowGC,
-                     0, 0,
-                     sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth () */
-                     scrollBar.end + (sbwidth + 1) + sbshadow);
+    draw_shadow (this, 0, 0, sbwidth + 2 * sbshadow, scrollBar.end + (sbwidth + 1) + sbshadow);
 
   /* shadow for scrollbar slider */
-  rxvt_Draw_Shadow (display->display, scrollBar.win,
-                   topShadowGC, botShadowGC,
-                   sbshadow, scrollBar.top, sbwidth,
-                   scrollbar_len);
+  draw_shadow (this, sbshadow, scrollBar.top, sbwidth, scrollbar_len);
 
   /* Redraw scrollbar arrows */
-  Draw_button (sbshadow, sbshadow,          (scrollbar_isUp () ? -1 : +1), UP);
-  Draw_button (sbshadow, scrollBar.end + 1, (scrollbar_isDn () ? -1 : +1), DN);
+  draw_button (this, sbshadow, sbshadow,          (scrollbar_isUp () ? -1 : +1), UP);
+  draw_button (this, sbshadow, scrollBar.end + 1, (scrollbar_isDn () ? -1 : +1), DN);
 
   return 1;
 }