-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: fc3ac1acf4e6ba8027c50627b89b553d80361b36:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit fc3ac1acf4e6ba8027c50627b89b553d80361b36
Author: Marc Lehmann <schmorp@schmorp.de>
Date:   Thu Dec 18 13:33:03 2003 +0000

    *** empty log message ***

diff --git a/src/command.C b/src/command.C

index bd612c9cc4cb8b8772a4e0427b25435d23f61eb0..

index ..28e8c0c10b3f6c1d9f290dabfd87003fe85fd3e5 100644

--- a/src/command.C
+++ b/src/command.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:	command.c
  *----------------------------------------------------------------------*
- * $Id: command.C,v 1.21 2003/12/18 08:06:46 pcg Exp $
+ * $Id: command.C,v 1.22 2003/12/18 13:33:02 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -681,15 +681,15 @@ rxvt_term::flush ()
   if (want_full_refresh)
     {
       want_full_refresh = 0;
-      rxvt_scr_clear (this);
-      rxvt_scr_touch (this, False);
+      scr_clear ();
+      scr_touch (false);
       want_refresh = 1;
     }
 #endif

   if (want_refresh)
     {
-      rxvt_scr_refresh (this, refresh_type);
+      scr_refresh (refresh_type);
       rxvt_scrollbar_show (this, 1);
 #ifdef USE_XIM
       rxvt_IMSendSpot (this);
@@ -889,7 +889,7 @@ rxvt_term::pty_cb (io_watcher &w, short revents)
                       if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
                         refresh_limit++;

-                      rxvt_scr_refresh (this, refresh_type);
+                      scr_refresh (refresh_type);
                     }

                 }
