[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kterm -rightbar patch



緒方です。

パッチ作者の清水さんにも連絡として送ってます。

http://home.jp.FreeBSD.ORG/cgi-bin/showmail/FreeBSD-users-jp/64149
のパッチを pkgsrc/x11/kterm で使えるようにするパッチです。

env KTERM_USE_RIGHTBAR=YES make とかで有効になります。

手元でも問題なくうごいてます。on SPARC で。



OGATA Hiroshi   <ogata@isp.qix.org>   BSD lover :)
CBUG : Tokyo west area BSD Users Group   http://www.cbug.bug.gr.jp/
diff -u -r -N kterm.org/Makefile kterm/Makefile
--- kterm.org/Makefile	Thu Aug 23 13:26:55 2001
+++ kterm/Makefile	Sun Oct 21 17:38:14 2001
@@ -38,5 +38,11 @@
 	@${PATCH} ${PATCH_ARGS} < ${FILESDIR}/patch-xaw3d
 .endif
 
+.if defined(KTERM_USE_RIGHTBAR) && ${KTERM_USE_RIGHTBAR} == "YES"
+post-patch:
+	@${ECHO_MSG}  "===>  Applying rightbar patch"
+	@${PATCH} ${PATCH_ARGS} < ${FILESDIR}/patch-rightbar
+.endif
+
 .include "../../mk/xaw.buildlink.mk"
 .include "../../mk/bsd.pkg.mk"
