repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: c00c30c7f8ef66c7d06ec825175ffd9598c40187:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit c00c30c7f8ef66c7d06ec825175ffd9598c40187
Author: Emanuele Giaquinta 
Date:   Mon Aug 22 17:09:46 2011 +0000

    Use enum types for state, style and align scrollbar variables.

diff --git a/src/scrollbar.C b/src/scrollbar.C
index 6582e5dd81d0b8f31f658817f352fc003c91ebce..
index ..ada88a7e28049f62fa9e989de14ebffa6a4971e1 100644
--- a/src/scrollbar.C
+++ b/src/scrollbar.C
@@ -51,7 +51,7 @@ scrollBar_t::map (int map)
     }
   else
     {
-      state = 0;
+      state = STATE_OFF;
       XUnmapWindow (term->dpy, win);
       change = 1;
     }
@@ -143,8 +143,9 @@ void
 scrollBar_t::setup (rxvt_term *term)
 {
   int             i;
-  short           style, width;
+  short           width;
   const char *scrollalign, *scrollstyle, *thickness;
+  enum sb_style style;

   this->term = term;
   scrollalign = term->rs[Rs_scrollBar_align];
@@ -210,7 +211,7 @@ scrollBar_t::setup (rxvt_term *term)
       else if (strncasecmp (scrollalign, "bottom", 6) == 0)
         align = R_SB_ALIGN_BOTTOM;
     }
-  last_state = 0;
+  last_state = STATE_OFF;
   /* cursor scrollBar: Black-on-White */
   leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr);
 }
diff --git a/src/scrollbar.h b/src/scrollbar.h
index ec031f6f6bfee3717dc4a3fea6013addcb4b7ae8..
index ..7dea0d407daf93ffe682deebf8f35c04205413aa 100644
--- a/src/scrollbar.h
+++ b/src/scrollbar.h
@@ -5,15 +5,6 @@

 struct rxvt_term;

-#define R_SB_NEXT               1
-#define R_SB_XTERM              2
-#define R_SB_PLAIN              4
-#define R_SB_RXVT               8
-
-#define R_SB_ALIGN_CENTRE       0
-#define R_SB_ALIGN_TOP          1
-#define R_SB_ALIGN_BOTTOM       2
-
 #define SB_WIDTH_NEXT           19
 #define SB_WIDTH_XTERM          15
 #define SB_WIDTH_PLAIN          7
@@ -40,28 +31,42 @@ struct rxvt_term;
 #define SB_THUMB_MIN_HEIGHT     (SB_BUTTON_WIDTH - (SB_PADDING * 2))

 enum sb_state {
-  STATE_IDLE = 1,
+  STATE_OFF,
+  STATE_IDLE,
   STATE_MOTION,
   STATE_UP,
   STATE_DOWN,
 };

+enum sb_style {
+  R_SB_NEXT  = 1,
+  R_SB_XTERM = 2,
+  R_SB_PLAIN = 4,
+  R_SB_RXVT  = 8,
+};
+
+enum sb_align {
+  R_SB_ALIGN_CENTRE,
+  R_SB_ALIGN_TOP,
+  R_SB_ALIGN_BOTTOM,
+};
+
 struct scrollBar_t
 {
   rxvt_term *term;
-  char            state;        /* scrollbar state                          */
+  sb_state        state;        /* scrollbar state                          */
   char            init;         /* scrollbar has been initialised           */
   unsigned int    beg;          /* slider sub-window begin height           */
   unsigned int    end;          /* slider sub-window end height             */
   unsigned int    top;          /* slider top position                      */
   unsigned int    bot;          /* slider bottom position                   */
-  unsigned int    style;        /* style: rxvt, xterm, next                 */
+  sb_style        style;        /* style: rxvt, xterm, next                 */
   unsigned int    width;        /* scrollbar width                          */
   int             shadow;       /* scrollbar shadow width                   */
   int             last_bot;     /* scrollbar last bottom position           */
   int             last_top;     /* scrollbar last top position              */
   int             last_state;   /* scrollbar last state                     */
-  unsigned char   align;
+  sb_align        align;
   Window          win;
   Cursor          leftptr_cursor;
   int             (scrollBar_t::*update)(int);

-----END OF PAGE-----