@@ -997,7 +997,7 @@ rxvt_cmd_getc(pR)
 	    if (!R->scroll_selection_delay--
 		&& rxvt_scr_page(aR_ R->scroll_selection_dir,
 		    R->scroll_selection_lines)) {
-		rxvt_selection_extend(aR_ R->selection_save_x,
+		R->selection_extend (R->selection_save_x,
 		    R->selection_save_y, R->selection_save_state);
 		R->scroll_selection_delay = SCROLLBAR_CONTINUOUS_DELAY;
 		R->refresh_type |= SMOOTH_REFRESH;
@@ -1071,7 +1071,7 @@ rxvt_mouse_report(pR_ const XButtonEvent *ev)

     x = ev->x;
     y = ev->y;
-    rxvt_pixel_position(aR_ &x, &y);
+    R->pixel_position (&x, &y);

     if (R->MEvent.button == AnyButton) {
 	button_number = 3;
@@ -1332,8 +1332,7 @@ rxvt_process_x_event(pR_ XEvent *ev)
 					    ConfigureNotify, ev));
 	    if (R->szHint.width != width || R->szHint.height != height) {
 		D_SIZE((stderr, "Size: Resizing from: %4d x %4d", R->szHint.width, R->szHint.height));
-		rxvt_resize_all_windows(aR_ (unsigned int)width,
-					(unsigned int)height, 1);
+		R->resize_all_windows (width, height, 1);
 	    }
 #ifdef DEBUG_SIZE
 	    else {
@@ -1402,12 +1401,12 @@ rxvt_process_x_event(pR_ XEvent *ev)
     case Expose:
 	if (ev->xany.window == R->TermWin.vt) {
 #ifdef NO_SLOW_LINK_SUPPORT
-	    rxvt_scr_expose(aR_ ev->xexpose.x, ev->xexpose.y,
-			    ev->xexpose.width, ev->xexpose.height, False);
+	    R->scr_expose (ev->xexpose.x, ev->xexpose.y,
+			   ev->xexpose.width, ev->xexpose.height, False);
 #else
             // don't understand this, so commented it out
-	    rxvt_scr_expose(aR_ ev->xexpose.x, ev->xexpose.y,
-			    ev->xexpose.width, ev->xexpose.height, False);
+	    R->scr_expose (ev->xexpose.x, ev->xexpose.y,
+			   ev->xexpose.width, ev->xexpose.height, False);
 	    //rxvt_scr_expose(aR_ ev->xexpose.x, 0,
 	    //		    ev->xexpose.width, R->TermWin.height, False);
 #endif
@@ -1462,7 +1461,7 @@ rxvt_process_x_event(pR_ XEvent *ev)
 	    /* deal with a `jumpy' mouse */
 		if ((ev->xmotion.time - R->MEvent.time) > MOUSE_THRESHOLD) {
 #endif
-		    rxvt_selection_extend(aR_ (ev->xbutton.x), (ev->xbutton.y),
+		    R->selection_extend ((ev->xbutton.x), (ev->xbutton.y),
 				  (ev->xbutton.state & Button3Mask) ? 2 : 0);
 #ifdef SELECTION_SCROLLING
 		    if (ev->xbutton.y<R->TermWin.int_bwidth ||
@@ -1521,7 +1520,7 @@ rxvt_process_x_event(pR_ XEvent *ev)
 			  &unused_mask);
 	    rxvt_scr_move_to(aR_ scrollbar_position(ev->xbutton.y) - R->csrO,
 			     scrollbar_size());
-	    rxvt_scr_refresh(aR_ R->refresh_type);
+	    R->scr_refresh (R->refresh_type);
 	    R->refresh_limit = 0;
 	    rxvt_scrollbar_show(aR_ 1);
 	}
@@ -1594,9 +1593,9 @@ rxvt_button_press(pR_ XButtonEvent *ev)
                         if (ev->state & ShiftMask)
                           {
                             if (R->MEvent.button == Button1 && clickintime)
-                              rxvt_selection_rotate (aR_ ev->x, ev->y);
+                              R->selection_rotate (ev->x, ev->y);
                             else
-                              rxvt_selection_extend (aR_ ev->x, ev->y, 1);
+                              R->selection_extend (ev->x, ev->y, 1);
                           }
                         else
                           {
@@ -1605,7 +1604,7 @@ rxvt_button_press(pR_ XButtonEvent *ev)
                             else
                               R->MEvent.clicks = 1;

-                            rxvt_selection_click (aR_ R->MEvent.clicks, ev->x, ev->y);
+                            R->selection_click (R->MEvent.clicks, ev->x, ev->y);
                           }

                         R->MEvent.button = Button1;
@@ -1613,9 +1612,9 @@ rxvt_button_press(pR_ XButtonEvent *ev)

                     case Button3:
                         if (R->MEvent.button == Button3 && clickintime)
-                          rxvt_selection_rotate(aR_ ev->x, ev->y);
+                          R->selection_rotate (ev->x, ev->y);
                         else
-                          rxvt_selection_extend(aR_ ev->x, ev->y, 1);
+                          R->selection_extend (ev->x, ev->y, 1);
                         R->MEvent.button = Button3;
                         break;
 	          }
@@ -1819,7 +1818,7 @@ rxvt_button_release(pR_ XButtonEvent *ev)
 	    if (R->PrivateModes & PrivMode_mouse_report
 		&& R->bypass_keystate
 		&& ev->button == Button1 && R->MEvent.clicks <= 1)
-		rxvt_selection_extend(aR_ ev->x, ev->y, 0);
+		R->selection_extend (ev->x, ev->y, 0);

 	    switch (ev->button) {
 	    case Button1:
@@ -1852,13 +1851,13 @@ rxvt_button_release(pR_ XButtonEvent *ev)
 # endif
 # ifdef JUMP_MOUSE_WHEEL
 		    rxvt_scr_page(aR_ v, i);
-		    rxvt_scr_refresh(aR_ SMOOTH_REFRESH);
+		    R->scr_refresh (SMOOTH_REFRESH);
 		    rxvt_scrollbar_show(aR_ 1);
 # else
-		    for (; i--;)
+		    while (i--)
                       {
 			rxvt_scr_page(aR_ v, 1);
-			rxvt_scr_refresh(aR_ SMOOTH_REFRESH);
+			R->scr_refresh (SMOOTH_REFRESH);
 			rxvt_scrollbar_show(aR_ 1);
 		      }
 # endif
@@ -2222,7 +2221,7 @@ rxvt_process_escape_vt52(pR_ unsigned char ch)
 	rxvt_scr_index(aR_ DN);
 	break;
     case 'J':		/* erase to end of screen */
-	rxvt_scr_erase_screen(aR_ 0);
+	R->scr_erase_screen (0);
 	break;
     case 'K':		/* erase to end of line */
 	rxvt_scr_erase_line(aR_ 0);
@@ -2567,7 +2566,7 @@ rxvt_process_csi_seq(pR)
 	break;

     case CSI_ED:		/* 8.3.40: (0) ERASE IN PAGE */
-	rxvt_scr_erase_screen(aR_ arg[0]);
+	R->scr_erase_screen (arg[0]);
 	break;

     case CSI_EL:		/* 8.3.42: (0) ERASE IN LINE */
@@ -2747,7 +2746,7 @@ rxvt_process_window_ops(pR_ const int *args, unsigned int nargs)
 	XLowerWindow(R->Xdisplay, R->TermWin.parent[0]);
 	break;
     case 7:			/* refresh window */
-	rxvt_scr_touch(aR_ True);
+	R->scr_touch (true);
 	break;
     case 8:			/* set size (chars) */
 	rxvt_set_widthheight(aR_ (unsigned int)(args[2] * R->TermWin.fwidth),
@@ -2968,7 +2967,7 @@ rxvt_xterm_seq(pR_ int op, const char *str, unsigned char resp __attribute__((un
 	    rxvt_scale_pixmap(aR_ "");	/* reset to default scaling */
 	    rxvt_set_bgPixmap(aR_ str);	/* change pixmap */
 #endif
-	    rxvt_scr_touch(aR_ True);
+	    R->scr_touch (true);
 	}
 	while ((str = STRCHR(str, ';')) != NULL) {
 	    str++;
@@ -2980,7 +2979,7 @@ rxvt_xterm_seq(pR_ int op, const char *str, unsigned char resp __attribute__((un
 #ifdef XPM_BACKGROUND
 	    rxvt_resize_pixmap(aR);
 #endif
-	    rxvt_scr_touch(aR_ True);
+	    R->scr_touch (true);
 	}
 	break;

@@ -3156,8 +3155,8 @@ rxvt_process_terminal_mode(pR_ int mode, int priv __attribute__((unused)), unsig
 #ifdef scrollBar_esc
 	case scrollBar_esc:
 	    if (rxvt_scrollbar_mapping(aR_ state)) {
-		rxvt_resize_all_windows(aR_ 0, 0, 0);
-		rxvt_scr_touch(aR_ True);
+		R->resize_all_windows (0, 0, 0);
+                R->scr_touch (true);
 	    }
 	    break;
 #endif
@@ -3193,7 +3192,7 @@ rxvt_process_terminal_mode(pR_ int mode, int priv __attribute__((unused)), unsig
 	    break;
 	case 1047:		/* secondary screen w/ clearing */
 	    if (R->current_screen != PRIMARY)
-		rxvt_scr_erase_screen(aR_ 2);
+		R->scr_erase_screen (2);
 	    rxvt_scr_change_screen(aR_ state);
 	/* FALLTHROUGH */
 	default:
diff --git a/src/feature.h b/src/feature.h

index ca647e775ab37afca8dd6fd6f3c5abe134a1f755..

index ..78ab9e211893a3ec75f86916bf25e950309aa278 100644

--- a/src/feature.h
+++ b/src/feature.h
@@ -1,6 +1,6 @@
 /*
  * File:	feature.h
- * $Id: feature.h,v 1.3 2003/12/18 00:38:07 pcg Exp $
+ * $Id: feature.h,v 1.4 2003/12/18 13:33:02 pcg Exp $
  *
  * Compile-time configuration.
  *-----------------------------------------------------------------------
@@ -159,8 +159,8 @@
  * Define defaults for backspace and delete keys - unless they have been
  * configured out with --disable-backspace-key / --disable-delete-key
  */
-/* #define DEFAULT_BACKSPACE	"DEC"		*/ /* SPECIAL */
-#define DEFAULT_BACKSPACE	"\010"
+//#define DEFAULT_BACKSPACE	"DEC"		/* SPECIAL */
+#define DEFAULT_BACKSPACE	"\010"		/* wrong, but match terminfo etc. */
 #define DEFAULT_DELETE	"\033[3~"

 /*
diff --git a/src/init.C b/src/init.C

index f06662f00101e3b522af2166786108182991c770..

index ..0af621249881f915475c8bcbba3f14c15fe03330 100644

--- a/src/init.C
+++ b/src/init.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:        init.c
  *----------------------------------------------------------------------*
- * $Id: init.C,v 1.15 2003/12/18 07:31:19 pcg Exp $
+ * $Id: init.C,v 1.16 2003/12/18 13:33:02 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -1129,9 +1129,8 @@ rxvt_get_ourmods(pR)

 /*----------------------------------------------------------------------*/
 /* rxvt_Create_Windows() - Open and map the window */
-/* EXTPROTO */
 void
-rxvt_Create_Windows(pR_ int argc, const char *const *argv)
+rxvt_term::create_windows (int argc, const char *const *argv)
 {
   XClassHint      classHint;
   XWMHints        wmHint;
@@ -1142,18 +1141,18 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv)
   XSetWindowAttributes attributes;
   XWindowAttributes gattr;

-  XCMAP = DefaultColormap(R->Xdisplay, Xscreen);
-  XVISUAL = DefaultVisual(R->Xdisplay, Xscreen);
+  XCMAP = DefaultColormap(Xdisplay, Xscreen);
+  XVISUAL = DefaultVisual(Xdisplay, Xscreen);

-  if (R->Options & Opt_transparent)
+  if (Options & Opt_transparent)
     {
-      XGetWindowAttributes(R->Xdisplay, RootWindow(R->Xdisplay, Xscreen),
+      XGetWindowAttributes(Xdisplay, RootWindow(Xdisplay, Xscreen),
                            &gattr);
       XDEPTH = gattr.depth;
     }
   else
     {
-      XDEPTH = DefaultDepth(R->Xdisplay, Xscreen);
+      XDEPTH = DefaultDepth(Xdisplay, Xscreen);
       /*
        * If depth is not 24, look for a 24bit visual.
        */
@@ -1161,12 +1160,12 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv)
         {
           XVisualInfo     vinfo;

-          if (XMatchVisualInfo(R->Xdisplay, Xscreen, 24, TrueColor, &vinfo))
+          if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo))
             {
               XDEPTH = 24;
               XVISUAL = vinfo.visual;
-              XCMAP = XCreateColormap(R->Xdisplay,
-                                      RootWindow(R->Xdisplay, Xscreen),
+              XCMAP = XCreateColormap(Xdisplay,
+                                      RootWindow(Xdisplay, Xscreen),
                                       XVISUAL, AllocNone);
             }
         }
@@ -1174,56 +1173,54 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv)
 #endif

   /* grab colors before netscape does */
-  rxvt_Get_Colours(aR);
+  rxvt_Get_Colours (this);

-  rxvt_change_font(aR_ 1, NULL);
-  rxvt_window_calc(aR_ 0, 0);
-  R->old_width = R->szHint.width;
-  R->old_height = R->szHint.height;
+  rxvt_change_font (this, 1, NULL);
+  window_calc (0, 0);
+  old_width = szHint.width;
+  old_height = szHint.height;

   /* parent window - reverse video so we can see placement errors
    * sub-window placement & size in rxvt_resize_subwindows()
    */

 #ifdef PREFER_24BIT
-
-  attributes.background_pixel = R->PixColors[Color_fg];
-  attributes.border_pixel = R->PixColors[Color_border];
+  attributes.background_pixel = PixColors[Color_fg];
+  attributes.border_pixel = PixColors[Color_border];
   attributes.colormap = XCMAP;
-  R->TermWin.parent[0] = XCreateWindow(R->Xdisplay, Xroot,
-                                       R->szHint.x, R->szHint.y,
-                                       R->szHint.width, R->szHint.height,
-                                       R->TermWin.ext_bwidth,
+  TermWin.parent[0] = XCreateWindow (Xdisplay, DefaultRootWindow (Xdisplay),
+                                       szHint.x, szHint.y,
+                                       szHint.width, szHint.height,
+                                       TermWin.ext_bwidth,
                                        XDEPTH, InputOutput,
                                        XVISUAL,
                                        CWBackPixel | CWBorderPixel
                                        | CWColormap, &attributes);
 #else
-
-  R->TermWin.parent[0] = XCreateSimpleWindow(R->Xdisplay, Xroot,
-                         R->szHint.x, R->szHint.y,
-                         R->szHint.width,
-                         R->szHint.height,
-                         R->TermWin.ext_bwidth,
-                         R->PixColors[Color_border],
-                         R->PixColors[Color_fg]);
+  TermWin.parent[0] = XCreateSimpleWindow (Xdisplay, DefaultRootWindow (Xdisplay),
+                         szHint.x, szHint.y,
+                         szHint.width,
+                         szHint.height,
+                         TermWin.ext_bwidth,
+                         PixColors[Color_border],
+                         PixColors[Color_fg]);
 #endif

-  rxvt_xterm_seq(aR_ XTerm_title, R->rs[Rs_title], CHAR_ST);
-  rxvt_xterm_seq(aR_ XTerm_iconName, R->rs[Rs_iconName], CHAR_ST);
+  rxvt_xterm_seq (this, XTerm_title, rs[Rs_title], CHAR_ST);
+  rxvt_xterm_seq (this, XTerm_iconName, rs[Rs_iconName], CHAR_ST);

-  classHint.res_name = (char *)R->rs[Rs_name];
+  classHint.res_name = (char *)rs[Rs_name];
   classHint.res_class = (char *)APL_CLASS;

   wmHint.flags = (InputHint | StateHint | WindowGroupHint);
   wmHint.input = True;
-  wmHint.initial_state = (R->Options & Opt_iconic ? IconicState
+  wmHint.initial_state = (Options & Opt_iconic ? IconicState
                           : NormalState);
-  wmHint.window_group = R->TermWin.parent[0];
+  wmHint.window_group = TermWin.parent[0];

-  XSetWMProperties(R->Xdisplay, R->TermWin.parent[0], NULL, NULL,
-                   (char **)argv, argc, &R->szHint, &wmHint, &classHint);
-  XSelectInput(R->Xdisplay, R->TermWin.parent[0],
+  XSetWMProperties(Xdisplay, TermWin.parent[0], NULL, NULL,
+                   (char **)argv, argc, &szHint, &wmHint, &classHint);
+  XSelectInput(Xdisplay, TermWin.parent[0],
                (KeyPressMask
 #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
                 | KeyReleaseMask
@@ -1232,11 +1229,11 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv)
                 | StructureNotifyMask));

   /* vt cursor: Black-on-White is standard, but this is more popular */
-  R->TermWin_cursor = XCreateFontCursor(R->Xdisplay, XC_xterm);
+  TermWin_cursor = XCreateFontCursor(Xdisplay, XC_xterm);

 #if defined(HAVE_SCROLLBARS) || defined(MENUBAR)
   /* cursor (menuBar/scrollBar): Black-on-White */
-  R->leftptr_cursor = XCreateFontCursor(R->Xdisplay, XC_left_ptr);
+  leftptr_cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
 #endif

 #ifdef POINTER_BLANK
@@ -1246,97 +1243,97 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv)
     blackcolour.red   = 0;
     blackcolour.green = 0;
     blackcolour.blue  = 0;
-    Font f = XLoadFont (R->Xdisplay, "fixed");
-    R->blank_cursor = XCreateGlyphCursor (R->Xdisplay, f, f, ' ', ' ',
+    Font f = XLoadFont (Xdisplay, "fixed");
+    blank_cursor = XCreateGlyphCursor (Xdisplay, f, f, ' ', ' ',
                                           &blackcolour, &blackcolour);
-    XUnloadFont (R->Xdisplay, f);
+    XUnloadFont (Xdisplay, f);
   }
 #endif

   /* the vt window */
-  R->TermWin.vt = XCreateSimpleWindow(R->Xdisplay, R->TermWin.parent[0],
-                                      R->window_vt_x, R->window_vt_y,
+  TermWin.vt = XCreateSimpleWindow(Xdisplay, TermWin.parent[0],
+                                      window_vt_x, window_vt_y,
                                       TermWin_TotalWidth(),
                                       TermWin_TotalHeight(),
                                       0,
-                                      R->PixColors[Color_fg],
-                                      R->PixColors[Color_bg]);
+                                      PixColors[Color_fg],
+                                      PixColors[Color_bg]);
 #ifdef DEBUG_X

-  XStoreName(R->Xdisplay, R->TermWin.vt, "vt window");
+  XStoreName(Xdisplay, TermWin.vt, "vt window");
 #endif

-  R->pointer_unblank ();
+  pointer_unblank ();

   vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask
               | PropertyChangeMask);
 #ifdef POINTER_BLANK

-  if ((R->Options & Opt_pointerBlank))
+  if ((Options & Opt_pointerBlank))
     vt_emask |= PointerMotionMask;
   else
 #endif

     vt_emask |= (Button1MotionMask | Button3MotionMask);
-  XSelectInput(R->Xdisplay, R->TermWin.vt, vt_emask);
+  XSelectInput(Xdisplay, TermWin.vt, vt_emask);

 #if defined(MENUBAR) && (MENUBAR_MAX > 1)

   if (menuBar_height())
     {
-      R->menuBar.win = XCreateSimpleWindow(R->Xdisplay, R->TermWin.parent[0],
-                                           R->window_vt_x, 0,
+      menuBar.win = XCreateSimpleWindow(Xdisplay, TermWin.parent[0],
+                                           window_vt_x, 0,
                                            TermWin_TotalWidth(),
                                            menuBar_TotalHeight(),
                                            0,
-                                           R->PixColors[Color_fg],
-                                           R->PixColors[Color_scroll]);
+                                           PixColors[Color_fg],
+                                           PixColors[Color_scroll]);
 #ifdef DEBUG_X

-      XStoreName(R->Xdisplay, R->menuBar.win, "menubar");
+      XStoreName(Xdisplay, menuBar.win, "menubar");
 #endif

-      XDefineCursor(R->Xdisplay, R->menuBar.win, R->pointer_leftptr);
-      XSelectInput(R->Xdisplay, R->menuBar.win,
+      XDefineCursor(Xdisplay, menuBar.win, pointer_leftptr);
+      XSelectInput(Xdisplay, menuBar.win,
                    (ExposureMask | ButtonPressMask | ButtonReleaseMask
                     | Button1MotionMask));
     }
 #endif
 #ifdef XPM_BACKGROUND
-  if (R->rs[Rs_backgroundPixmap] != NULL
-      && !(R->Options & Opt_transparent))
+  if (rs[Rs_backgroundPixmap] != NULL
+      && !(Options & Opt_transparent))
     {
-      const char     *p = R->rs[Rs_backgroundPixmap];
+      const char     *p = rs[Rs_backgroundPixmap];

       if ((p = STRCHR(p, ';')) != NULL)
         {
           p++;
-          rxvt_scale_pixmap(aR_ p);
+          rxvt_scale_pixmap (this, p);
         }
-      rxvt_set_bgPixmap(aR_ R->rs[Rs_backgroundPixmap]);
-      rxvt_scr_touch(aR_ True);
+      rxvt_set_bgPixmap (this, rs[Rs_backgroundPixmap]);
+      rxvt_scr_touch (this, True);
     }
 #endif

   /* graphics context for the vt window */
-  gcvalue.foreground = R->PixColors[Color_fg];
-  gcvalue.background = R->PixColors[Color_bg];
+  gcvalue.foreground = PixColors[Color_fg];
+  gcvalue.background = PixColors[Color_bg];
   gcvalue.graphics_exposures = 1;
-  R->TermWin.gc = XCreateGC(R->Xdisplay, R->TermWin.vt,
+  TermWin.gc = XCreateGC(Xdisplay, TermWin.vt,
                             GCForeground | GCBackground
                             | GCGraphicsExposures, &gcvalue);

 #if defined(MENUBAR) || defined(RXVT_SCROLLBAR)

-  gcvalue.foreground = R->PixColors[Color_topShadow];
-  R->topShadowGC = XCreateGC(R->Xdisplay, R->TermWin.vt,
+  gcvalue.foreground = PixColors[Color_topShadow];
+  topShadowGC = XCreateGC(Xdisplay, TermWin.vt,
                              GCForeground, &gcvalue);
-  gcvalue.foreground = R->PixColors[Color_bottomShadow];
-  R->botShadowGC = XCreateGC(R->Xdisplay, R->TermWin.vt,
+  gcvalue.foreground = PixColors[Color_bottomShadow];
+  botShadowGC = XCreateGC(Xdisplay, TermWin.vt,
                              GCForeground, &gcvalue);
-  gcvalue.foreground = R->PixColors[(XDEPTH <= 2 ? Color_fg
+  gcvalue.foreground = PixColors[(XDEPTH <= 2 ? Color_fg
                                      : Color_scroll)];
-  R->scrollbarGC = XCreateGC(R->Xdisplay, R->TermWin.vt,
+  scrollbarGC = XCreateGC(Xdisplay, TermWin.vt,
                              GCForeground, &gcvalue);
 #endif
 }
diff --git a/src/main.C b/src/main.C

index 64cc6c906d7b7542cf7e3a29487512f931bdb4ff..

index ..cd7dae99a9cea6ea2a9815cc2a2376ac73142f4c 100644

--- a/src/main.C
+++ b/src/main.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:        main.c
  *----------------------------------------------------------------------*
- * $Id: main.C,v 1.16 2003/12/18 07:31:19 pcg Exp $
+ * $Id: main.C,v 1.17 2003/12/18 13:33:02 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -218,7 +218,7 @@ rxvt_term::init (int argc, const char *const *argv)
     scrollBar.setIdle ();    /* set existence for size calculations */
 #endif

-  rxvt_Create_Windows (this, argc, argv);
+  create_windows (argc, argv);

   init_xlocale ();

@@ -235,7 +235,7 @@ rxvt_term::init (int argc, const char *const *argv)

 #ifdef HAVE_SCROLLBARS
   if (Options & Opt_scrollBar)
-    rxvt_Resize_scrollBar (this);      /* create and map scrollbar */
+    resize_scrollbar ();      /* create and map scrollbar */
 #endif
 #if (MENUBAR_MAX)
   if (menubar_visible(r))
@@ -523,9 +523,8 @@ rxvt_privileged_ttydev(pR_ char action)
  * window size/position calculcations for XSizeHint and other storage.
  * if width/height are non-zero then override calculated width/height
  */
-/* EXTPROTO */
 void
-rxvt_window_calc(pR_ unsigned int width, unsigned int height)
+rxvt_term::window_calc (unsigned int width, unsigned int height)
 {
     short           recalc_x, recalc_y;
     int             x, y, sb_w, mb_h, flags;
@@ -533,101 +532,101 @@ rxvt_window_calc(pR_ unsigned int width, unsigned int height)
     unsigned int    max_width, max_height;

     D_SIZE((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
-            R->TermWin.ncol, R->TermWin.nrow, R->szHint.width,
-            R->szHint.height));
-    R->szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
-    R->szHint.win_gravity = NorthWestGravity;
-/* R->szHint.min_aspect.x = R->szHint.min_aspect.y = 1; */
+            TermWin.ncol, TermWin.nrow, szHint.width,
+            szHint.height));
+    szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
+    szHint.win_gravity = NorthWestGravity;
+/* szHint.min_aspect.x = szHint.min_aspect.y = 1; */

     recalc_x = recalc_y = 0;
     flags = 0;
-    if (!R->parsed_geometry) {
-        R->parsed_geometry = 1;
-        if (R->rs[Rs_geometry])
-            flags = XParseGeometry(R->rs[Rs_geometry], &x, &y, &w, &h);
+    if (!parsed_geometry) {
+        parsed_geometry = 1;
+        if (rs[Rs_geometry])
+            flags = XParseGeometry(rs[Rs_geometry], &x, &y, &w, &h);
         if (flags & WidthValue) {
-            R->TermWin.ncol = BOUND_POSITIVE_INT16(w);
-            R->szHint.flags |= USSize;
+            TermWin.ncol = BOUND_POSITIVE_INT16(w);
+            szHint.flags |= USSize;
         }
         if (flags & HeightValue) {
-            R->TermWin.nrow = BOUND_POSITIVE_INT16(h);
-            R->szHint.flags |= USSize;
+            TermWin.nrow = BOUND_POSITIVE_INT16(h);
+            szHint.flags |= USSize;
         }
         if (flags & XValue) {
-            R->szHint.x = x;
-            R->szHint.flags |= USPosition;
+            szHint.x = x;
+            szHint.flags |= USPosition;
             if (flags & XNegative) {
                 recalc_x = 1;
-                R->szHint.win_gravity = NorthEastGravity;
+                szHint.win_gravity = NorthEastGravity;
             }
         }
         if (flags & YValue) {
-            R->szHint.y = y;
-            R->szHint.flags |= USPosition;
+            szHint.y = y;
+            szHint.flags |= USPosition;
             if (flags & YNegative) {
                 recalc_y = 1;
-                if (R->szHint.win_gravity == NorthEastGravity)
-                    R->szHint.win_gravity = SouthEastGravity;
+                if (szHint.win_gravity == NorthEastGravity)
+                    szHint.win_gravity = SouthEastGravity;
                 else
-                    R->szHint.win_gravity = SouthWestGravity;
+                    szHint.win_gravity = SouthWestGravity;
             }
         }
     }
 /* TODO: BOUNDS */
-    R->TermWin.width = R->TermWin.ncol * R->TermWin.fwidth;
-    R->TermWin.height = R->TermWin.nrow * R->TermWin.fheight;
-    max_width = MAX_COLS * R->TermWin.fwidth;
-    max_height = MAX_ROWS * R->TermWin.fheight;
+    TermWin.width = TermWin.ncol * TermWin.fwidth;
+    TermWin.height = TermWin.nrow * TermWin.fheight;
+    max_width = MAX_COLS * TermWin.fwidth;
+    max_height = MAX_ROWS * TermWin.fheight;

-    R->szHint.base_width = R->szHint.base_height = 2 * R->TermWin.int_bwidth;
+    szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;

     sb_w = mb_h = 0;
-    R->window_vt_x = R->window_vt_y = 0;
-    if (scrollbar_visible(R)) {
+    window_vt_x = window_vt_y = 0;
+    if (scrollbar_visible (this)) {
         sb_w = scrollbar_TotalWidth();
-        R->szHint.base_width += sb_w;
-        if (!(R->Options & Opt_scrollBar_right))
-            R->window_vt_x = sb_w;
+        szHint.base_width += sb_w;
+        if (!(Options & Opt_scrollBar_right))
+            window_vt_x = sb_w;
     }
-    if (menubar_visible(R)) {
+    if (menubar_visible (this)) {
         mb_h = menuBar_TotalHeight();
-        R->szHint.base_height += mb_h;
-        R->window_vt_y = mb_h;
+        szHint.base_height += mb_h;
+        window_vt_y = mb_h;
     }
-    R->szHint.width_inc = R->TermWin.fwidth;
-    R->szHint.height_inc = R->TermWin.fheight;
-    R->szHint.min_width = R->szHint.base_width + R->szHint.width_inc;
-    R->szHint.min_height = R->szHint.base_height + R->szHint.height_inc;
-
-    if (width && width - R->szHint.base_width < max_width) {
-        R->szHint.width = width;
-        R->TermWin.width = width - R->szHint.base_width;
+    szHint.width_inc = TermWin.fwidth;
+    szHint.height_inc = TermWin.fheight;
+    szHint.min_width = szHint.base_width + szHint.width_inc;
+    szHint.min_height = szHint.base_height + szHint.height_inc;
+
+    if (width && width - szHint.base_width < max_width) {
+        szHint.width = width;
+        TermWin.width = width - szHint.base_width;
     } else {
-        MIN_IT(R->TermWin.width, max_width);
-        R->szHint.width = R->szHint.base_width + R->TermWin.width;
+        MIN_IT(TermWin.width, max_width);
+        szHint.width = szHint.base_width + TermWin.width;
     }
-    if (height && height - R->szHint.base_height < max_height) {
-        R->szHint.height = height;
-        R->TermWin.height = height - R->szHint.base_height;
+    if (height && height - szHint.base_height < max_height) {
+        szHint.height = height;
+        TermWin.height = height - szHint.base_height;
     } else {
-        MIN_IT(R->TermWin.height, max_height);
-        R->szHint.height = R->szHint.base_height + R->TermWin.height;
+        MIN_IT(TermWin.height, max_height);
+        szHint.height = szHint.base_height + TermWin.height;
     }
-    if (scrollbar_visible(R) && (R->Options & Opt_scrollBar_right))
-        R->window_sb_x = R->szHint.width - sb_w;
+    if (scrollbar_visible (this) && (Options & Opt_scrollBar_right))
+        window_sb_x = szHint.width - sb_w;

     if (recalc_x)
-        R->szHint.x += (DisplayWidth(R->Xdisplay, Xscreen)
-                        - R->szHint.width - 2 * R->TermWin.ext_bwidth);
+        szHint.x += (DisplayWidth (Xdisplay, DefaultScreen (Xdisplay))
+                        - szHint.width - 2 * TermWin.ext_bwidth);
     if (recalc_y)
-        R->szHint.y += (DisplayHeight(R->Xdisplay, Xscreen)
-                        - R->szHint.height - 2 * R->TermWin.ext_bwidth);
+        szHint.y += (DisplayHeight (Xdisplay, DefaultScreen (Xdisplay))
+                        - szHint.height - 2 * TermWin.ext_bwidth);

-    R->TermWin.ncol = R->TermWin.width / R->TermWin.fwidth;
-    R->TermWin.nrow = R->TermWin.height / R->TermWin.fheight;
+    TermWin.ncol = TermWin.width / TermWin.fwidth;
+    TermWin.nrow = TermWin.height / TermWin.fheight;
     D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
-            R->TermWin.ncol, R->TermWin.nrow, R->szHint.width,
-            R->szHint.height));
+            TermWin.ncol, TermWin.nrow, szHint.width,
+            szHint.height));
     return;
 }

@@ -866,112 +865,118 @@ rxvt_rXParseAllocColor(pR_ rxvt_color * screen_in_out, const char *colour)
 /* -------------------------------------------------------------------- *
  * -                         WINDOW RESIZING                          - *
  * -------------------------------------------------------------------- */
-/* EXTPROTO */
 void
-rxvt_resize_all_windows(pR_ unsigned int width, unsigned int height,
-                        int ignoreparent)
+rxvt_term::resize_all_windows (unsigned int width, unsigned int height, int ignoreparent)
 {
-    int             fix_screen;
+  int fix_screen;

 #ifdef SMART_RESIZE
-    int             old_width = R->szHint.width, old_height = R->szHint.height;
+  int old_width = szHint.width, old_height = szHint.height;
 #endif

-    rxvt_window_calc(aR_ width, height);
-    XSetWMNormalHints(R->Xdisplay, R->TermWin.parent[0], &R->szHint);
-    if (!ignoreparent) {
+  window_calc (width, height);
+  XSetWMNormalHints (Xdisplay, TermWin.parent[0], &szHint);
+  if (!ignoreparent)
+    {
 #ifdef SMART_RESIZE
-/*
- * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt>
- * reposition window on resize depending on placement on screen
- */
-        int             x, y, x1, y1;
-        int             dx, dy;
-        unsigned int    unused_w1, unused_h1, unused_b1, unused_d1;
-        Window          unused_cr;
-
-        XTranslateCoordinates(R->Xdisplay, R->TermWin.parent[0], Xroot,
-                              0, 0, &x, &y, &unused_cr);
-        XGetGeometry(R->Xdisplay, R->TermWin.parent[0], &unused_cr, &x1, &y1,
-                     &unused_w1, &unused_h1, &unused_b1, &unused_d1);
-    /*
-     * if Xroot isn't the parent window, a WM will probably have offset
-     * our position for handles and decorations.  Counter it
-     */
-        if (x1 != x || y1 != y) {
-            x -= x1;
-            y -= y1;
-        }
-
-        x1 = (DisplayWidth(R->Xdisplay, Xscreen) - old_width) / 2;
-        y1 = (DisplayHeight(R->Xdisplay, Xscreen) - old_height) / 2;
-        dx = old_width - R->szHint.width;
-        dy = old_height - R->szHint.height;
-
-    /* Check position of the center of the window */
-        if (x < x1)             /* left half */
-            dx = 0;
-        else if (x == x1)       /* exact center */
-            dx /= 2;
-        if (y < y1)             /* top half */
-            dy = 0;
-        else if (y == y1)       /* exact center */
-            dy /= 2;
-
-        XMoveResizeWindow(R->Xdisplay, R->TermWin.parent[0], x + dx, y + dy,
-                          R->szHint.width, R->szHint.height);
+      /*
+       * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt>
+       * reposition window on resize depending on placement on screen
+       */
+      int x, y, x1, y1;
+      int dx, dy;
+      unsigned int unused_w1, unused_h1, unused_b1, unused_d1;
+      Window unused_cr;
+
+      XTranslateCoordinates (Xdisplay, TermWin.parent[0], Xroot,
+                             0, 0, &x, &y, &unused_cr);
+      XGetGeometry (Xdisplay, TermWin.parent[0], &unused_cr, &x1, &y1,
+                    &unused_w1, &unused_h1, &unused_b1, &unused_d1);
+      /*
+       * if Xroot isn't the parent window, a WM will probably have offset
+       * our position for handles and decorations.  Counter it
+       */
+      if (x1 != x || y1 != y) {
+          x -= x1;
+          y -= y1;
+      }
+
+      x1 = (DisplayWidth (Xdisplay, Xscreen) - old_width) / 2;
+      y1 = (DisplayHeight (Xdisplay, Xscreen) - old_height) / 2;
+      dx = old_width - szHint.width;
+      dy = old_height - szHint.height;
+
+  /* Check position of the center of the window */
+      if (x < x1)             /* left half */
+          dx = 0;
+      else if (x == x1)       /* exact center */
+          dx /= 2;
+      if (y < y1)             /* top half */
+          dy = 0;
+      else if (y == y1)       /* exact center */
+          dy /= 2;
+
+      XMoveResizeWindow (Xdisplay, TermWin.parent[0], x + dx, y + dy,
+                         szHint.width, szHint.height);
 #else
-        XResizeWindow(R->Xdisplay, R->TermWin.parent[0], R->szHint.width,
-                      R->szHint.height);
+      XResizeWindow (Xdisplay, TermWin.parent[0], szHint.width,
+                     szHint.height);
 #endif
     }

-    fix_screen = (R->TermWin.ncol != R->prev_ncol
-                  || R->TermWin.nrow != R->prev_nrow);
-    if (fix_screen || width != R->old_width || height != R->old_height) {
-        if (scrollbar_visible(R)) {
-            XMoveResizeWindow(R->Xdisplay, R->scrollBar.win, R->window_sb_x,
-                              0, scrollbar_TotalWidth(), R->szHint.height);
-            rxvt_Resize_scrollBar(aR);
+  fix_screen = (TermWin.ncol != prev_ncol
+                || TermWin.nrow != prev_nrow);
+
+  if (fix_screen || width != old_width || height != old_height)
+    {
+      if (scrollbar_visible (this))
+        {
+          XMoveResizeWindow (Xdisplay, scrollBar.win, window_sb_x,
+                             0, scrollbar_TotalWidth (), szHint.height);
+          resize_scrollbar ();
         }
-        if (menubar_visible(R))
-            XMoveResizeWindow(R->Xdisplay, R->menuBar.win, R->window_vt_x,
-                              0, TermWin_TotalWidth(), menuBar_TotalHeight());
-        XMoveResizeWindow(R->Xdisplay, R->TermWin.vt, R->window_vt_x,
-                          R->window_vt_y, TermWin_TotalWidth(),
-                          TermWin_TotalHeight());
+
+      if (menubar_visible (this))
+        XMoveResizeWindow (Xdisplay, menuBar.win, window_vt_x,
+                           0, TermWin_TotalWidth (), menuBar_TotalHeight ());
+
+      XMoveResizeWindow (Xdisplay, TermWin.vt, window_vt_x,
+                         window_vt_y, TermWin_TotalWidth (),
+                         TermWin_TotalHeight ());
 #ifdef RXVT_GRAPHICS
-        if (R->old_height)
-            rxvt_Gr_Resize(aR_ R->old_width - R->szHint.base_width,
-                           R->old_height - R->szHint.base_height);
+      if (old_height)
+        rxvt_Gr_Resize (this, old_width - szHint.base_width,
+                        old_height - szHint.base_height);
 #endif
-        rxvt_scr_clear(aR);
+      scr_clear ();
 #ifdef XPM_BACKGROUND
-        rxvt_resize_pixmap(aR);
+      rxvt_resize_pixmap (this);
 #endif
     }

-    if (fix_screen || R->old_height == 0) {
-        int             curr_screen = -1;
-        uint16_t        old_ncol = R->prev_ncol;
+  if (fix_screen || old_height == 0)
+    {
+      int curr_screen = -1;
+      uint16_t old_ncol = prev_ncol;

-    /* scr_reset only works on the primary screen */
-        if (R->old_height)      /* this is not the first time through */
-            curr_screen = rxvt_scr_change_screen(aR_ PRIMARY);
+      /* scr_reset only works on the primary screen */
+      if (old_height)      /* this is not the first time through */
+        curr_screen = rxvt_scr_change_screen (this, PRIMARY);

-        R->scr_reset();
+      scr_reset();

-        if (curr_screen >= 0) { /* this is not the first time through */
-            rxvt_scr_change_screen(aR_ curr_screen);
-            rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0));
+      if (curr_screen >= 0) /* this is not the first time through */
+        {
+          rxvt_scr_change_screen (this, curr_screen);
+          rxvt_selection_check (this, old_ncol != TermWin.ncol ? 4 : 0);
         }
     }

-    R->old_width = R->szHint.width;
-    R->old_height = R->szHint.height;
+  old_width = szHint.width;
+  old_height = szHint.height;

 #ifdef USE_XIM
-    rxvt_IMSetStatusPosition(aR);
+  rxvt_IMSetStatusPosition (this);
 #endif
 }

@@ -995,7 +1000,7 @@ rxvt_set_widthheight(pR_ unsigned int width, unsigned int height)
     if (width != R->TermWin.width || height != R->TermWin.height) {
         width += R->szHint.base_width;
         height += R->szHint.base_height;
-        rxvt_resize_all_windows(aR_ width, height, 0);
+        R->resize_all_windows (width, height, 0);
     }
 }

@@ -1003,22 +1008,20 @@ rxvt_set_widthheight(pR_ unsigned int width, unsigned int height)
  * -                      X INPUT METHOD ROUTINES                     - *
  * -------------------------------------------------------------------- */
 #ifdef USE_XIM
-/* INTPROTO */
 void
-rxvt_setSize(pR_ XRectangle * size)
+rxvt_term::set_size (XRectangle *size)
 {
-    size->x = R->TermWin.int_bwidth;
-    size->y = R->TermWin.int_bwidth;
-    size->width = Width2Pixel(R->TermWin.ncol);
-    size->height = Height2Pixel(R->TermWin.nrow);
+  size->x = TermWin.int_bwidth;
+  size->y = TermWin.int_bwidth;
+  size->width = Width2Pixel(TermWin.ncol);
+  size->height = Height2Pixel(TermWin.nrow);
 }

-/* INTPROTO */
 void
-rxvt_setColor(pR_ unsigned long *fg, unsigned long *bg)
+rxvt_term::set_color (unsigned long *fg, unsigned long *bg)
 {
-    *fg = R->PixColors[Color_fg];
-    *bg = R->PixColors[Color_bg];
+  *fg = PixColors[Color_fg];
+  *bg = PixColors[Color_bg];
 }

 /* Checking whether input method is running. */
@@ -1063,38 +1066,36 @@ rxvt_IMSendSpot(pR)
         || !rxvt_IMisRunning(aR))
         return;

-    rxvt_setPosition(aR_ & spot);
+    R->set_position (&spot);

     preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
     XSetICValues(R->Input_Context, XNPreeditAttributes, preedit_attr, NULL);
     XFree(preedit_attr);
 }

-/* INTPROTO */
 void
-rxvt_setPreeditArea (pR_ XRectangle * preedit_rect, XRectangle * status_rect,
-                     XRectangle * needed_rect)
+rxvt_term::set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect,
+                             XRectangle * needed_rect)
 {
-    int             mbh, vtx = 0;
+  int mbh, vtx = 0;
+
+  if (scrollbar_visible (this) && !(Options & Opt_scrollBar_right))
+    vtx = scrollbar_TotalWidth();

-    if (scrollbar_visible(R) && !(R->Options & Opt_scrollBar_right))
-        vtx = scrollbar_TotalWidth();
-    mbh = menubar_visible(R) ? menuBar_TotalHeight() : 0;
-    mbh -= R->TermWin.lineSpace;
+  mbh = menubar_visible (this) ? menuBar_TotalHeight() : 0;
+  mbh -= TermWin.lineSpace;

-    preedit_rect->x = needed_rect->width + vtx;
-    preedit_rect->y = Height2Pixel(R->TermWin.nrow - 1) + mbh;
+  preedit_rect->x = needed_rect->width + vtx;
+  preedit_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;

-    preedit_rect->width = Width2Pixel(R->TermWin.ncol + 1) - needed_rect->width
-        + vtx;
-    preedit_rect->height = Height2Pixel(1);
+  preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + vtx;
+  preedit_rect->height = Height2Pixel(1);

-    status_rect->x = vtx;
-    status_rect->y = Height2Pixel(R->TermWin.nrow - 1) + mbh;
+  status_rect->x = vtx;
+  status_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;

-    status_rect->width = needed_rect->width ? needed_rect->width
-        : Width2Pixel(R->TermWin.ncol + 1);
-    status_rect->height = Height2Pixel(1);
+  status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1);
+  status_rect->height = Height2Pixel(1);
 }

 /* ARGSUSED */
@@ -1178,9 +1179,9 @@ rxvt_IM_get_IC (pR)
     preedit_attr = status_attr = NULL;

     if (R->input_style & XIMPreeditPosition) {
-        rxvt_setSize(aR_ & rect);
-        rxvt_setPosition(aR_ & spot);
-        rxvt_setColor(aR_ & fg, &bg);
+        R->set_size (&rect);
+        R->set_position (&spot);
+        R->set_color (&fg, &bg);

         preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
                                            XNSpotLocation, &spot,
@@ -1188,7 +1189,7 @@ rxvt_IM_get_IC (pR)
                                        //XNFontSet, R->TermWin.fontset,
                                            NULL);
     } else if (R->input_style & XIMPreeditArea) {
-        rxvt_setColor(aR_ & fg, &bg);
+        R->set_color (&fg, &bg);

     /*
      * The necessary width of preedit area is unknown
@@ -1196,7 +1197,7 @@ rxvt_IM_get_IC (pR)
      */
         needed_rect.width = 0;

-        rxvt_setPreeditArea(aR_ & rect, &status_rect, &needed_rect);
+        R->set_preedit_area(&rect, &status_rect, &needed_rect);

         preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
                                            XNForeground, fg, XNBackground, bg,
@@ -1321,7 +1322,7 @@ rxvt_IMSetStatusPosition(pR)
     XGetICValues(R->Input_Context, XNStatusAttributes, status_attr, NULL);
     XFree(status_attr);

-    rxvt_setPreeditArea(aR_ & preedit_rect, &status_rect, needed_rect);
+    R->set_preedit_area(&preedit_rect, &status_rect, needed_rect);

     preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
     status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
diff --git a/src/rxvt.h b/src/rxvt.h

index 411eb18c2f8f1a4b7de045587f5265b09d34d45a..

index ..ed27b175b211b11a1e6c36ec0052d306eb0e666c 100644

--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1,5 +1,5 @@
 /*
- * $Id: rxvt.h,v 1.17 2003/12/18 07:31:19 pcg Exp $
+ * $Id: rxvt.h,v 1.18 2003/12/18 13:33:03 pcg Exp $
  */

 #ifndef _RXVT_H_                /* include once only */
@@ -664,17 +664,17 @@ enum {
 #define STRRCHR(x, y)           strrchr((const char *)(x), (int)(y))

 /* convert pixel dimensions to row/column values.  Everything as int32_t */
-#define Pixel2Col(x)            Pixel2Width((int32_t)(x) - (int32_t)R->TermWin.int_bwidth)
-#define Pixel2Row(y)            Pixel2Height((int32_t)(y) - (int32_t)R->TermWin.int_bwidth)
-#define Pixel2Width(x)          ((int32_t)(x) / (int32_t)R->TermWin.fwidth)
-#define Pixel2Height(y)         ((int32_t)(y) / (int32_t)R->TermWin.fheight)
-#define Col2Pixel(col)          ((int32_t)Width2Pixel(col) + (int32_t)R->TermWin.int_bwidth)
-#define Row2Pixel(row)          ((int32_t)Height2Pixel(row) + (int32_t)R->TermWin.int_bwidth)
-#define Width2Pixel(n)          ((int32_t)(n) * (int32_t)R->TermWin.fwidth)
-#define Height2Pixel(n)         ((int32_t)(n) * (int32_t)R->TermWin.fheight)
-
-#define TermWin_TotalWidth()    ((int32_t)R->TermWin.width  + 2 * (int32_t)R->TermWin.int_bwidth)
-#define TermWin_TotalHeight()   ((int32_t)R->TermWin.height + 2 * (int32_t)R->TermWin.int_bwidth)
+#define Pixel2Col(x)            Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth)
+#define Pixel2Row(y)            Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth)
+#define Pixel2Width(x)          ((int32_t)(x) / (int32_t)TermWin.fwidth)
+#define Pixel2Height(y)         ((int32_t)(y) / (int32_t)TermWin.fheight)
+#define Col2Pixel(col)          ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth)
+#define Row2Pixel(row)          ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth)
+#define Width2Pixel(n)          ((int32_t)(n) * (int32_t)TermWin.fwidth)
+#define Height2Pixel(n)         ((int32_t)(n) * (int32_t)TermWin.fheight)
+
+#define TermWin_TotalWidth()    ((int32_t)TermWin.width  + 2 * (int32_t)TermWin.int_bwidth)
+#define TermWin_TotalHeight()   ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth)

 #define Xscreen                 DefaultScreen(R->Xdisplay)
 #define Xroot                   DefaultRootWindow(R->Xdisplay)
@@ -716,7 +716,7 @@ enum {
 #define ISSET_PIXCOLOR(h, x)    ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS)))

 #ifdef HAVE_SCROLLBARS
-# define scrollbar_TotalWidth() (R->scrollBar.width + R->sb_shadow * 2)
+# define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2)
 #else
 # define scrollbar_TotalWidth() (0)
 #endif
@@ -747,7 +747,7 @@ enum {

 #if (MENUBAR_MAX > 1)
 /* rendition style flags */
-# define menuBar_height()       (R->TermWin.fheight + SHADOW)
+# define menuBar_height()       (TermWin.fheight + SHADOW)
 # define menuBar_TotalHeight()  (menuBar_height() + SHADOW + menuBar_margin)
 # define isMenuBarWindow(w)     ((w) == R->menuBar.win)
 #else
@@ -1139,6 +1139,24 @@ struct rxvt_term : rxvt_vars {

   void color_aliases(int idx);
   void recolour_cursor ();
+  void create_windows (int argc, const char *const *argv);
+  void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent);
+  void window_calc (unsigned int width, unsigned int height);
+  void set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect);
+
+#if USE_XIM
+  void set_size (XRectangle *size);
+  void set_position (XPoint *pos);
+  void set_color (unsigned long *fg, unsigned long *bg);
+#endif
+
+  void resize_scrollbar ();
+
+  void pixel_position (int *x, int *y);
+
+  void selection_click (int clicks, int x, int y);
+  void selection_extend (int x, int y, int flag);
+  void selection_rotate (int x, int y);

   /* screen(!) */
   void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs);
@@ -1147,6 +1165,11 @@ struct rxvt_term : rxvt_vars {
   void scr_reset ();
   void scr_reset_realloc ();
   void scr_release ();
+  void scr_clear ();
+  void scr_refresh (unsigned char refresh_type);
+  void scr_erase_screen (int mode);
+  void scr_touch (bool refresh);
+  void scr_expose (int x, int y, int width, int height, bool refresh);
 };

 #define SET_LOCALE(locale) rxvt_set_locale (locale)
diff --git a/src/screen.C b/src/screen.C

index 05f72f9e406ba22a64acf82576c8b37eb2fb236d..

index ..97a6bab257e296d58153ee099009a3c70fd46e99 100644

--- a/src/screen.C
+++ b/src/screen.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*--------------------------------------*
  * File:        screen.c
  *---------------------------------------------------------------------------*
- * $Id: screen.C,v 1.10 2003/12/18 08:06:46 pcg Exp $
+ * $Id: screen.C,v 1.11 2003/12/18 13:33:03 pcg Exp $
  *
  * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
  *
@@ -91,25 +91,25 @@ inline void fill_text (text_t *start, text_t value, int len)
  * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
  * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
  */
-#define drawBuffer      (R->TermWin.vt)
+#define drawBuffer      TermWin.vt

 #define CLEAR_ROWS(row, num)                                            \
-    if (R->TermWin.mapped)                                              \
-        XClearArea(R->Xdisplay, drawBuffer, R->TermWin.int_bwidth,      \
-                   Row2Pixel(row), (unsigned int)R->TermWin.width,      \
-                   (unsigned int)Height2Pixel(num), False)
+    if (TermWin.mapped)                                              \
+        XClearArea (Xdisplay, drawBuffer, TermWin.int_bwidth,      \
+                    Row2Pixel(row), (unsigned int)TermWin.width,      \
+                    (unsigned int)Height2Pixel(num), False)

 #define CLEAR_CHARS(x, y, num)                                          \
-    if (R->TermWin.mapped)                                              \
-        XClearArea(R->Xdisplay, drawBuffer, x, y,                       \
-                   (unsigned int)Width2Pixel(num),                      \
-                   (unsigned int)Height2Pixel(1), False)
+    if (TermWin.mapped)                                              \
+        XClearArea (Xdisplay, drawBuffer, x, y,                       \
+                    (unsigned int)Width2Pixel(num),                      \
+                    (unsigned int)Height2Pixel(1), False)

 #define ERASE_ROWS(row, num)                                            \
-    XFillRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc,              \
-                   R->TermWin.int_bwidth, Row2Pixel(row),               \
-                   (unsigned int)R->TermWin.width,                      \
-                   (unsigned int)Height2Pixel(num))
+    XFillRectangle (Xdisplay, drawBuffer, TermWin.gc,              \
+                    TermWin.int_bwidth, Row2Pixel(row),               \
+                    (unsigned int)TermWin.width,                      \
+                    (unsigned int)Height2Pixel(num))

 /* ------------------------------------------------------------------------- *
  *                        SCREEN `COMMON' ROUTINES                           *
@@ -487,8 +487,8 @@ rxvt_scr_poweron(pR)
   R->prev_nrow = R->prev_ncol = 0;
   R->scr_reset ();

-  rxvt_scr_clear (aR);
-  rxvt_scr_refresh (aR_ SLOW_REFRESH);
+  R->scr_clear ();
+  R->scr_refresh (SLOW_REFRESH);
 #ifdef RXVT_GRAPHICS
   rxvt_Gr_reset (aR);
 #endif
@@ -1213,72 +1213,71 @@ rxvt_scr_erase_line(pR_ int mode)
  * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
  * XTERM_SEQ: Clear whole screen        : ESC [ 2 J
  */
-/* EXTPROTO */
 void
-rxvt_scr_erase_screen(pR_ int mode)
+rxvt_term::scr_erase_screen (int mode)
 {
     int             num;
     int32_t         row, row_offset;
     rend_t          ren;
     XGCValues       gcvalue;

-    R->want_refresh = 1;
-    D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row));
-    ZERO_SCROLLBACK(R);
-    row_offset = (int32_t)R->TermWin.saveLines;
+    want_refresh = 1;
+    D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, screen.cur.row));
+    ZERO_SCROLLBACK(this);
+    row_offset = (int32_t)TermWin.saveLines;

     switch (mode) {
     case 0:                     /* erase to end of screen */
-        rxvt_selection_check(aR_ 1);
-        rxvt_scr_erase_line(aR_ 0);
-        row = R->screen.cur.row + 1;    /* possible OOB */
-        num = R->TermWin.nrow - row;
+        rxvt_selection_check(this,1);
+        rxvt_scr_erase_line(this,0);
+        row = screen.cur.row + 1;    /* possible OOB */
+        num = TermWin.nrow - row;
         break;
     case 1:                     /* erase to beginning of screen */
-        rxvt_selection_check(aR_ 3);
-        rxvt_scr_erase_line(aR_ 1);
+        rxvt_selection_check(this,3);
+        rxvt_scr_erase_line(this,1);
         row = 0;
-        num = R->screen.cur.row;
+        num = screen.cur.row;
         break;
     case 2:                     /* erase whole screen */
-        rxvt_selection_check(aR_ 3);
+        rxvt_selection_check (this, 3);
 #ifdef RXVT_GRAPHICS
-        rxvt_Gr_ClearScreen(aR);
+        rxvt_Gr_ClearScreen (this);
 #endif
         row = 0;
-        num = R->TermWin.nrow;
+        num = TermWin.nrow;
         break;
     default:
         return;
     }
-    R->refresh_type |= REFRESH_BOUNDS;
-    if (R->selection.op && R->current_screen == R->selection.screen
-        && ((R->selection.beg.row >= row && R->selection.beg.row <= row + num)
-            || (R->selection.end.row >= row
-                && R->selection.end.row <= row + num)))
-        CLEAR_SELECTION(R);
-    if (row >= R->TermWin.nrow) /* Out Of Bounds */
+    refresh_type |= REFRESH_BOUNDS;
+    if (selection.op && current_screen == selection.screen
+        && ((selection.beg.row >= row && selection.beg.row <= row + num)
+            || (selection.end.row >= row
+                && selection.end.row <= row + num)))
+        CLEAR_SELECTION (this);
+    if (row >= TermWin.nrow) /* Out Of Bounds */
         return;
-    MIN_IT(num, (R->TermWin.nrow - row));
-    if (R->rstyle & (RS_RVid | RS_Uline))
+    MIN_IT(num, (TermWin.nrow - row));
+    if (rstyle & (RS_RVid | RS_Uline))
         ren = (rend_t) ~RS_None;
-    else if (GET_BASEBG(R->rstyle) == Color_bg) {
+    else if (GET_BASEBG(rstyle) == Color_bg) {
         ren = DEFAULT_RSTYLE;
         CLEAR_ROWS(row, num);
     } else {
-        ren = (R->rstyle & (RS_fgMask | RS_bgMask));
-        gcvalue.foreground = R->PixColors[GET_BGCOLOR(R->rstyle)];
-        XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue);
+        ren = (rstyle & (RS_fgMask | RS_bgMask));
+        gcvalue.foreground = PixColors[GET_BGCOLOR(rstyle)];
+        XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcvalue);
         ERASE_ROWS(row, num);
-        gcvalue.foreground = R->PixColors[Color_fg];
-        XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue);
+        gcvalue.foreground = PixColors[Color_fg];
+        XChangeGC(Xdisplay, TermWin.gc, GCForeground, &gcvalue);
     }
     for (; num--; row++) {
-        R->scr_blank_screen_mem (R->screen.text, R->screen.rend,
-                                 (unsigned int)(row + row_offset), R->rstyle);
-        R->screen.tlen[row + row_offset] = 0;
-        R->scr_blank_line (R->drawn_text[row], R->drawn_rend[row],
-                           (unsigned int)R->TermWin.ncol, ren);
+        scr_blank_screen_mem (screen.text, screen.rend,
+                                 (unsigned int)(row + row_offset), rstyle);
+        screen.tlen[row + row_offset] = 0;
+        scr_blank_line (drawn_text[row], drawn_rend[row],
+                           (unsigned int)TermWin.ncol, ren);
     }
 }

@@ -1572,8 +1571,8 @@ rxvt_scr_rvideo_mode(pR_ int mode)
         gcvalue.background = R->PixColors[Color_bg];
         XChangeGC(R->Xdisplay, R->TermWin.gc, GCBackground | GCForeground,
                   &gcvalue);
-        rxvt_scr_clear(aR);
-        rxvt_scr_touch(aR_ True);
+        R->scr_clear ();
+        R->scr_touch (true);
     }
 }

@@ -1686,55 +1685,54 @@ enum {
     RC_COUNT
 };

-/* EXTPROTO */
 void
-rxvt_scr_expose(pR_ int x, int y, int width, int height, Bool refresh)
+rxvt_term::scr_expose (int x, int y, int width, int height, bool refresh)
 {
-    int             i;
-    row_col_t       rc[RC_COUNT];
+  int i;
+  row_col_t rc[RC_COUNT];

-    if (R->drawn_text == NULL)  /* sanity check */
-        return;
+  if (drawn_text == NULL)  /* sanity check */
+    return;

 #ifdef DEBUG_STRICT
-    x = max(x, (int)R->TermWin.int_bwidth);
-    x = min(x, (int)R->TermWin.width);
-    y = max(y, (int)R->TermWin.int_bwidth);
-    y = min(y, (int)R->TermWin.height);
+  x = max(x, (int)TermWin.int_bwidth);
+  x = min(x, (int)TermWin.width);
+  y = max(y, (int)TermWin.int_bwidth);
+  y = min(y, (int)TermWin.height);
 #endif

 /* round down */
-    rc[PART_BEG].col = Pixel2Col(x);
-    rc[PART_BEG].row = Pixel2Row(y);
+  rc[PART_BEG].col = Pixel2Col(x);
+  rc[PART_BEG].row = Pixel2Row(y);
 /* round up */
-    rc[PART_END].col = Pixel2Width(x + width + R->TermWin.fwidth - 1);
-    rc[PART_END].row = Pixel2Row(y + height + R->TermWin.fheight - 1);
+  rc[PART_END].col = Pixel2Width(x + width + TermWin.fwidth - 1);
+  rc[PART_END].row = Pixel2Row(y + height + TermWin.fheight - 1);

 /* sanity checks */
-    for (i = PART_BEG; i < RC_COUNT; i++) {
-        MIN_IT(rc[i].col, R->TermWin.ncol - 1);
-        MIN_IT(rc[i].row, R->TermWin.nrow - 1);
+  for (i = PART_BEG; i < RC_COUNT; i++)
+    {
+      MIN_IT(rc[i].col, TermWin.ncol - 1);
+      MIN_IT(rc[i].row, TermWin.nrow - 1);
     }

-    D_SCREEN((stderr, "rxvt_scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row));
+  D_SCREEN((stderr, "rxvt_scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row));

-    for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
-        fill_text (&(R->drawn_text[i][rc[PART_BEG].col]), 0,
-                   (rc[PART_END].col - rc[PART_BEG].col + 1));
+  for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
+    fill_text (&(drawn_text[i][rc[PART_BEG].col]), 0,
+               (rc[PART_END].col - rc[PART_BEG].col + 1));

-    if (refresh)
-        rxvt_scr_refresh(aR_ SLOW_REFRESH | REFRESH_BOUNDS);
+  if (refresh)
+    scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS);
 }

 /* ------------------------------------------------------------------------- */
 /*
  * Refresh the entire screen
  */
-/* EXTPROTO */
 void
-rxvt_scr_touch(pR_ Bool refresh)
+rxvt_term::scr_touch (bool refresh)
 {
-    rxvt_scr_expose(aR_ 0, 0, R->TermWin.width, R->TermWin.height, refresh);
+  scr_expose (0, 0, TermWin.width, TermWin.height, refresh);
 }

 /* ------------------------------------------------------------------------- */
@@ -1881,9 +1879,8 @@ rxvt_scr_printscreen(pR_ int fullhist)
 #define IS_FONT_CHAR(X, Y)                                              \
     ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2)

-/* EXTPROTO */
 void
-rxvt_scr_refresh(pR_ unsigned char refresh_type)
+rxvt_term::scr_refresh (unsigned char refresh_type)
 {
     unsigned char   clearfirst, /* first character writes before cell        */
                     clearlast,  /* last character writes beyond cell         */
@@ -1906,9 +1903,9 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
 #endif
     rend_t         *drp, *srp;  /* drawn-rend-pointer, screen-rend-pointer   */
     text_t         *dtp, *stp;  /* drawn-text-pointer, screen-text-pointer   */
-    char           *buffer;     /* local copy of R->buffer                */
+    char           *buffer;     /* local copy of buffer                */

-    if (refresh_type == NO_REFRESH || !R->TermWin.mapped)
+    if (refresh_type == NO_REFRESH || !TermWin.mapped)
       return;

     /*
@@ -1919,36 +1916,36 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
     bfont = 0;
 #endif

-    if (R->currmaxcol < R->TermWin.ncol)
+    if (currmaxcol < TermWin.ncol)
       {
-        R->currmaxcol = R->TermWin.ncol;
-        R->buffer = (char *)rxvt_realloc (R->buffer,
-                                          sizeof(char) * (R->currmaxcol + 1) * MB_CUR_MAX);
+        currmaxcol = TermWin.ncol;
+        buffer = (char *)rxvt_realloc (buffer,
+                                          sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX);
       }

-    buffer = R->buffer;
-    R->refresh_count = 0;
+    buffer = buffer;
+    refresh_count = 0;

-    row_offset = R->TermWin.saveLines - R->TermWin.view_start;
+    row_offset = TermWin.saveLines - TermWin.view_start;

     if ((refresh_type & REFRESH_BOUNDS))
       {
         clearfirst = clearlast = 1;
-        R->refresh_type &= ~REFRESH_BOUNDS;
+        refresh_type &= ~REFRESH_BOUNDS;
       }

 #if defined(XPM_BACKGROUND)
-    must_clear |= (R->bgPixmap.pixmap != None);
+    must_clear |= (bgPixmap.pixmap != None);
 #endif
 #if defined(TRANSPARENT)
-    must_clear |= ((R->Options & Opt_transparent) && R->am_transparent);
+    must_clear |= ((Options & Opt_transparent) && am_transparent);
 #endif
-    ocrow = R->oldcursor.row; /* is there an old outline cursor on screen? */
+    ocrow = oldcursor.row; /* is there an old outline cursor on screen? */

 /*
  * B: reverse any characters which are selected
  */
-    rxvt_scr_reverse_selection(aR);
+    rxvt_scr_reverse_selection (this);

 /*
  * C: set the cursor character(s)
@@ -1958,10 +1955,10 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
       rend_t          ccol1,  /* Cursor colour       */
                       ccol2;  /* Cursor colour2      */

-      showcursor = (R->screen.flags & Screen_VisibleCursor);
+      showcursor = (screen.flags & Screen_VisibleCursor);
       cursorwidth = 0;
 #ifdef CURSOR_BLINK
-      if (R->hidden_cursor)
+      if (hidden_cursor)
           showcursor = 0;
 #endif

@@ -1971,27 +1968,27 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
         {
           cursorwidth++;

-          srp = &(R->screen.rend[R->screen.cur.row + R->TermWin.saveLines]
-                                [R->screen.cur.col]);
+          srp = &(screen.rend[screen.cur.row + TermWin.saveLines]
+                                [screen.cur.col]);

-          if (showcursor && R->TermWin.focus)
+          if (showcursor && TermWin.focus)
             {
               *srp ^= RS_RVid;
 #ifndef NO_CURSORCOLOR
               cc1 = *srp & (RS_fgMask | RS_bgMask);
-              if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor))
+              if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor))
                   ccol1 = Color_cursor;
               else
 #ifdef CURSOR_COLOR_IS_RENDITION_COLOR
-                  ccol1 = GET_FGCOLOR(R->rstyle);
+                  ccol1 = GET_FGCOLOR(rstyle);
 #else
                   ccol1 = Color_fg;
 #endif
-              if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor2))
+              if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor2))
                   ccol2 = Color_cursor2;
               else
 #ifdef CURSOR_COLOR_IS_RENDITION_COLOR
-                  ccol2 = GET_BGCOLOR(R->rstyle);
+                  ccol2 = GET_BGCOLOR(rstyle);
 #else
                   ccol2 = Color_bg;
 #endif
@@ -2007,25 +2004,25 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
       /* make sure no outline cursor is left around */
       setoldcursor = 0;
       if (ocrow != -1) {
-          if (R->screen.cur.row + R->TermWin.view_start != ocrow
-              || R->screen.cur.col != R->oldcursor.col) {
-              if (ocrow < R->TermWin.nrow
-                  && R->oldcursor.col < R->TermWin.ncol) {
-                  R->drawn_rend[ocrow][R->oldcursor.col] ^= (RS_RVid | RS_Uline);
+          if (screen.cur.row + TermWin.view_start != ocrow
+              || screen.cur.col != oldcursor.col) {
+              if (ocrow < TermWin.nrow
+                  && oldcursor.col < TermWin.ncol) {
+                  drawn_rend[ocrow][oldcursor.col] ^= (RS_RVid | RS_Uline);
               }
-              if (R->TermWin.focus || !showcursor)
-                  R->oldcursor.row = -1;
+              if (TermWin.focus || !showcursor)
+                  oldcursor.row = -1;
               else
                   setoldcursor = 1;
           }
-      } else if (!R->TermWin.focus)
+      } else if (!TermWin.focus)
           setoldcursor = 1;
       if (setoldcursor) {
-          if (R->screen.cur.row + R->TermWin.view_start >= R->TermWin.nrow)
-              R->oldcursor.row = -1;
+          if (screen.cur.row + TermWin.view_start >= TermWin.nrow)
+              oldcursor.row = -1;
           else {
-              R->oldcursor.row = R->screen.cur.row + R->TermWin.view_start;
-              R->oldcursor.col = R->screen.cur.col;
+              oldcursor.row = screen.cur.row + TermWin.view_start;
+              oldcursor.col = screen.cur.col;
           }
       }
     }
@@ -2035,9 +2032,9 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
  * D: CopyArea pass - very useful for slower links
  *    This has been deliberately kept simple.
  */
-    i = R->num_scr;
-    if (refresh_type == FAST_REFRESH && R->num_scr_allow && i
-        && abs(i) < R->TermWin.nrow && !must_clear)
+    i = num_scr;
+    if (refresh_type == FAST_REFRESH && num_scr_allow && i
+        && abs(i) < TermWin.nrow && !must_clear)
       {
         int16_t         nits;
         int             j;
@@ -2045,21 +2042,21 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
         text_t         *dtp2;
         int             len, wlen;

-        j = R->TermWin.nrow;
+        j = TermWin.nrow;
         wlen = len = -1;
         row = i > 0 ? 0 : j - 1;
         for (; j-- >= 0; row += (i > 0 ? 1 : -1))
           {
-            if (row + i >= 0 && row + i < R->TermWin.nrow && row + i != ocrow)
+            if (row + i >= 0 && row + i < TermWin.nrow && row + i != ocrow)
               {
-                stp = R->screen.text[row + row_offset];
-                srp = R->screen.rend[row + row_offset];
-                dtp = R->drawn_text[row];
-                dtp2 = R->drawn_text[row + i];
-                drp = R->drawn_rend[row];
-                drp2 = R->drawn_rend[row + i];
-
-                for (nits = 0, col = R->TermWin.ncol; col--; )
+                stp = screen.text[row + row_offset];
+                srp = screen.rend[row + row_offset];
+                dtp = drawn_text[row];
+                dtp2 = drawn_text[row + i];
+                drp = drawn_rend[row];
+                drp2 = drawn_rend[row + i];
+
+                for (nits = 0, col = TermWin.ncol; col--; )
                   if (stp[col] != dtp2[col] || srp[col] != drp2[col])
                     nits--;
                   else if (stp[col] != dtp[col] || srp[col] != drp[col])
@@ -2067,7 +2064,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)

                 if (nits > 8) /* XXX: arbitrary choice */
                   {
-                    for (col = R->TermWin.ncol; col--; )
+                    for (col = TermWin.ncol; col--; )
                       {
                         *dtp++ = *dtp2++;
                         *drp++ = *drp2++;
@@ -2086,12 +2083,13 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
                 /* also comes here at end if needed because of >= above */
                 if (wlen < len)
                   SWAP_IT(wlen, len, int);
+
                 D_SCREEN((stderr, "rxvt_scr_refresh(): XCopyArea: %d -> %d (height: %d)", len + i, len, wlen - len + 1));
-                XCopyArea(R->Xdisplay, R->TermWin.vt, R->TermWin.vt,
-                          R->TermWin.gc, 0, Row2Pixel(len + i),
-                          (unsigned int)TermWin_TotalWidth(),
-                          (unsigned int)Height2Pixel(wlen - len + 1),
-                          0, Row2Pixel(len));
+                XCopyArea (Xdisplay, TermWin.vt, TermWin.vt,
+                           TermWin.gc, 0, Row2Pixel (len + i),
+                           (unsigned int)TermWin_TotalWidth (),
+                           (unsigned int)Height2Pixel (wlen - len + 1),
+                           0, Row2Pixel (len));
                 len = -1;
               }
           }
@@ -2101,19 +2099,19 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
 /*
  * E: main pass across every character
  */
-    for (row = 0; row < R->TermWin.nrow; row++)
+    for (row = 0; row < TermWin.nrow; row++)
       {
-        stp = R->screen.text[row + row_offset];
-        srp = R->screen.rend[row + row_offset];
-        dtp = R->drawn_text[row];
-        drp = R->drawn_rend[row];
+        stp = screen.text[row + row_offset];
+        srp = screen.rend[row + row_offset];
+        dtp = drawn_text[row];
+        drp = drawn_rend[row];

 /*
  * E2: OK, now the real pass
  */
         int ypixel = (int)Row2Pixel(row);

-        for (col = 0; col < R->TermWin.ncol; col++)
+        for (col = 0; col < TermWin.ncol; col++)
           {
             /* compare new text with old - if exactly the same then continue */
             rend_t rend = srp[col];     /* screen rendition (target rendtion) */
@@ -2139,7 +2137,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)

             // this loop looks very messy, it can probably be optimized
             // and cleaned a bit by you?
-            for (i = 0; ++col < R->TermWin.ncol; )
+            for (i = 0; ++col < TermWin.ncol; )
               {
                 if (stp[col] == NOCHAR)
                   {
@@ -2187,7 +2185,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
 #ifdef OPTION_HC
             if (!rvid && (rend & RS_Blink))
               {
-                if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_HC))
+                if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_HC))
                   back = Color_HC;
                 else
                   rvid = !rvid; /* fall back */
@@ -2198,9 +2196,9 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
                 SWAP_IT(fore, back, int);

 #ifndef NO_BOLD_UNDERLINE_REVERSE
-                if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_RV)
+                if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_RV)
 # ifndef NO_CURSORCOLOR
-                    && !ISSET_PIXCOLOR(R, Color_cursor)
+                    && !ISSET_PIXCOLOR (this, Color_cursor)
 # endif
                     )
                   back = Color_RV;
@@ -2209,7 +2207,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
 #ifndef NO_BOLD_UNDERLINE_REVERSE
             else if (rend & RS_Bold)
               {
-                if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_BD))
+                if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_BD))
                   {
                     fore = Color_BD;
 # ifndef VERYBOLD
@@ -2219,7 +2217,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
               }
             else if (rend & RS_Uline)
               {
-                if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_UL))
+                if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_UL))
                   {
                     fore = Color_UL;
                     rend &= ~RS_Uline;  /* we've taken care of it */
@@ -2230,7 +2228,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
 /*
  * Actually do the drawing of the string here
  */
-            rxvt_font *font = (*R->TermWin.fontset)[fid];
+            rxvt_font *font = (*TermWin.fontset)[fid];

             if (back == Color_bg)
               {
@@ -2243,7 +2241,7 @@ rxvt_scr_refresh(pR_ unsigned char refresh_type)
                           goto nodraw;
                         }

-                    CLEAR_CHARS(xpixel, ypixel, count);
+                    CLEAR_CHARS (xpixel, ypixel, count);
 nodraw: ;
                   }
                 else