diff -u -r -N kterm.org/files/patch-rightbar kterm/files/patch-rightbar
--- kterm.org/files/patch-rightbar	Thu Jan  1 09:00:00 1970
+++ kterm/files/patch-rightbar	Sun Oct 21 17:30:06 2001
@@ -0,0 +1,534 @@
+--- Imakefile.org	Fri Jul 12 14:01:04 1996
++++ Imakefile	Sun Sep  9 05:04:36 2001
+@@ -32,7 +32,7 @@
+ 		  -DOSMINORVERSION=$(OSMINORVERSION)
+    MISC_DEFINES = /* -DALLOWLOGFILEEXEC */ 
+     XKB_DEFINES = XkbClientDefines
+-        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE
++        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE -DSCROLLBAR_RIGHT 
+ 
+ #ifdef KTERM_XIM
+         XIMSRCS = xim.c
+--- button.c.org	Tue Jul  2 14:01:46 1996
++++ button.c	Sun Sep  9 05:03:27 2001
+@@ -849,7 +849,7 @@
+ 		row = firstValidRow;
+ 	else if(row > lastValidRow)
+ 		row = lastValidRow;
+-	col = (x - screen->border - screen->scrollbar) / FontWidth(screen);
++	col = (x - OriginX(screen)) / FontWidth(screen);
+ 	if(col < 0)
+ 		col = 0;
+ 	else if(col > screen->max_col+1) {
+@@ -1817,8 +1817,7 @@
+ 
+ 	row = (event->y - screen->border) 
+ 	 / FontHeight(screen);
+-	col = (event->x - screen->border - screen->scrollbar)
+-	 / FontWidth(screen);
++	col = (event->x - OriginX(screen)) / FontWidth(screen);
+ 	(void) strcpy(line, "\033[M");
+ 	if (screen->send_mouse_pos == 1) {
+ 		line[3] = ' ' + button;
+--- charproc.c.org	Fri Jul 12 14:01:36 1996
++++ charproc.c	Sun Sep  9 05:03:27 2001
+@@ -167,6 +167,9 @@
+ #define XtNnMarginBell "nMarginBell"
+ #define XtNresizeGravity "resizeGravity"
+ #define XtNreverseWrap "reverseWrap"
++#ifdef SCROLLBAR_RIGHT
++#define XtNrightScrollBar "rightScrollBar"
++#endif
+ #define XtNautoWrap "autoWrap"
+ #define XtNsaveLines "saveLines"
+ #define XtNscrollBar "scrollBar"
+@@ -227,6 +230,9 @@
+ #define XtCColumn "Column"
+ #define XtCResizeGravity "ResizeGravity"
+ #define XtCReverseWrap "ReverseWrap"
++#ifdef SCROLLBAR_RIGHT
++#define XtCRightScrollBar "RightScrollBar"
++#endif
+ #define XtCAutoWrap "AutoWrap"
+ #define XtCSaveLines "SaveLines"
+ #define XtCScrollBar "ScrollBar"
+@@ -660,6 +666,11 @@
+ {XtNscrollBar, XtCScrollBar, XtRBoolean, sizeof(Boolean),
+ 	XtOffsetOf(XtermWidgetRec, misc.scrollbar),
+ 	XtRBoolean, (XtPointer) &defaultFALSE},
++#ifdef SCROLLBAR_RIGHT
++{XtNrightScrollBar, XtCRightScrollBar, XtRBoolean, sizeof(Boolean),
++	XtOffsetOf(XtermWidgetRec, misc.useRight),
++	XtRBoolean, (XtPointer) &defaultFALSE},
++#endif
+ {XtNscrollTtyOutput,XtCScrollCond, XtRBoolean, sizeof(Boolean),
+ 	XtOffsetOf(XtermWidgetRec, screen.scrollttyoutput),
+ 	XtRBoolean, (XtPointer) &defaultTRUE},
+@@ -2539,8 +2550,7 @@
+ 					status = XtMakeResizeRequest (
+ 					    (Widget) termw, 
+ 					    (Dimension) FontWidth(screen) * j
+-					        + 2*screen->border
+-						+ screen->scrollbar,
++					        + 2*screen->border + Scrollbar(screen),
+ 					    (Dimension) FontHeight(screen)
+ 						* (screen->max_row + 1)
+ #ifdef STATUSLINE
+@@ -2780,8 +2790,7 @@
+ 					status = XtMakeResizeRequest (
+ 					    (Widget) termw,
+ 					    (Dimension) FontWidth(screen) * j 
+-						+ 2*screen->border
+-						+ screen->scrollbar,
++						+ 2*screen->border + Scrollbar(screen),
+ 					    (Dimension) FontHeight(screen)
+ 						* (screen->max_row + 1)
+ 						+ 2*screen->border,
+@@ -3033,7 +3042,7 @@
+ 			XClearArea(
+ 			    screen->display,
+ 			    TextWindow(screen),
+-			    (int) screen->border + screen->scrollbar,
++			    (int) OriginX(screen),
+ 			    (int) top * FontHeight(screen) + screen->border,
+ 			    (unsigned) Width(screen),
+ 			    (unsigned) (screen->max_row - top + 1)
+@@ -4147,7 +4156,7 @@
+ 			XtMakeResizeRequest(
+ 			    (Widget) term,
+ 			    (Dimension) 80*FontWidth(screen)
+-				+ 2 * screen->border + screen->scrollbar,
++				+ 2 * screen->border + Scrollbar(screen),
+ #ifdef STATUSLINE
+ 			    (Dimension) screen->statusheight +
+ #endif /* STATUSLINE */
+@@ -4207,8 +4216,7 @@
+ 	screen->statusheight = FontHeight(screen) + 2;
+ 	DoResizeScreen(term);
+ 	if (screen->scrollWidget)
+-		ResizeScrollBar(screen->scrollWidget, -1, -1,
+-		  Height(screen) + screen->border * 2 + screen->statusheight);
++		ResizeScrollBar(screen);
+ }
+ 
+ HideStatus()
+@@ -4259,7 +4267,7 @@
+ # endif /* !KTERM */
+ 	XFillRectangle(screen->display, TextWindow(screen),
+ 		screen->reversestatus ? screen->normalGC : screen->reverseGC,
+-		screen->border - 1 + screen->scrollbar,
++		screen->border - 1 + Scrollbar(screen),
+ 		Height(screen) + screen->border * 2 + 1,
+ 		Width(screen),
+ 		screen->statusheight - 2);
+@@ -4273,7 +4281,7 @@
+ # endif /* KTERM */
+ 	XDrawRectangle(screen->display, TextWindow(screen),
+ 		       screen->normalGC,
+-		       screen->scrollbar,
++		       ScrollbarX(screen),
+ 		       Height(screen) + screen->border * 2,
+ 		       Width(screen) + screen->border * 2 - 1,
+ 		       screen->statusheight - 1);
+--- input.c.org	Fri Jul 12 14:01:36 1996
++++ input.c	Sun Sep  9 05:03:27 2001
+@@ -37,7 +37,7 @@
+ 
+ static char *kypd_num = " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-./0123456789XXX=";
+ static char *kypd_apl = " ABCDEFGHIJKLMNOPQRSTUVWXYZ??????abcdefghijklmnopqrstuvwxyzXXX";
+-static char *cur = "DACB";
++static char *cur = "HDACB  FE";
+ 
+ static int funcvalue(), sunfuncvalue();
+ extern Boolean sunFunctionKeys;
+@@ -129,10 +129,10 @@
+        		if (keyboard->flags & CURSOR_APL) {
+ 			reply.a_type = SS3;
+ 			unparseseq(&reply, pty);
+-			unparseputc(cur[keysym-XK_Left], pty);
++			unparseputc(cur[keysym-XK_Home], pty);
+ 		} else {
+ 			reply.a_type = CSI;
+-			reply.a_final = cur[keysym-XK_Left];
++			reply.a_final = cur[keysym-XK_Home];
+ 			unparseseq(&reply, pty);
+ 		}
+ 		key = TRUE;
+--- kinput2.c.org	Fri Jul 12 14:01:42 1996
++++ kinput2.c	Sun Sep  9 05:03:27 2001
+@@ -284,7 +284,7 @@
+     TScreen *screen = &term->screen;
+     static XRectangle area;
+ 
+-    area.x = screen->border + screen->scrollbar;
++    area.x = OriginX(screen);
+     area.y = screen->border;
+     area.width = Width(screen);
+     area.height = Height(screen);
+--- kterm.h.org	Fri Jul 12 14:01:37 1996
++++ kterm.h	Sun Sep  9 05:03:27 2001
+@@ -36,6 +36,6 @@
+ #define KTERM_KINPUT2	/* Kinput2 protocol */
+ #define KTERM_COLOR	/* color sequence */
+ #define KTERM_NOTEK	/* disables Tektronix emulation */
+-#undef  KTERM_XAW3D	/* Xaw3d -DARROW_SCROLLBAR support */
++#define KTERM_XAW3D	/* Xaw3d -DARROW_SCROLLBAR support */
+ 
+ #endif /* !_KTERM_H_ */
+--- main.c.org	Fri Jul 12 14:01:38 1996
++++ main.c	Sun Sep  9 05:03:27 2001
+@@ -745,6 +745,10 @@
+ {"+s",		"*multiScroll",	XrmoptionNoArg,		(caddr_t) "off"},
+ {"-sb",		"*scrollBar",	XrmoptionNoArg,		(caddr_t) "on"},
+ {"+sb",		"*scrollBar",	XrmoptionNoArg,		(caddr_t) "off"},
++#ifdef SCROLLBAR_RIGHT
++{"-leftbar",    "*rightScrollBar", XrmoptionNoArg,  (caddr_t) "off"},
++{"-rightbar",   "*rightScrollBar", XrmoptionNoArg,  (caddr_t) "on"},
++#endif
+ {"-sf",		"*sunFunctionKeys", XrmoptionNoArg,	(caddr_t) "on"},
+ {"+sf",		"*sunFunctionKeys", XrmoptionNoArg,	(caddr_t) "off"},
+ {"-si",		"*scrollTtyOutput",	XrmoptionNoArg,		(caddr_t) "off"},
+@@ -859,6 +863,10 @@
+ { "-/+rw",                 "turn on/off reverse wraparound" },
+ { "-/+s",                  "turn on/off multiscroll" },
+ { "-/+sb",                 "turn on/off scrollbar" },
++#ifdef SCROLLBAR_RIGHT
++{ "-rightbar",             "force scrollbar right (default left)" },
++{ "-leftbar",              "force scrollbar left" },
++#endif
+ { "-/+sf",                 "turn on/off Sun Function Key escape codes" },
+ { "-/+si",                 "turn on/off scroll-on-tty-output inhibit" },
+ { "-/+sk",                 "turn on/off scroll-on-keypress" },
+--- ptyx.h.org	Tue Jul  2 14:01:53 1996
++++ ptyx.h	Sun Sep  9 05:03:27 2001
+@@ -546,6 +546,9 @@
+     Boolean tekInhibit;
+ #endif /* !KTERM_NOTEK */
+     Boolean scrollbar;
++#ifdef SCROLLBAR_RIGHT
++	Boolean useRight;
++#endif
+     Boolean titeInhibit;
+ #ifndef KTERM_NOTEK
+     Boolean tekSmall;	/* start tek window in small size */
+@@ -708,8 +711,17 @@
+ #define TekScale(screen)	(screen->fullTwin.tekscale)
+ #endif /* !KTERM_NOTEK */
+ 
+-#define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
+-			+ screen->scrollbar)
++#define Scrollbar(screen)	((screen)->scrollbar)
++
++#ifdef SCROLLBAR_RIGHT
++#define ScrollbarX(screen)	((term->misc.useRight)?0:Scrollbar(screen))
++#define OriginX(screen)	(ScrollbarX(screen) + screen->border)
++#else
++#define ScrollbarX(screen)	(Scrollbar(screen))
++#define OriginX(screen)	(Scrollbar(screen) + screen->border)
++#endif
++
++#define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen))
+ #ifdef STATUSLINE
+ #define CursorY(screen,row) ((row)>screen->max_row \
+ 	? (row) * FontHeight(screen) + screen->border * 2 + 1 \
+--- screen.c.org	Sun Jun 23 17:00:26 1996
++++ screen.c	Sun Sep  9 05:03:27 2001
+@@ -601,7 +601,7 @@
+ 		left = CursorX(screen, leftcol);
+ 		width = ncols * FontWidth(screen);
+ 		if (leftcol == 0) {
+-		    left = screen->scrollbar;
++		    left = ScrollbarX(screen);
+ 		    width += screen->border;
+ 		}
+ 		if (leftcol + ncols - 1 >= screen->max_col)
+@@ -869,7 +869,7 @@
+ 	rows = (height + FontHeight(screen) / 2 - border) /
+ #endif /* !STATUSLINE */
+ 	 FontHeight(screen);
+-	cols = (width + FontWidth(screen) / 2 - border - screen->scrollbar) /
++	cols = (width + FontWidth(screen) / 2 - border - Scrollbar(screen)) /
+ 	 FontWidth(screen);
+ 	if (rows < 1) rows = 1;
+ 	if (cols < 1) cols = 1;
+@@ -879,7 +879,7 @@
+ 		/* bit_gravity != ForgetGravity */
+ 		if (rows > screen->max_row + 1) {
+ 		    XClearArea (screen->display, tw, 
+-				screen->scrollbar,
++				ScrollbarX(screen),
+ 				(screen->max_row + 1) * FontHeight(screen) +
+ 				screen->border * 2,
+ 				(screen->max_col + 1) * FontHeight(screen) +
+@@ -888,7 +888,7 @@
+ 				True);
+ 		} else if (rows < screen->max_row + 1) {
+ 		    XClearArea (screen->display, tw, 
+-				screen->scrollbar,
++				ScrollbarX(screen),
+ 				rows * FontHeight(screen) +
+ 				screen->border * 2,
+ 				cols * FontWidth(screen) + screen->border * 2,
+@@ -964,13 +964,16 @@
+ #else /* !STATUSLINE */
+ 		screen->fullVwin.height = height - border;
+ #endif /* !STATUSLINE */
+-		screen->fullVwin.width = width - border - screen->scrollbar;
++		screen->fullVwin.width = width - border - Scrollbar(screen);
+ 
+ 	} else if(FullHeight(screen) == height && FullWidth(screen) == width)
+ 	 	return(0);	/* nothing has changed at all */
+ 
++	screen->fullVwin.fullheight = height;
++	screen->fullVwin.fullwidth = width;
++
+ 	if(screen->scrollWidget)
+-		ResizeScrollBar(screen->scrollWidget, -1, -1, height);
++		ResizeScrollBar(screen);
+ 	
+ 	screen->fullVwin.fullheight = height;
+ 	screen->fullVwin.fullwidth = width;
+--- scrollbar.c.org	Fri Jul 12 14:01:39 1996
++++ scrollbar.c	Sun Sep  9 05:06:08 2001
+@@ -205,13 +205,6 @@
+ 	return (scrollWidget);
+ }
+ 
+-static void RealizeScrollBar (sbw, screen)
+-    Widget sbw;
+-    TScreen *screen;
+-{
+-    XtRealizeWidget (sbw);
+-}
+-
+ 
+ ScrollBarReverseVideo(scrollWidget)
+ 	register Widget scrollWidget;
+@@ -255,14 +248,28 @@
+ 	
+ }
+ 
+-ResizeScrollBar(scrollWidget, x, y, height)
+-	register Widget scrollWidget;
+-	int x, y;
+-	unsigned height;
++void
++ResizeScrollBar(TScreen *screen)
+ {
+-	XtConfigureWidget(scrollWidget, x, y, scrollWidget->core.width,
+-	    height, scrollWidget->core.border_width);
+-	ScrollBarDrawThumb(scrollWidget);
++	XtConfigureWidget(
++		screen->scrollWidget,
++#ifdef SCROLLBAR_RIGHT
++			(term->misc.useRight)
++			? (screen->fullVwin.fullwidth -
++			   screen->scrollWidget->core.width -
++			   screen->scrollWidget->core.border_width)
++			: -1,
++#else
++		-1,
++#endif
++		-1,
++		screen->scrollWidget->core.width,
++#ifdef STATUSLINE
++		screen->statusheight +
++#endif /* STATUSLINE */
++		screen->fullVwin.height + screen->border * 2,
++		screen->scrollWidget->core.border_width);
++	ScrollBarDrawThumb(screen->scrollWidget);
+ }
+ 
+ WindowScroll(screen, top)
+@@ -297,7 +304,7 @@
+ 		scrolltop = lines;
+ 		refreshtop = scrollheight;
+ 	}
+-	x = screen->scrollbar +	screen->border;
++ 	x = OriginX(screen);
+ 	scrolling_copy_area(screen, scrolltop, scrollheight, -i);
+ 	screen->topline = top;
+ 
+@@ -385,17 +392,28 @@
+ #endif /* !KTERM */
+ 	}
+ 
+-	ResizeScrollBar (screen->scrollWidget, -1, -1, 
+-#ifdef STATUSLINE
+-			 screen->statusheight +
+-#endif /* STATUSLINE */
+-			 Height (screen) + border);
+-	RealizeScrollBar (screen->scrollWidget, screen);
++	ResizeScrollBar (screen);
++	XtRealizeWidget (screen->scrollWidget);
+ 	screen->scrollbar = screen->scrollWidget->core.width +
+ 	     screen->scrollWidget->core.border_width;
+ 
+ 	ScrollBarDrawThumb(screen->scrollWidget);
+ 	DoResizeScreen (xw);
++
++#ifdef SCROLLBAR_RIGHT
++	/*
++	 * Adjust the scrollbar position if we're asked to turn on scrollbars
++	 * for the first time after the xterm is already running.  That makes
++	 * the window grow after we've initially configured the scrollbar's
++	 * position.  (There must be a better way).
++	 */
++	if (term->misc.useRight
++	 && screen->fullVwin.fullwidth < term->core.width)
++		XtVaSetValues(screen->scrollWidget, XtNx,
++		screen->fullVwin.fullwidth - screen->scrollWidget->core.border_width,
++        NULL);
++#endif
++
+ 	XtMapWidget(screen->scrollWidget);
+ 	update_scrollbar ();
+ 	if (screen->buf) {
+--- util.c.org	Tue Jul  2 14:01:53 1996
++++ util.c	Sun Sep  9 05:07:49 2001
+@@ -116,7 +116,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -240,7 +240,7 @@
+ 		XClearArea (
+ 		   screen->display,
+ 		   TextWindow(screen),
+-		   (int) screen->border + screen->scrollbar,
++		   (int) OriginX(screen),
+ 		   (int) refreshtop * FontHeight(screen) + screen->border,
+ 		   (unsigned) Width(screen),
+ 		   (unsigned) refreshheight * FontHeight(screen),
+@@ -320,7 +320,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -381,7 +381,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -458,7 +458,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -570,7 +570,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar
++		     OriginX(screen)
+ 		       + Width(screen) - n*FontWidth(screen),
+ 		     CursorY (screen, screen->cur_row), n * FontWidth(screen),
+ 		     FontHeight(screen));
+@@ -599,8 +599,8 @@
+ 			height = screen->max_row;
+ 		if((height -= top) > 0)
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, top *
+-			 FontHeight(screen) + screen->border,
++			 OriginX(screen),
++             top * FontHeight(screen) + screen->border,
+ 			 Width(screen), height * FontHeight(screen), FALSE);
+ 
+ 		if(screen->cur_row - screen->topline <= screen->max_row)
+@@ -623,8 +623,8 @@
+ 			FlushScroll(screen);
+ 		if(++top <= screen->max_row)
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, top *
+-			 FontHeight(screen) + screen->border,
++			 OriginX(screen),
++             top * FontHeight(screen) + screen->border,
+ 			 Width(screen), (screen->max_row - top + 1) *
+ 			 FontHeight(screen), FALSE);
+ 	}
+@@ -713,7 +713,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar,
++		     OriginX(screen),
+ 		      CursorY (screen, screen->cur_row),
+ 		     (screen->cur_col + 1) * FontWidth(screen),
+ 		     FontHeight(screen));
+@@ -764,7 +764,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar,
++		     OriginX(screen),
+ 		      CursorY (screen, screen->cur_row),
+ 		     Width(screen), FontHeight(screen));
+ 	    }
+@@ -796,7 +796,7 @@
+ 			XClearWindow(screen->display, TextWindow(screen));
+ 		else
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, 
++			 OriginX(screen),
+ 			 top * FontHeight(screen) + screen->border,	
+ 		 	 Width(screen), (screen->max_row - top + 1) *
+ 			 FontHeight(screen), FALSE);
+@@ -913,7 +913,7 @@
+     int amount;			/* number of lines to move up (neg=down) */
+ {
+     if(nlines > 0) {
+-	int src_x = screen->border + screen->scrollbar;
++ 	int src_x = OriginX(screen);
+ 	int src_y = firstline * FontHeight(screen) + screen->border;
+ 
+ 	copy_area(screen, src_x, src_y,
+@@ -1001,15 +1001,13 @@
+ 	if(toprow > screen->max_row + 1)
+ 		toprow = screen->max_row + 1;
+ #endif /* STATUSLINE */
+-	leftcol = (rect_x - screen->border - screen->scrollbar)
+-	    / FontWidth(screen);
++	leftcol = (rect_x - OriginX(screen)) / FontWidth(screen);
+ 	if(leftcol < 0)
+ 		leftcol = 0;
+ 	nrows = (rect_y + rect_height - 1 - screen->border) / 
+-		FontHeight(screen) - toprow + 1;
+-	ncols =
+-	 (rect_x + rect_width - 1 - screen->border - screen->scrollbar) /
+-			FontWidth(screen) - leftcol + 1;
++    	FontHeight(screen) - toprow + 1;
++	ncols = (rect_x + rect_width - 1 - OriginX(screen)) /
++		FontWidth(screen) - leftcol + 1;
+ 	toprow -= screen->scrolls;
+ 	if (toprow < 0) {
+ 		nrows += toprow;
+--- xim.c.org	Fri Jul 12 14:01:43 1996
++++ xim.c	Sun Sep  9 05:03:27 2001
+@@ -149,9 +149,9 @@
+ TScreen *screen;
+ XRectangle *rect_p;
+ {
+-	rect_p->x = screen->scrollbar;
++	rect_p->x = ScrollbarX(screen);
+ 	rect_p->y = 0;
+-	rect_p->width  = FullWidth(screen)  - screen->scrollbar;
++	rect_p->width  = FullWidth(screen)  - Scrollbar(screen);
+ 	rect_p->height = FullHeight(screen);
+ }
+ 
diff -u -r -N kterm.org/files/patch-rightbar.orig kterm/files/patch-rightbar.orig
--- kterm.org/files/patch-rightbar.orig	Thu Jan  1 09:00:00 1970
+++ kterm/files/patch-rightbar.orig	Sun Oct 21 17:03:18 2001
@@ -0,0 +1,545 @@
+--- Imakefile.org	Fri Jul 12 14:01:04 1996
++++ Imakefile	Sun Sep  9 05:04:36 2001
+@@ -32,7 +32,7 @@
+ 		  -DOSMINORVERSION=$(OSMINORVERSION)
+    MISC_DEFINES = /* -DALLOWLOGFILEEXEC */ 
+     XKB_DEFINES = XkbClientDefines
+-        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE
++        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE -DSCROLLBAR_RIGHT 
+ 
+ #ifdef KTERM_XIM
+         XIMSRCS = xim.c
+--- Makefile.org	Sun Sep  9 05:03:19 2001
++++ Makefile	Sun Sep  9 05:05:04 2001
+@@ -663,7 +663,7 @@
+ 
+    MISC_DEFINES =
+     XKB_DEFINES =
+-        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE
++        DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE -DSCROLLBAR_RIGHT
+ 
+         XIMSRCS = xim.c
+         XIMOBJS = xim.o
+--- button.c.org	Tue Jul  2 14:01:46 1996
++++ button.c	Sun Sep  9 05:03:27 2001
+@@ -849,7 +849,7 @@
+ 		row = firstValidRow;
+ 	else if(row > lastValidRow)
+ 		row = lastValidRow;
+-	col = (x - screen->border - screen->scrollbar) / FontWidth(screen);
++	col = (x - OriginX(screen)) / FontWidth(screen);
+ 	if(col < 0)
+ 		col = 0;
+ 	else if(col > screen->max_col+1) {
+@@ -1817,8 +1817,7 @@
+ 
+ 	row = (event->y - screen->border) 
+ 	 / FontHeight(screen);
+-	col = (event->x - screen->border - screen->scrollbar)
+-	 / FontWidth(screen);
++	col = (event->x - OriginX(screen)) / FontWidth(screen);
+ 	(void) strcpy(line, "\033[M");
+ 	if (screen->send_mouse_pos == 1) {
+ 		line[3] = ' ' + button;
+--- charproc.c.org	Fri Jul 12 14:01:36 1996
++++ charproc.c	Sun Sep  9 05:03:27 2001
+@@ -167,6 +167,9 @@
+ #define XtNnMarginBell "nMarginBell"
+ #define XtNresizeGravity "resizeGravity"
+ #define XtNreverseWrap "reverseWrap"
++#ifdef SCROLLBAR_RIGHT
++#define XtNrightScrollBar "rightScrollBar"
++#endif
+ #define XtNautoWrap "autoWrap"
+ #define XtNsaveLines "saveLines"
+ #define XtNscrollBar "scrollBar"
+@@ -227,6 +230,9 @@
+ #define XtCColumn "Column"
+ #define XtCResizeGravity "ResizeGravity"
+ #define XtCReverseWrap "ReverseWrap"
++#ifdef SCROLLBAR_RIGHT
++#define XtCRightScrollBar "RightScrollBar"
++#endif
+ #define XtCAutoWrap "AutoWrap"
+ #define XtCSaveLines "SaveLines"
+ #define XtCScrollBar "ScrollBar"
+@@ -660,6 +666,11 @@
+ {XtNscrollBar, XtCScrollBar, XtRBoolean, sizeof(Boolean),
+ 	XtOffsetOf(XtermWidgetRec, misc.scrollbar),
+ 	XtRBoolean, (XtPointer) &defaultFALSE},
++#ifdef SCROLLBAR_RIGHT
++{XtNrightScrollBar, XtCRightScrollBar, XtRBoolean, sizeof(Boolean),
++	XtOffsetOf(XtermWidgetRec, misc.useRight),
++	XtRBoolean, (XtPointer) &defaultFALSE},
++#endif
+ {XtNscrollTtyOutput,XtCScrollCond, XtRBoolean, sizeof(Boolean),
+ 	XtOffsetOf(XtermWidgetRec, screen.scrollttyoutput),
+ 	XtRBoolean, (XtPointer) &defaultTRUE},
+@@ -2539,8 +2550,7 @@
+ 					status = XtMakeResizeRequest (
+ 					    (Widget) termw, 
+ 					    (Dimension) FontWidth(screen) * j
+-					        + 2*screen->border
+-						+ screen->scrollbar,
++					        + 2*screen->border + Scrollbar(screen),
+ 					    (Dimension) FontHeight(screen)
+ 						* (screen->max_row + 1)
+ #ifdef STATUSLINE
+@@ -2780,8 +2790,7 @@
+ 					status = XtMakeResizeRequest (
+ 					    (Widget) termw,
+ 					    (Dimension) FontWidth(screen) * j 
+-						+ 2*screen->border
+-						+ screen->scrollbar,
++						+ 2*screen->border + Scrollbar(screen),
+ 					    (Dimension) FontHeight(screen)
+ 						* (screen->max_row + 1)
+ 						+ 2*screen->border,
+@@ -3033,7 +3042,7 @@
+ 			XClearArea(
+ 			    screen->display,
+ 			    TextWindow(screen),
+-			    (int) screen->border + screen->scrollbar,
++			    (int) OriginX(screen),
+ 			    (int) top * FontHeight(screen) + screen->border,
+ 			    (unsigned) Width(screen),
+ 			    (unsigned) (screen->max_row - top + 1)
+@@ -4147,7 +4156,7 @@
+ 			XtMakeResizeRequest(
+ 			    (Widget) term,
+ 			    (Dimension) 80*FontWidth(screen)
+-				+ 2 * screen->border + screen->scrollbar,
++				+ 2 * screen->border + Scrollbar(screen),
+ #ifdef STATUSLINE
+ 			    (Dimension) screen->statusheight +
+ #endif /* STATUSLINE */
+@@ -4207,8 +4216,7 @@
+ 	screen->statusheight = FontHeight(screen) + 2;
+ 	DoResizeScreen(term);
+ 	if (screen->scrollWidget)
+-		ResizeScrollBar(screen->scrollWidget, -1, -1,
+-		  Height(screen) + screen->border * 2 + screen->statusheight);
++		ResizeScrollBar(screen);
+ }
+ 
+ HideStatus()
+@@ -4259,7 +4267,7 @@
+ # endif /* !KTERM */
+ 	XFillRectangle(screen->display, TextWindow(screen),
+ 		screen->reversestatus ? screen->normalGC : screen->reverseGC,
+-		screen->border - 1 + screen->scrollbar,
++		screen->border - 1 + Scrollbar(screen),
+ 		Height(screen) + screen->border * 2 + 1,
+ 		Width(screen),
+ 		screen->statusheight - 2);
+@@ -4273,7 +4281,7 @@
+ # endif /* KTERM */
+ 	XDrawRectangle(screen->display, TextWindow(screen),
+ 		       screen->normalGC,
+-		       screen->scrollbar,
++		       ScrollbarX(screen),
+ 		       Height(screen) + screen->border * 2,
+ 		       Width(screen) + screen->border * 2 - 1,
+ 		       screen->statusheight - 1);
+--- input.c.org	Fri Jul 12 14:01:36 1996
++++ input.c	Sun Sep  9 05:03:27 2001
+@@ -37,7 +37,7 @@
+ 
+ static char *kypd_num = " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-./0123456789XXX=";
+ static char *kypd_apl = " ABCDEFGHIJKLMNOPQRSTUVWXYZ??????abcdefghijklmnopqrstuvwxyzXXX";
+-static char *cur = "DACB";
++static char *cur = "HDACB  FE";
+ 
+ static int funcvalue(), sunfuncvalue();
+ extern Boolean sunFunctionKeys;
+@@ -129,10 +129,10 @@
+        		if (keyboard->flags & CURSOR_APL) {
+ 			reply.a_type = SS3;
+ 			unparseseq(&reply, pty);
+-			unparseputc(cur[keysym-XK_Left], pty);
++			unparseputc(cur[keysym-XK_Home], pty);
+ 		} else {
+ 			reply.a_type = CSI;
+-			reply.a_final = cur[keysym-XK_Left];
++			reply.a_final = cur[keysym-XK_Home];
+ 			unparseseq(&reply, pty);
+ 		}
+ 		key = TRUE;
+--- kinput2.c.org	Fri Jul 12 14:01:42 1996
++++ kinput2.c	Sun Sep  9 05:03:27 2001
+@@ -284,7 +284,7 @@
+     TScreen *screen = &term->screen;
+     static XRectangle area;
+ 
+-    area.x = screen->border + screen->scrollbar;
++    area.x = OriginX(screen);
+     area.y = screen->border;
+     area.width = Width(screen);
+     area.height = Height(screen);
+--- kterm.h.org	Fri Jul 12 14:01:37 1996
++++ kterm.h	Sun Sep  9 05:03:27 2001
+@@ -36,6 +36,6 @@
+ #define KTERM_KINPUT2	/* Kinput2 protocol */
+ #define KTERM_COLOR	/* color sequence */
+ #define KTERM_NOTEK	/* disables Tektronix emulation */
+-#undef  KTERM_XAW3D	/* Xaw3d -DARROW_SCROLLBAR support */
++#define KTERM_XAW3D	/* Xaw3d -DARROW_SCROLLBAR support */
+ 
+ #endif /* !_KTERM_H_ */
+--- main.c.org	Fri Jul 12 14:01:38 1996
++++ main.c	Sun Sep  9 05:03:27 2001
+@@ -745,6 +745,10 @@
+ {"+s",		"*multiScroll",	XrmoptionNoArg,		(caddr_t) "off"},
+ {"-sb",		"*scrollBar",	XrmoptionNoArg,		(caddr_t) "on"},
+ {"+sb",		"*scrollBar",	XrmoptionNoArg,		(caddr_t) "off"},
++#ifdef SCROLLBAR_RIGHT
++{"-leftbar",    "*rightScrollBar", XrmoptionNoArg,  (caddr_t) "off"},
++{"-rightbar",   "*rightScrollBar", XrmoptionNoArg,  (caddr_t) "on"},
++#endif
+ {"-sf",		"*sunFunctionKeys", XrmoptionNoArg,	(caddr_t) "on"},
+ {"+sf",		"*sunFunctionKeys", XrmoptionNoArg,	(caddr_t) "off"},
+ {"-si",		"*scrollTtyOutput",	XrmoptionNoArg,		(caddr_t) "off"},
+@@ -859,6 +863,10 @@
+ { "-/+rw",                 "turn on/off reverse wraparound" },
+ { "-/+s",                  "turn on/off multiscroll" },
+ { "-/+sb",                 "turn on/off scrollbar" },
++#ifdef SCROLLBAR_RIGHT
++{ "-rightbar",             "force scrollbar right (default left)" },
++{ "-leftbar",              "force scrollbar left" },
++#endif
+ { "-/+sf",                 "turn on/off Sun Function Key escape codes" },
+ { "-/+si",                 "turn on/off scroll-on-tty-output inhibit" },
+ { "-/+sk",                 "turn on/off scroll-on-keypress" },
+--- ptyx.h.org	Tue Jul  2 14:01:53 1996
++++ ptyx.h	Sun Sep  9 05:03:27 2001
+@@ -546,6 +546,9 @@
+     Boolean tekInhibit;
+ #endif /* !KTERM_NOTEK */
+     Boolean scrollbar;
++#ifdef SCROLLBAR_RIGHT
++	Boolean useRight;
++#endif
+     Boolean titeInhibit;
+ #ifndef KTERM_NOTEK
+     Boolean tekSmall;	/* start tek window in small size */
+@@ -708,8 +711,17 @@
+ #define TekScale(screen)	(screen->fullTwin.tekscale)
+ #endif /* !KTERM_NOTEK */
+ 
+-#define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
+-			+ screen->scrollbar)
++#define Scrollbar(screen)	((screen)->scrollbar)
++
++#ifdef SCROLLBAR_RIGHT
++#define ScrollbarX(screen)	((term->misc.useRight)?0:Scrollbar(screen))
++#define OriginX(screen)	(ScrollbarX(screen) + screen->border)
++#else
++#define ScrollbarX(screen)	(Scrollbar(screen))
++#define OriginX(screen)	(Scrollbar(screen) + screen->border)
++#endif
++
++#define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen))
+ #ifdef STATUSLINE
+ #define CursorY(screen,row) ((row)>screen->max_row \
+ 	? (row) * FontHeight(screen) + screen->border * 2 + 1 \
+--- screen.c.org	Sun Jun 23 17:00:26 1996
++++ screen.c	Sun Sep  9 05:03:27 2001
+@@ -601,7 +601,7 @@
+ 		left = CursorX(screen, leftcol);
+ 		width = ncols * FontWidth(screen);
+ 		if (leftcol == 0) {
+-		    left = screen->scrollbar;
++		    left = ScrollbarX(screen);
+ 		    width += screen->border;
+ 		}
+ 		if (leftcol + ncols - 1 >= screen->max_col)
+@@ -869,7 +869,7 @@
+ 	rows = (height + FontHeight(screen) / 2 - border) /
+ #endif /* !STATUSLINE */
+ 	 FontHeight(screen);
+-	cols = (width + FontWidth(screen) / 2 - border - screen->scrollbar) /
++	cols = (width + FontWidth(screen) / 2 - border - Scrollbar(screen)) /
+ 	 FontWidth(screen);
+ 	if (rows < 1) rows = 1;
+ 	if (cols < 1) cols = 1;
+@@ -879,7 +879,7 @@
+ 		/* bit_gravity != ForgetGravity */
+ 		if (rows > screen->max_row + 1) {
+ 		    XClearArea (screen->display, tw, 
+-				screen->scrollbar,
++				ScrollbarX(screen),
+ 				(screen->max_row + 1) * FontHeight(screen) +
+ 				screen->border * 2,
+ 				(screen->max_col + 1) * FontHeight(screen) +
+@@ -888,7 +888,7 @@
+ 				True);
+ 		} else if (rows < screen->max_row + 1) {
+ 		    XClearArea (screen->display, tw, 
+-				screen->scrollbar,
++				ScrollbarX(screen),
+ 				rows * FontHeight(screen) +
+ 				screen->border * 2,
+ 				cols * FontWidth(screen) + screen->border * 2,
+@@ -964,13 +964,16 @@
+ #else /* !STATUSLINE */
+ 		screen->fullVwin.height = height - border;
+ #endif /* !STATUSLINE */
+-		screen->fullVwin.width = width - border - screen->scrollbar;
++		screen->fullVwin.width = width - border - Scrollbar(screen);
+ 
+ 	} else if(FullHeight(screen) == height && FullWidth(screen) == width)
+ 	 	return(0);	/* nothing has changed at all */
+ 
++	screen->fullVwin.fullheight = height;
++	screen->fullVwin.fullwidth = width;
++
+ 	if(screen->scrollWidget)
+-		ResizeScrollBar(screen->scrollWidget, -1, -1, height);
++		ResizeScrollBar(screen);
+ 	
+ 	screen->fullVwin.fullheight = height;
+ 	screen->fullVwin.fullwidth = width;
+--- scrollbar.c.org	Fri Jul 12 14:01:39 1996
++++ scrollbar.c	Sun Sep  9 05:06:08 2001
+@@ -205,13 +205,6 @@
+ 	return (scrollWidget);
+ }
+ 
+-static void RealizeScrollBar (sbw, screen)
+-    Widget sbw;
+-    TScreen *screen;
+-{
+-    XtRealizeWidget (sbw);
+-}
+-
+ 
+ ScrollBarReverseVideo(scrollWidget)
+ 	register Widget scrollWidget;
+@@ -255,14 +248,28 @@
+ 	
+ }
+ 
+-ResizeScrollBar(scrollWidget, x, y, height)
+-	register Widget scrollWidget;
+-	int x, y;
+-	unsigned height;
++void
++ResizeScrollBar(TScreen *screen)
+ {
+-	XtConfigureWidget(scrollWidget, x, y, scrollWidget->core.width,
+-	    height, scrollWidget->core.border_width);
+-	ScrollBarDrawThumb(scrollWidget);
++	XtConfigureWidget(
++		screen->scrollWidget,
++#ifdef SCROLLBAR_RIGHT
++			(term->misc.useRight)
++			? (screen->fullVwin.fullwidth -
++			   screen->scrollWidget->core.width -
++			   screen->scrollWidget->core.border_width)
++			: -1,
++#else
++		-1,
++#endif
++		-1,
++		screen->scrollWidget->core.width,
++#ifdef STATUSLINE
++		screen->statusheight +
++#endif /* STATUSLINE */
++		screen->fullVwin.height + screen->border * 2,
++		screen->scrollWidget->core.border_width);
++	ScrollBarDrawThumb(screen->scrollWidget);
+ }
+ 
+ WindowScroll(screen, top)
+@@ -297,7 +304,7 @@
+ 		scrolltop = lines;
+ 		refreshtop = scrollheight;
+ 	}
+-	x = screen->scrollbar +	screen->border;
++ 	x = OriginX(screen);
+ 	scrolling_copy_area(screen, scrolltop, scrollheight, -i);
+ 	screen->topline = top;
+ 
+@@ -385,17 +392,28 @@
+ #endif /* !KTERM */
+ 	}
+ 
+-	ResizeScrollBar (screen->scrollWidget, -1, -1, 
+-#ifdef STATUSLINE
+-			 screen->statusheight +
+-#endif /* STATUSLINE */
+-			 Height (screen) + border);
+-	RealizeScrollBar (screen->scrollWidget, screen);
++	ResizeScrollBar (screen);
++	XtRealizeWidget (screen->scrollWidget);
+ 	screen->scrollbar = screen->scrollWidget->core.width +
+ 	     screen->scrollWidget->core.border_width;
+ 
+ 	ScrollBarDrawThumb(screen->scrollWidget);
+ 	DoResizeScreen (xw);
++
++#ifdef SCROLLBAR_RIGHT
++	/*
++	 * Adjust the scrollbar position if we're asked to turn on scrollbars
++	 * for the first time after the xterm is already running.  That makes
++	 * the window grow after we've initially configured the scrollbar's
++	 * position.  (There must be a better way).
++	 */
++	if (term->misc.useRight
++	 && screen->fullVwin.fullwidth < term->core.width)
++		XtVaSetValues(screen->scrollWidget, XtNx,
++		screen->fullVwin.fullwidth - screen->scrollWidget->core.border_width,
++        NULL);
++#endif
++
+ 	XtMapWidget(screen->scrollWidget);
+ 	update_scrollbar ();
+ 	if (screen->buf) {
+--- util.c.org	Tue Jul  2 14:01:53 1996
++++ util.c	Sun Sep  9 05:07:49 2001
+@@ -116,7 +116,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -240,7 +240,7 @@
+ 		XClearArea (
+ 		   screen->display,
+ 		   TextWindow(screen),
+-		   (int) screen->border + screen->scrollbar,
++		   (int) OriginX(screen),
+ 		   (int) refreshtop * FontHeight(screen) + screen->border,
+ 		   (unsigned) Width(screen),
+ 		   (unsigned) refreshheight * FontHeight(screen),
+@@ -320,7 +320,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -381,7 +381,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -458,7 +458,7 @@
+ 		XClearArea (
+ 		    screen->display,
+ 		    TextWindow(screen),
+-		    (int) screen->border + screen->scrollbar,
++		    (int) OriginX(screen),
+ 		    (int) refreshtop * FontHeight(screen) + screen->border,
+ 		    (unsigned) Width(screen),
+ 		    (unsigned) refreshheight * FontHeight(screen),
+@@ -570,7 +570,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar
++		     OriginX(screen)
+ 		       + Width(screen) - n*FontWidth(screen),
+ 		     CursorY (screen, screen->cur_row), n * FontWidth(screen),
+ 		     FontHeight(screen));
+@@ -599,8 +599,8 @@
+ 			height = screen->max_row;
+ 		if((height -= top) > 0)
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, top *
+-			 FontHeight(screen) + screen->border,
++			 OriginX(screen),
++             top * FontHeight(screen) + screen->border,
+ 			 Width(screen), height * FontHeight(screen), FALSE);
+ 
+ 		if(screen->cur_row - screen->topline <= screen->max_row)
+@@ -623,8 +623,8 @@
+ 			FlushScroll(screen);
+ 		if(++top <= screen->max_row)
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, top *
+-			 FontHeight(screen) + screen->border,
++			 OriginX(screen),
++             top * FontHeight(screen) + screen->border,
+ 			 Width(screen), (screen->max_row - top + 1) *
+ 			 FontHeight(screen), FALSE);
+ 	}
+@@ -713,7 +713,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar,
++		     OriginX(screen),
+ 		      CursorY (screen, screen->cur_row),
+ 		     (screen->cur_col + 1) * FontWidth(screen),
+ 		     FontHeight(screen));
+@@ -764,7 +764,7 @@
+ 		     screen->normalGC :
+ #endif /* STATUSLINE */
+ 		     screen->reverseGC,
+-		     screen->border + screen->scrollbar,
++		     OriginX(screen),
+ 		      CursorY (screen, screen->cur_row),
+ 		     Width(screen), FontHeight(screen));
+ 	    }
+@@ -796,7 +796,7 @@
+ 			XClearWindow(screen->display, TextWindow(screen));
+ 		else
+ 			XClearArea(screen->display, TextWindow(screen),
+-			 screen->border + screen->scrollbar, 
++			 OriginX(screen),
+ 			 top * FontHeight(screen) + screen->border,	
+ 		 	 Width(screen), (screen->max_row - top + 1) *
+ 			 FontHeight(screen), FALSE);
+@@ -913,7 +913,7 @@
+     int amount;			/* number of lines to move up (neg=down) */
+ {
+     if(nlines > 0) {
+-	int src_x = screen->border + screen->scrollbar;
++ 	int src_x = OriginX(screen);
+ 	int src_y = firstline * FontHeight(screen) + screen->border;
+ 
+ 	copy_area(screen, src_x, src_y,
+@@ -1001,15 +1001,13 @@
+ 	if(toprow > screen->max_row + 1)
+ 		toprow = screen->max_row + 1;
+ #endif /* STATUSLINE */
+-	leftcol = (rect_x - screen->border - screen->scrollbar)
+-	    / FontWidth(screen);
++	leftcol = (rect_x - OriginX(screen)) / FontWidth(screen);
+ 	if(leftcol < 0)
+ 		leftcol = 0;
+ 	nrows = (rect_y + rect_height - 1 - screen->border) / 
+-		FontHeight(screen) - toprow + 1;
+-	ncols =
+-	 (rect_x + rect_width - 1 - screen->border - screen->scrollbar) /
+-			FontWidth(screen) - leftcol + 1;
++    	FontHeight(screen) - toprow + 1;
++	ncols = (rect_x + rect_width - 1 - OriginX(screen)) /
++		FontWidth(screen) - leftcol + 1;
+ 	toprow -= screen->scrolls;
+ 	if (toprow < 0) {
+ 		nrows += toprow;
+--- xim.c.org	Fri Jul 12 14:01:43 1996
++++ xim.c	Sun Sep  9 05:03:27 2001
+@@ -149,9 +149,9 @@
+ TScreen *screen;
+ XRectangle *rect_p;
+ {
+-	rect_p->x = screen->scrollbar;
++	rect_p->x = ScrollbarX(screen);
+ 	rect_p->y = 0;
+-	rect_p->width  = FullWidth(screen)  - screen->scrollbar;
++	rect_p->width  = FullWidth(screen)  - Scrollbar(screen);
+ 	rect_p->height = FullHeight(screen);
+ }
+ 
diff -u -r -N kterm.org/files/patch-rightbar.rej kterm/files/patch-rightbar.rej
--- kterm.org/files/patch-rightbar.rej	Thu Jan  1 09:00:00 1970
+++ kterm/files/patch-rightbar.rej	Sun Oct 21 17:15:06 2001
@@ -0,0 +1,17 @@
+***************
+*** 663,669 ****
+  
+     MISC_DEFINES =
+      XKB_DEFINES =
+-         DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE
+  
+          XIMSRCS = xim.c
+          XIMOBJS = xim.o
+--- 663,669 ----
+  
+     MISC_DEFINES =
+      XKB_DEFINES =
++         DEFINES = $(XKB_DEFINES) $(XPOLL_DEF) -DKTERM -DSTATUSLINE -DKEEPALIVE -DSCROLLBAR_RIGHT
+  
+          XIMSRCS = xim.c
+          XIMOBJS = xim.o