*** empty log message ***
authorpcg <pcg>
Sat, 31 Jan 2004 04:12:10 +0000 (04:12 +0000)
committerpcg <pcg>
Sat, 31 Jan 2004 04:12:10 +0000 (04:12 +0000)
src/rxvt.h
src/scrollbar-plain.C [new file with mode: 0644]
src/scrollbar.C

index 592694cb5e1a7ca267e8ddb58ffb4db8914209aa..202bf3188bacca4fbe0f833806e8045139119299 100644 (file)
@@ -184,7 +184,7 @@ struct mouse_event {
 #define scrollBar_esc           30
 #define menuBar_margin          2       /* margin below text */
 
-#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR)
+#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR)
 # define HAVE_SCROLLBARS
 #endif
 
@@ -202,9 +202,11 @@ struct mouse_event {
 #define R_SB_RXVT               0
 #define R_SB_NEXT               1
 #define R_SB_XTERM              2
+#define R_SB_PLAIN              4
 
 #define SB_WIDTH_NEXT           19
-#define SB_WIDTH_XTERM          7
+#define SB_WIDTH_XTERM          15
+#define SB_WIDTH_PLAIN          7
 #ifndef SB_WIDTH_RXVT
 # define SB_WIDTH_RXVT          10
 #endif
@@ -950,6 +952,10 @@ struct rxvt_term : rxvt_vars {
   GC              xscrollbarGC,
                   ShadowGC;
 #endif
+#ifdef PLAIN_SCROLLBAR
+  GC              pscrollbarGC,
+                  pShadowGC;
+#endif
 #ifdef NEXT_SCROLLBAR
   GC              blackGC,
                   whiteGC,
@@ -1307,6 +1313,11 @@ struct rxvt_term : rxvt_vars {
   int scrollbar_show_xterm (int update, int last_top, int last_bot, int scrollbar_len);
 #endif
 
+#if defined(PLAIN_SCROLLBAR)
+  // scrollbar-plain.C
+  int scrollbar_show_plain (int update, int last_top, int last_bot, int scrollbar_len);
+#endif
+
   // scrollbar.C
   int scrollbar_mapping (int map);
   int scrollbar_show (int update);
diff --git a/src/scrollbar-plain.C b/src/scrollbar-plain.C
new file mode 100644 (file)
index 0000000..e122984
--- /dev/null
@@ -0,0 +1,68 @@
+/*--------------------------------*-C-*---------------------------------*
+ * File:       scrollbar-plain.c
+ *----------------------------------------------------------------------*
+ *
+ * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
+ * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *----------------------------------------------------------------------*/
+
+#include "../config.h"         /* NECESSARY */
+#include "rxvt.h"              /* NECESSARY */
+#include "scrollbar-plain.intpro"      /* PROTOS for internal routines */
+
+/*----------------------------------------------------------------------*/
+#if defined(PLAIN_SCROLLBAR)
+
+int
+rxvt_term::scrollbar_show_plain (int update __attribute__((unused)), int last_top, int last_bot, int scrollbar_len)
+{
+    int             xsb = 0;
+    int             sbwidth = scrollBar.width - 1;
+
+    if ((scrollBar.init & R_SB_PLAIN) == 0) {
+       XGCValues       gcvalue;
+
+       scrollBar.init |= R_SB_PLAIN;
+       gcvalue.foreground = PixColors[Color_fg];
+       gcvalue.background = PixColors[Color_bg];
+
+       pscrollbarGC = XCreateGC(Xdisplay, scrollBar.win,
+                                      GCForeground | GCBackground
+                                      | GCFillStyle, &gcvalue);
+       gcvalue.foreground = PixColors[Color_border];
+       pShadowGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground, &gcvalue);
+    }
+/* instead of XClearWindow (Xdisplay, scrollBar.win); */
+    xsb = (Options & Opt_scrollBar_right) ? 1 : 0;
+    if (last_top < scrollBar.top)
+       XClearArea(Xdisplay, scrollBar.win,
+                  sb_shadow + xsb, last_top,
+                  sbwidth + 1, (scrollBar.top - last_top), False);
+
+    if (scrollBar.bot < last_bot)
+       XClearArea(Xdisplay, scrollBar.win,
+                  sb_shadow + xsb, scrollBar.bot,
+                  sbwidth + 1, (last_bot - scrollBar.bot), False);
+
+/* scrollbar slider */
+    XFillRectangle(Xdisplay, scrollBar.win, xscrollbarGC,
+                  xsb + 1, scrollBar.top, sbwidth, scrollbar_len);
+
+    return 1;
+}
+#endif                         /* XTERM_SCROLLBAR */
+/*----------------------- end-of-file (C source) -----------------------*/
index cd958b3f3a47339a4af986fad7a4256215f466ff..e7082d22b95d6116284a91bbdf99042a00c7077e 100644 (file)
@@ -1,7 +1,6 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:       scrollbar.c
  *----------------------------------------------------------------------*
- * $Id: scrollbar.C,v 1.9 2004-01-31 02:15:02 pcg Exp $
  *
  * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
  * Copyright (c) 1998      Alfredo K. Kojima <kojima@windowmaker.org>
@@ -70,6 +69,13 @@ rxvt_term::resize_scrollbar ()
 #define R_SCROLLEND_RXVT       szHint.height - R_SCROLLBEG_RXVT - \
                                    (2 * sb_shadow)
 
+#if defined(PLAIN_SCROLLBAR)
+    if (scrollBar.style == R_SB_PLAIN) {
+       scrollBar.beg = R_SCROLLBEG_XTERM;
+       scrollBar.end = R_SCROLLEND_XTERM;
+       scrollBar.update = &rxvt_term::scrollbar_show_plain;
+    }
+#endif
 #if defined(XTERM_SCROLLBAR)
     if (scrollBar.style == R_SB_XTERM) {
        scrollBar.beg = R_SCROLLBEG_XTERM;
@@ -165,17 +171,19 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co
     int             i;
     short           style, width;
 
-# if defined(RXVT_SCROLLBAR) || !(defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR))
+# if defined(RXVT_SCROLLBAR)
     style = R_SB_RXVT;
-# else
-#  ifdef NEXT_SCROLLBAR
-    style = R_SB_NEXT;
-#  elif defined(XTERM_SCROLLBAR)
+# elif defined(XTERM_SCROLLBAR)
     style = R_SB_XTERM;
-#  endif
+# elif defined(NEXT_SCROLLBAR)
+    style = R_SB_NEXT;
+# elif defined(PLAIN_SCROLLBAR)
+    style = R_SB_PLAIN;
+#else
+    style = R_SB_RXVT;
 # endif
 
-# if (defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR))
+# if (defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR))
     if (scrollstyle) {
 #  ifdef NEXT_SCROLLBAR
        if (STRNCASECMP(scrollstyle, "next", 4) == 0)
@@ -184,6 +192,10 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co
 #  ifdef XTERM_SCROLLBAR
        if (STRNCASECMP(scrollstyle, "xterm", 5) == 0)
            style = R_SB_XTERM;
+#  endif
+#  ifdef PLAIN_SCROLLBAR
+       if (STRNCASECMP(scrollstyle, "plain", 5) == 0)
+           style = R_SB_XTERM;
 #  endif
     }
 # endif
@@ -191,6 +203,8 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co
        width = SB_WIDTH_NEXT;
     else if (style == R_SB_XTERM)
        width = SB_WIDTH_XTERM;
+    else if (style == R_SB_PLAIN)
+       width = SB_WIDTH_PLAIN;
     else /* if (style == R_SB_RXVT) */
        width = SB_WIDTH_RXVT;
 
@@ -217,3 +231,4 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co
 }
 
 /*----------------------- end-of-file (C source) -----------------------*/
+