@@ -2253,7 +2251,7 @@ nodraw: ;
               font->draw (xpixel, ypixel, text, count, fore, back);

             if ((rend & RS_Uline) && (font->descent > 1))
-                XDrawLine(R->Xdisplay, drawBuffer, R->TermWin.gc,
+                XDrawLine(Xdisplay, drawBuffer, TermWin.gc,
                           xpixel, ypixel + font->ascent + 1,
                           xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1);
           }                     /* for (col....) */
@@ -2263,84 +2261,86 @@ nodraw: ;
  * G: cleanup cursor and display outline cursor if necessary
  */
     if (showcursor) {
-        if (R->TermWin.focus) {
-            srp = &(R->screen.rend[R->screen.cur.row + R->TermWin.saveLines]
-                                  [R->screen.cur.col]);
+        if (TermWin.focus) {
+            srp = &(screen.rend[screen.cur.row + TermWin.saveLines]
+                                  [screen.cur.col]);
             *srp ^= RS_RVid;
 #ifndef NO_CURSORCOLOR
             *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1;
 #endif
-        } else if (R->oldcursor.row >= 0) {
+        } else if (oldcursor.row >= 0) {
 #ifndef NO_CURSORCOLOR
             unsigned long   gcmask;     /* Graphics Context mask */

-            if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor)) {
-                XSetForeground (R->Xdisplay, R->TermWin.gc, R->PixColors[Color_cursor]);
-            }
+            if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_cursor))
+              XSetForeground (Xdisplay, TermWin.gc, PixColors[Color_cursor]);
 #endif
-            XDrawRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc,
-                           Col2Pixel(R->oldcursor.col),
-                           Row2Pixel(R->oldcursor.row),
+            XDrawRectangle(Xdisplay, drawBuffer, TermWin.gc,
+                           Col2Pixel(oldcursor.col),
+                           Row2Pixel(oldcursor.row),
                            (unsigned int)(Width2Pixel(cursorwidth) - 1),
-                           (unsigned int)(Height2Pixel(1) - R->TermWin.lineSpace - 1));
+                           (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1));
         }
     }
 /*
  * H: cleanup selection
  */
-    rxvt_scr_reverse_selection(aR);
+    rxvt_scr_reverse_selection (this);

 /*
  * I: other general cleanup
  */
-    if (clearfirst && R->TermWin.int_bwidth)
+    if (clearfirst && TermWin.int_bwidth)
         /*
          * clear the whole screen height, note that width == 0 is treated
          * specially by XClearArea
          */
-        XClearArea(R->Xdisplay, R->TermWin.vt, 0, 0,
-                   (unsigned int)R->TermWin.int_bwidth,
+        XClearArea(Xdisplay, TermWin.vt, 0, 0,
+                   (unsigned int)TermWin.int_bwidth,
                    (unsigned int)TermWin_TotalHeight(), False);
-    if (clearlast && R->TermWin.int_bwidth)
+    if (clearlast && TermWin.int_bwidth)
         /*
          * clear the whole screen height, note that width == 0 is treated
          * specially by XClearArea
          */
-        XClearArea(R->Xdisplay, R->TermWin.vt,
-                   R->TermWin.width + R->TermWin.int_bwidth, 0,
-                   (unsigned int)R->TermWin.int_bwidth,
+        XClearArea(Xdisplay, TermWin.vt,
+                   TermWin.width + TermWin.int_bwidth, 0,
+                   (unsigned int)TermWin.int_bwidth,
                    (unsigned int)TermWin_TotalHeight(), False);
     if (refresh_type & SMOOTH_REFRESH)
-        XSync(R->Xdisplay, False);
+        XSync(Xdisplay, False);

-    R->num_scr = 0;
-    R->num_scr_allow = 1;
-    R->want_refresh = 0;        /* screen is current */
+    num_scr = 0;
+    num_scr_allow = 1;
+    want_refresh = 0;        /* screen is current */
 }
-/* ------------------------------------------------------------------------- */

-/* EXTPROTO */
+/* ------------------------------------------------------------------------- */
 void
-rxvt_scr_clear(pR)
+rxvt_term::scr_clear()
 {
-    if (!R->TermWin.mapped)
-        return;
-    R->num_scr_allow = 0;
-    R->want_refresh = 1;
+  if (!TermWin.mapped)
+    return;
+
+  num_scr_allow = 0;
+  want_refresh = 1;
 #ifdef TRANSPARENT
-    if ((R->Options & Opt_transparent) && (R->am_pixmap_trans == 0)) {
-        int             i;
+  if ((Options & Opt_transparent) && (am_pixmap_trans == 0))
+    {
+      int i;

-        if (!(R->Options & Opt_transparent_all))
-            i = 0;
-        else
-            i = (int)(sizeof(R->TermWin.parent) / sizeof(Window));
-        for (; i--;)
-            if (R->TermWin.parent[i] != None)
-                XClearWindow(R->Xdisplay, R->TermWin.parent[i]);
+      if (!(Options & Opt_transparent_all))
+        i = 0;
+      else
+        i = (int)(sizeof(TermWin.parent) / sizeof(Window));
+
+      while (i--)
+        if (TermWin.parent[i] != None)
+          XClearWindow(Xdisplay, TermWin.parent[i]);
     }
 #endif
-    XClearWindow(R->Xdisplay, R->TermWin.vt);
+
+  XClearWindow (Xdisplay, TermWin.vt);
 }

 /* ------------------------------------------------------------------------- */
@@ -2824,23 +2824,22 @@ rxvt_selection_make(pR_ Time tm)
  * Mark or select text based upon number of clicks: 1, 2, or 3
  * EXT: button 1 press
  */
-/* EXTPROTO */
 void
-rxvt_selection_click(pR_ int clicks, int x, int y)
+rxvt_term::selection_click (int clicks, int x, int y)
 {
-    D_SELECT((stderr, "rxvt_selection_click(%d, %d, %d)", clicks, x, y));
+  D_SELECT((stderr, "rxvt_selection_click(%d, %d, %d)", clicks, x, y));
+
+  clicks = ((clicks - 1) % 3) + 1;
+  selection.clicks = clicks;       /* save clicks so extend will work */

-    clicks = ((clicks - 1) % 3) + 1;
-    R->selection.clicks = clicks;       /* save clicks so extend will work */
+  rxvt_selection_start_colrow (this, Pixel2Col(x), Pixel2Row(y));

-    rxvt_selection_start_colrow(aR_ Pixel2Col(x), Pixel2Row(y));
-    if (clicks == 2 || clicks == 3)
-        rxvt_selection_extend_colrow(aR_ R->selection.mark.col,
-                                     R->selection.mark.row
-                                     + R->TermWin.view_start,
-                                     0, /* button 3     */
-                                     1, /* button press */
-                                     0);        /* click change */
+  if (clicks == 2 || clicks == 3)
+    rxvt_selection_extend_colrow (this, selection.mark.col,
+                                  selection.mark.row + TermWin.view_start,
+                                  0, /* button 3     */
+                                  1, /* button press */
+                                  0);        /* click change */
 }

 /* ------------------------------------------------------------------------- */
@@ -2960,44 +2959,47 @@ rxvt_selection_delimit_word(pR_ enum page_dirn dirn, const row_col_t *mark, row_
  * flag == 1 ==> button 3 press
  * flag == 2 ==> button 3 motion
  */
-/* EXTPROTO */
 void
-rxvt_selection_extend(pR_ int x, int y, int flag)
+rxvt_term::selection_extend (int x, int y, int flag)
 {
-    int             col, row;
+  int col, row;
+
+  col = Pixel2Col(x);
+  row = Pixel2Row(y);
+  MAX_IT(row, 0);
+  MIN_IT(row, (int)TermWin.nrow - 1);
+  MAX_IT(col, 0);
+  MIN_IT(col, (int)TermWin.ncol);

-    col = Pixel2Col(x);
-    row = Pixel2Row(y);
-    MAX_IT(row, 0);
-    MIN_IT(row, (int)R->TermWin.nrow - 1);
-    MAX_IT(col, 0);
-    MIN_IT(col, (int)R->TermWin.ncol);
 #ifndef NO_NEW_SELECTION
-/*
- * If we're selecting characters (single click) then we must check first
- * if we are at the same place as the original mark.  If we are then
- * select nothing.  Otherwise, if we're to the right of the mark, you have to
- * be _past_ a character for it to be selected.
- */
-    if (R->selection_style != OLD_SELECT) {
-        if (((R->selection.clicks % 3) == 1) && !flag
-            && (col == R->selection.mark.col
-                && (row == R->selection.mark.row + R->TermWin.view_start))) {
-            /* select nothing */
-            R->selection.beg.row = R->selection.end.row = 0;
-            R->selection.beg.col = R->selection.end.col = 0;
-            R->selection.clicks = 4;
-            R->want_refresh = 1;
-            D_SELECT((stderr, "rxvt_selection_extend() R->selection.clicks = 4"));
-            return;
+  /*
+  * If we're selecting characters (single click) then we must check first
+  * if we are at the same place as the original mark.  If we are then
+  * select nothing.  Otherwise, if we're to the right of the mark, you have to
+  * be _past_ a character for it to be selected.
+  */
+  if (selection_style != OLD_SELECT)
+    {
+      if (((selection.clicks % 3) == 1) && !flag
+          && (col == selection.mark.col
+              && (row == selection.mark.row + TermWin.view_start)))
+        {
+          /* select nothing */
+          selection.beg.row = selection.end.row = 0;
+          selection.beg.col = selection.end.col = 0;
+          selection.clicks = 4;
+          want_refresh = 1;
+          D_SELECT((stderr, "rxvt_selection_extend() selection.clicks = 4"));
+          return;
         }
     }
 #endif
-    if (R->selection.clicks == 4)
-        R->selection.clicks = 1;
-    rxvt_selection_extend_colrow(aR_ col, row, !!flag,  /* ? button 3      */
-                                 flag == 1 ? 1 : 0,     /* ? button press  */
-                                 0);    /* no click change */
+  if (selection.clicks == 4)
+    selection.clicks = 1;
+
+  rxvt_selection_extend_colrow (this, col, row, !!flag,  /* ? button 3      */
+                                flag == 1 ? 1 : 0,     /* ? button press  */
+                                0);    /* no click change */
 }

 /* ------------------------------------------------------------------------- */
@@ -3261,12 +3263,11 @@ rxvt_selection_remove_trailing_spaces(pR)
  * Double click on button 3 when already selected
  * EXT: button 3 double click
  */
-/* EXTPROTO */
 void
-rxvt_selection_rotate(pR_ int x, int y)
+rxvt_term::selection_rotate (int x, int y)
 {
-    R->selection.clicks = R->selection.clicks % 3 + 1;
-    rxvt_selection_extend_colrow(aR_ Pixel2Col(x), Pixel2Row(y), 1, 0, 1);
+  selection.clicks = selection.clicks % 3 + 1;
+  rxvt_selection_extend_colrow (this, Pixel2Col(x), Pixel2Row(y), 1, 0, 1);
 }

 /* ------------------------------------------------------------------------- */
@@ -3380,28 +3381,27 @@ rxvt_selection_send(pR_ const XSelectionRequestEvent *rq)
 /*
  * return col/row values corresponding to x/y pixel values
  */
-/* EXTPROTO */
 void
-rxvt_pixel_position(pR_ int *x, int *y)
+rxvt_term::pixel_position (int *x, int *y)
 {
-    *x = Pixel2Col(*x);
-/* MAX_IT(*x, 0); MIN_IT(*x, (int)R->TermWin.ncol - 1); */
-    *y = Pixel2Row(*y);
-/* MAX_IT(*y, 0); MIN_IT(*y, (int)R->TermWin.nrow - 1); */
+  *x = Pixel2Col(*x);
+  /* MAX_IT(*x, 0); MIN_IT(*x, (int)R->TermWin.ncol - 1); */
+  *y = Pixel2Row(*y);
+  /* MAX_IT(*y, 0); MIN_IT(*y, (int)R->TermWin.nrow - 1); */
 }
+
 /* ------------------------------------------------------------------------- */
 #ifdef USE_XIM
-/* EXTPROTO */
 void
-rxvt_setPosition(pR_ XPoint *pos)
+rxvt_term::set_position (XPoint *pos)
 {
-    XWindowAttributes xwa;
+  XWindowAttributes xwa;

-    XGetWindowAttributes(R->Xdisplay, R->TermWin.vt, &xwa);
-    pos->x = Col2Pixel(R->screen.cur.col) + xwa.x;
-    pos->y = Height2Pixel((R->screen.cur.row + 1)) + xwa.y
-             - R->TermWin.lineSpace;
+  XGetWindowAttributes (Xdisplay, TermWin.vt, &xwa);
+  pos->x = Col2Pixel (screen.cur.col) + xwa.x;
+  pos->y = Height2Pixel ((screen.cur.row + 1)) + xwa.y - TermWin.lineSpace;
 }
+
 #endif
 /* ------------------------------------------------------------------------- */

diff --git a/src/scrollbar.C b/src/scrollbar.C

index 5b869e41474c28dbde7e4a105990bb8dd6498fdd..

index ..4eff3005f956ce8573eaaa1404bf8afc63394f37 100644

--- a/src/scrollbar.C
+++ b/src/scrollbar.C
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:	scrollbar.c
  *----------------------------------------------------------------------*
- * $Id: scrollbar.C,v 1.5 2003/12/18 05:45:11 pcg Exp $
+ * $Id: scrollbar.C,v 1.6 2003/12/18 13:33:03 pcg Exp $
  *
  * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
  * Copyright (c) 1998      Alfredo K. Kojima <kojima@windowmaker.org>
@@ -37,12 +37,12 @@ int
 rxvt_scrollbar_mapping(pR_ int map)
 {
     int             change = 0;
-#ifdef HAVE_SCROLLBARS

+#ifdef HAVE_SCROLLBARS
     if (map && !scrollbar_visible(R)) {
 	R->scrollBar.setIdle ();
 	if (!R->scrollBar.win)
-	    rxvt_Resize_scrollBar(aR);
+	    R->resize_scrollbar ();
 	if (R->scrollBar.win) {
 	    XMapWindow(R->Xdisplay, R->scrollBar.win);
 	    change = 1;
@@ -56,67 +56,66 @@ rxvt_scrollbar_mapping(pR_ int map)
     return change;
 }

-/* EXTPROTO */
 void
-rxvt_Resize_scrollBar(pR)
+rxvt_term::resize_scrollbar ()
 {
 #ifdef HAVE_SCROLLBARS
-    int             delayed_init = 0;
+    int delayed_init = 0;

 #define R_SCROLLBEG_XTERM	0
-#define R_SCROLLEND_XTERM	R->szHint.height
+#define R_SCROLLEND_XTERM	szHint.height
 #define R_SCROLLBEG_NEXT	0
-#define R_SCROLLEND_NEXT	R->szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \
+#define R_SCROLLEND_NEXT	szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \
 						    SB_PADDING)
-#define R_SCROLLBEG_RXVT	(R->scrollBar.width + 1) + R->sb_shadow
-#define R_SCROLLEND_RXVT	R->szHint.height - R_SCROLLBEG_RXVT - \
-				    (2 * R->sb_shadow)
+#define R_SCROLLBEG_RXVT	(scrollBar.width + 1) + sb_shadow
+#define R_SCROLLEND_RXVT	szHint.height - R_SCROLLBEG_RXVT - \
+				    (2 * sb_shadow)

 #if defined(XTERM_SCROLLBAR)
-    if (R->scrollBar.style == R_SB_XTERM) {
-	R->scrollBar.beg = R_SCROLLBEG_XTERM;
-	R->scrollBar.end = R_SCROLLEND_XTERM;
-	R->scrollBar.update = rxvt_scrollbar_show_xterm;
+    if (scrollBar.style == R_SB_XTERM) {
+	scrollBar.beg = R_SCROLLBEG_XTERM;
+	scrollBar.end = R_SCROLLEND_XTERM;
+	scrollBar.update = rxvt_scrollbar_show_xterm;
     }
 #endif
 #if defined(NEXT_SCROLLBAR)
-    if (R->scrollBar.style == R_SB_NEXT) {
-	R->scrollBar.beg = R_SCROLLBEG_NEXT;
-	R->scrollBar.end = R_SCROLLEND_NEXT;
-	R->scrollBar.update = rxvt_scrollbar_show_next;
+    if (scrollBar.style == R_SB_NEXT) {
+	scrollBar.beg = R_SCROLLBEG_NEXT;
+	scrollBar.end = R_SCROLLEND_NEXT;
+	scrollBar.update = rxvt_scrollbar_show_next;
     }
 #endif
 #if defined(RXVT_SCROLLBAR)
-    if (R->scrollBar.style == R_SB_RXVT) {
-	R->scrollBar.beg = R_SCROLLBEG_RXVT;
-	R->scrollBar.end = R_SCROLLEND_RXVT;
-	R->scrollBar.update = rxvt_scrollbar_show_rxvt;
+    if (scrollBar.style == R_SB_RXVT) {
+	scrollBar.beg = R_SCROLLBEG_RXVT;
+	scrollBar.end = R_SCROLLEND_RXVT;
+	scrollBar.update = rxvt_scrollbar_show_rxvt;
     }
 #endif

-    if (!R->scrollBar.win) {
+    if (!scrollBar.win) {
 /* create the scrollbar window */
-	R->scrollBar.win = XCreateSimpleWindow(R->Xdisplay,
-					       R->TermWin.parent[0],
-					       R->window_sb_x, 0,
+	scrollBar.win = XCreateSimpleWindow(Xdisplay,
+					       TermWin.parent[0],
+					       window_sb_x, 0,
 					       scrollbar_TotalWidth(),
-					       R->szHint.height,
+					       szHint.height,
 					       0,
-					       R->PixColors[Color_fg],
-					       R->PixColors[Color_bg]);
+					       PixColors[Color_fg],
+					       PixColors[Color_bg]);
 #ifdef DEBUG_X
-	XStoreName(R->Xdisplay, R->scrollBar.win, "scrollbar");
+	XStoreName(Xdisplay, scrollBar.win, "scrollbar");
 #endif
-	XDefineCursor(R->Xdisplay, R->scrollBar.win, R->leftptr_cursor);
-	XSelectInput(R->Xdisplay, R->scrollBar.win,
+	XDefineCursor(Xdisplay, scrollBar.win, leftptr_cursor);
+	XSelectInput(Xdisplay, scrollBar.win,
 		     (ExposureMask | ButtonPressMask | ButtonReleaseMask
 		      | Button1MotionMask | Button2MotionMask
 		      | Button3MotionMask));
 	delayed_init = 1;
     }
-    rxvt_scrollbar_show(aR_ 1);
+    rxvt_scrollbar_show (this, 1);
     if (delayed_init)
-	XMapWindow(R->Xdisplay, R->scrollBar.win);
+	XMapWindow (Xdisplay, scrollBar.win);
 #endif
 }

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

-- Response ended

-- Page fetched on Sun Jun 2 13:19:03 2024