[comp.sources.games.bugs] Official patch #3 to reve v1.1 - part 8 of 9.

richb@sunaus.oz (Rich Burridge) (12/10/90)

------CUT HERE------ patch3 - part8 ------CUT HERE------

------- sunview.c -------
*** /tmp/da07669	Sun Dec  9 15:20:11 1990
--- sunview.c	Sat Dec  8 13:28:38 1990
***************
*** 60,65 ****
--- 60,67 ----
  mpr_static(cycle_rinvert_pr,  64, 64, 1, cycle_rinvert_image) ;
  mpr_static(icon_pr,           64, 64, 1, icon_image) ;
  mpr_static(cicon_pr,          64, 64, 8, cicon_image) ;
+ mpr_static(toggle_off_pr,     64, 64, 1, sch_off_image) ;
+ mpr_static(toggle_on_pr,      64, 64, 1, sch_on_image) ;
  mpr_static(white_icon_pr,     64, 64, 1, white_image) ;
  mpr_static(black_icon_pr,     64, 64, 1, black_image) ;
  
***************
*** 66,80 ****
  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  
! Canvas canvas ;
  Cursor cursor[MAXCURSORS] ;
  Event *cur_event ;
! Frame frame ;
  Icon reve_icon ;
- Menu menus[MAXMENUS] ;
  Pixfont *font[MAXFONTS] ;
  Pixrect *images[MAXIMAGES] ;
! Pixwin *cpw ;
  
  void pw_batch() ;
  int opvals[3] ;         /* Pixrect rasterop values. */
--- 68,81 ----
  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  
! Canvas canvas, pcanvas ;
  Cursor cursor[MAXCURSORS] ;
  Event *cur_event ;
! Frame frame, pframe ;
  Icon reve_icon ;
  Pixfont *font[MAXFONTS] ;
  Pixrect *images[MAXIMAGES] ;
! Pixwin *cpw, *ppw ;
  
  void pw_batch() ;
  int opvals[3] ;         /* Pixrect rasterop values. */
***************
*** 95,144 ****
  
  /*ARGSUSED*/
  void
! canvas_proc(canvas, event)
! Canvas canvas ;
  Event *event ;
  {
    cur_event = event ;
-   process_event() ;       /* Determine what kind of event it is. */
    handle_event() ;        /* And do the appropriate action. */
  }
  
  
  void
! close_frame()        /* Iconise reve window. */
  {
!   WINDOW_SET(frame, FRAME_CLOSED, TRUE, 0) ;
  }
  
  
  void
! color_area(x, y, width, height, color)
  int x, y, width, height, color ;
  {
!   PW_WRITEBACKGROUND(cpw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
! }
  
! 
! void
! create_menu(mtype, values)    /* Create popup menus for cycle items. */
! enum panel_type mtype ;
! char *values[] ;
! {
!   int i = 0 ;
!   int menuno ;     /* Current menu number. */
!   int more = 1 ;   /* Cleared when current menu is complete.*/
! 
!   menuno = (int) mtype - (int) BLACK_PLAYS ;
!   menus[menuno] = menu_create(MENU_FONT, font[(int) NFONT], 0) ;
!   do
!     {
!       if (values[i] != NULL)
!         MENU_SET(menus[menuno], MENU_STRING_ITEM, values[i], i+1, 0) ;
!       else more = 0 ;
!       i++ ;
!     }
!   while (more) ;
  }
  
  
--- 96,134 ----
  
  /*ARGSUSED*/
  void
! canvas_proc(c, event)
! Canvas c ;
  Event *event ;
  {
+        if (c == canvas)  curwin = W_MAIN ;
+   else if (c == pcanvas) curwin = W_PROPS ;
+ 
    cur_event = event ;
    handle_event() ;        /* And do the appropriate action. */
  }
  
  
  void
! close_frame(wtype)        /* Iconise reve window. */
! enum win_type wtype ;
  {
!   Frame f ;
! 
!   if (wtype == W_MAIN) f = frame ;
!   else                 f = pframe ;
!   WINDOW_SET(f, FRAME_CLOSED, TRUE, 0) ;
  }
  
  
  void
! color_area(wtype, x, y, width, height, color)
! enum win_type wtype ;
  int x, y, width, height, color ;
  {
!   Pixwin *pw ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
!   PW_WRITEBACKGROUND(pw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
  }
  
  
***************
*** 149,210 ****
  }
  
  
- do_menu(mtype)      /* Popup appropriate cycle menu and get value. */
- enum panel_type mtype ;
- {
-   int menuno ;
- 
-   menuno = (int) mtype - (int) BLACK_PLAYS ;
-   return((int) menu_show(menus[menuno], canvas,
-                           canvas_window_event(canvas, cur_event), 0)) ;
- }
- 
- 
  void
! draw_image(x, y, width, height, image)
  int x, y, width, height ;               
  enum image_type image ;   
  {                        
!   PW_ROP(cpw, x, y, width, height, PIX_SRC | PIX_DST,
           images[(int) image], 0, 0) ;
  }
  
  
  void
! draw_line(x1, y1, x2, y2, op, color)
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
    int rop ;
  
    rop = opvals[(int) op] ;
    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
      rop = opvals[(int) RCLR] ;
!   PW_VECTOR(cpw, x1, y1, x2, y2, rop | PIX_COLOR(color), 1) ;
  }
  
  
  void
! draw_stencil(x, y, width, height, op, color, stencil, image)
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
  {
    int rop ;
  
    rop = opvals[(int) op] | PIX_COLOR(color) ;
!   PW_STENCIL(cpw, x, y, width, height, rop,
               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
  }
  
  
  void
! draw_text(x, y, ftype, color, str)
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
  {
!   PW_TTEXT(cpw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  }
  
  
--- 139,203 ----
  }
  
  
  void
! draw_image(wtype, x, y, width, height, image)
! enum win_type wtype ;
  int x, y, width, height ;               
  enum image_type image ;   
  {                        
!   Pixwin *pw ;
! 
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
!   PW_ROP(pw, x, y, width, height, PIX_SRC | PIX_DST,
           images[(int) image], 0, 0) ;
  }
  
  
  void
! draw_line(wtype, x1, y1, x2, y2, op, color)
! enum win_type wtype ;
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
+   Pixwin *pw ;
    int rop ;
  
+   pw = (wtype == W_MAIN) ? cpw : ppw ;
    rop = opvals[(int) op] ;
    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
      rop = opvals[(int) RCLR] ;
!   PW_VECTOR(pw, x1, y1, x2, y2, rop | PIX_COLOR(color), 1) ;
  }
  
  
  void
! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
! enum win_type wtype ;
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
  {
+   Pixwin *pw ;
    int rop ;
  
+   pw = (wtype == W_MAIN) ? cpw : ppw ;
    rop = opvals[(int) op] | PIX_COLOR(color) ;
!   PW_STENCIL(pw, x, y, width, height, rop,
               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
  }
  
  
  void
! draw_text(wtype, x, y, ftype, color, str)
! enum win_type wtype ;
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
  {
!   Pixwin *pw ;
! 
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
!   PW_TTEXT(pw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  }
  
  
***************
*** 225,230 ****
--- 218,231 ----
  }
  
  
+ char *
+ get_resource(rtype)      /* Null routine (currently only X11 and XView). */
+ enum res_type rtype ;
+ {
+   return((char *) NULL) ;
+ }
+ 
+ 
  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  enum font_type ftype ;
  char *str ;
***************
*** 246,251 ****
--- 247,259 ----
  }
  
  
+ init_graphics(argc, argv)
+ int *argc ;
+ char *argv[] ;
+ {
+ }
+ 
+ 
  init_ws_type()
  {
    if (getenv("WINDOW_PARENT") == NULL)
***************
*** 284,289 ****
--- 292,303 ----
  
  
  void
+ load_resources()     /* Dummy routine; used with X11 and XView versions. */
+ {
+ }
+ 
+ 
+ void
  lock_screen(state)   /* Turn graphics locking on or off. */
  enum bltype state ;
  {
***************
*** 306,312 ****
                           WIN_HEIGHT,      TOTAL_HEIGHT,
                           WIN_WIDTH,       TOTAL_WIDTH,
                           WIN_CONSUME_PICK_EVENTS,
!                            MS_LEFT, MS_MIDDLE, MS_RIGHT,
                             LOC_MOVE, LOC_DRAG, LOC_TRAJECTORY,
                             LOC_WINENTER, LOC_WINEXIT,
                             0,
--- 320,326 ----
                           WIN_HEIGHT,      TOTAL_HEIGHT,
                           WIN_WIDTH,       TOTAL_WIDTH,
                           WIN_CONSUME_PICK_EVENTS,
!                            MS_LEFT, MS_MIDDLE,
                             LOC_MOVE, LOC_DRAG, LOC_TRAJECTORY,
                             LOC_WINENTER, LOC_WINEXIT,
                             0,
***************
*** 316,321 ****
--- 330,350 ----
                           WIN_EVENT_PROC, canvas_proc,
                           0) ;
    cpw = (Pixwin *) window_get(canvas, CANVAS_PIXWIN) ;
+ 
+   pcanvas = window_create(pframe, CANVAS,
+                           CANVAS_RETAINED, FALSE,
+                           WIN_HEIGHT,      PROPS_HEIGHT,
+                           WIN_WIDTH,       PROPS_WIDTH,
+                           WIN_CONSUME_PICK_EVENTS,
+                             MS_LEFT, MS_MIDDLE,
+                             0,
+                           WIN_CONSUME_KBD_EVENTS,
+                             KBD_USE, KBD_DONE, WIN_ASCII_EVENTS, WIN_UP_EVENTS,
+                             0,
+                           WIN_EVENT_PROC, canvas_proc,
+                           0) ;
+   ppw = (Pixwin *) window_get(pcanvas, CANVAS_PIXWIN) ;
+ 
    cursor[(int) CANVASCUR] = window_get(canvas, WIN_CURSOR) ;
    CURSOR_SET(cursor[(int) CANVASCUR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
    cursor[(int) HOURGLASS] = cursor_create(CURSOR_IMAGE, &hglass_pr, 0) ;
***************
*** 333,338 ****
--- 362,369 ----
    images[(int) CY_RINVERT]  = &cycle_rinvert_pr ;
    images[(int) P_WHITE]     = &white_icon_pr ;
    images[(int) P_BLACK]     = &black_icon_pr ;
+   images[(int) TOGGLE_OFF]  = &toggle_off_pr ;
+   images[(int) TOGGLE_ON]   = &toggle_on_pr ;
  }
  
  
***************
*** 352,357 ****
--- 383,396 ----
                           WIN_ERROR_MSG,    "Can't create window.",
                           FRAME_ARGS,       argc, argv,
                           0) ;
+ 
+   pframe = window_create((Window) NULL,     FRAME,
+                           FRAME_ICON,       reve_icon,
+                           FRAME_LABEL,      "reve properties",
+                           FRAME_NO_CONFIRM, TRUE,
+                           WIN_ERROR_MSG,    "Can't create window.",
+                           FRAME_ARGS,       argc, argv,
+                           0) ;
  }
  
  
***************
*** 363,368 ****
--- 402,419 ----
  
  
  void
+ open_frame(wtype)
+ enum win_type wtype ;
+ {
+   Frame f ;
+ 
+   if (wtype == W_MAIN) f = frame ;
+   else                 f = pframe ;
+   WINDOW_SET(f, WIN_SHOW, TRUE, 0) ;
+ }
+ 
+ 
+ void
  process_event()       /* Process the next canvas event. */
  {
    int id ;
***************
*** 393,399 ****
    else if (id == LOC_WINENTER || id == LOC_RGNENTER) nextc = ENTER_WINDOW ;
    else if (id == LOC_MOVE || id == LOC_DRAG || id == LOC_TRAJECTORY)
      nextc = MOUSE_MOVING ;
!   else if (id == WIN_REPAINT) nextc = FRAME_REPAINT ;
  }
  
  
--- 444,454 ----
    else if (id == LOC_WINENTER || id == LOC_RGNENTER) nextc = ENTER_WINDOW ;
    else if (id == LOC_MOVE || id == LOC_DRAG || id == LOC_TRAJECTORY)
      nextc = MOUSE_MOVING ;
!   else if (id == WIN_REPAINT)
!     {
!            if (curwin == W_MAIN) nextc = FRAME_REPAINT ;
!       else if (curwin == W_PROPS) nextc = PROPS_REPAINT ;
!     }
  }
  
  
***************
*** 417,421 ****
--- 472,477 ----
        WINDOW_SET(frame, FRAME_ICON, reve_icon, 0) ;
      }
    window_fit(frame) ;
+   window_fit(pframe) ;
    window_main_loop(frame) ;
  }

------- tty.c -------
*** /tmp/da07672	Sun Dec  9 15:20:12 1990
--- tty.c	Sun Dec  9 12:44:57 1990
***************
*** 30,39 ****
  #include <signal.h>
  
  #ifdef SYSV
- #include <string.h>
  #include <sgtty.h>
- #else
- #include <strings.h>
  #endif /*SYSV*/
  
  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
--- 30,36 ----
***************
*** 65,87 ****
  } ;
  
  struct tty_info ttyvals[MAXITEMS] = {
!       {  1,  1,  33,  33, },      /* Load */
!       { 11,  1, 107,  33, },      /* New game */
!       { 22,  1, 167,  33, },      /* Save */
!       { 33,  1, 255,  33, },      /* Show all */
!       { 44,  1, 318,  33, },      /* Suggest */
!       { 55,  1, 403,  33, },      /* Undo */
!       { -1, -1,  33,  75, },      /* Done   (not displayed). */
!       { -1, -1, 318,  75, },      /* Cancel (not displayed). */
!       { -1, -1, 403,  75, },      /* Quit   (not displayed). */
!       { 38,  5,  15, 114, },      /* Black: */
!       { 38,  7, 237, 114, },      /* White: */
!       { 38,  9,  15, 156, },      /* Difficuly: */
!       { 38, 11, 237, 156, },      /* Notes: */
        { -1, -1,  -1,  -1, },      /* Panel message. */
        { -1, -1,  -1,  -1, },      /* Notes message. */
        { -1, -1,  -1,  -1, },      /* Score message. */
        { -1, -1,  -1,  -1, },      /* Turn message. */
  } ;
  
  struct other_info {   /* Information needed to place other text values. */
--- 62,91 ----
  } ;
  
  struct tty_info ttyvals[MAXITEMS] = {
!       {  1,  1,  43,  32, },      /* Load */
!       { 11,  1, 117,  32, },      /* Moves? */
!       { 22,  1, 191,  32, },      /* New game */
!       { 33,  1, 265,  32, },      /* Save */
!       { 44,  1, 339,  32, },      /* Suggest */
!       { 55,  1, 413,  32, },      /* Undo */
!       { -1, -1,  43,  74, },      /* Props  (not displayed). */
!       { -1, -1, 339,  74, },      /* Cancel (not displayed). */
!       { -1, -1, 413,  74, },      /* Quit   (not displayed). */
!       { 60,  5,  15, 111, },      /* Black: */
!       { 60,  7, 237, 111, },      /* White: */
        { -1, -1,  -1,  -1, },      /* Panel message. */
        { -1, -1,  -1,  -1, },      /* Notes message. */
        { -1, -1,  -1,  -1, },      /* Score message. */
        { -1, -1,  -1,  -1, },      /* Turn message. */
+       { -1, -1,  -1,  -1, },      /* Computer choice.: */
+       { -1, -1,  -1,  -1, },      /* Difficulty. */
+       { -1, -1,  -1,  -1, },      /* Maximum search depth. */
+       { -1, -1,  -1,  -1, },      /* Animate option: */
+       { -1, -1,  -1,  -1, },      /* Best computer move option. */
+       { -1, -1,  -1,  -1, },      /* Last move option. */
+       { -1, -1,  -1,  -1, },      /* Show evaluation option. */
+       { -1, -1,  -1,  -1, },      /* Number move option. */
+       { -1, -1,  -1,  -1, },      /* Quick game option. */
  } ;
  
  struct other_info {   /* Information needed to place other text values. */
***************
*** 91,112 ****
  
  struct other_info othervals[MAXITEMS] = {
        { -1, -1, },       /* Load     (ignored). */
        { -1, -1, },       /* New game (ignored). */
        { -1, -1, },       /* Save     (ignored). */
-       { -1, -1, },       /* Show all (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
        { -1, -1, },       /* Done     (ignored). */
        { -1, -1, },       /* Cancel   (ignored). */
        { -1, -1, },       /* Quit     (ignored). */
!       { 60,  5, },       /* Black: */
!       { 60,  7, },       /* White: */
!       { 60,  9, },       /* Difficuly: */
!       { 60, 11, },       /* Notes: */
        { 38, 13, },       /* Panel message. */
        { 38, 15, },       /* Notes message. */
        { 38, 17, },       /* Score message. */
        { 38, 19, },       /* Turn message. */
  } ;
  
  
--- 95,123 ----
  
  struct other_info othervals[MAXITEMS] = {
        { -1, -1, },       /* Load     (ignored). */
+       { -1, -1, },       /* Moves?   (ignored). */
        { -1, -1, },       /* New game (ignored). */
        { -1, -1, },       /* Save     (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
        { -1, -1, },       /* Done     (ignored). */
        { -1, -1, },       /* Cancel   (ignored). */
        { -1, -1, },       /* Quit     (ignored). */
!       { 38,  5, },       /* Black: */
!       { 38,  7, },       /* White: */
        { 38, 13, },       /* Panel message. */
        { 38, 15, },       /* Notes message. */
        { 38, 17, },       /* Score message. */
        { 38, 19, },       /* Turn message. */
+       { -1, -1, },       /* Computer choice. */
+       { 60,  9, },       /* Difficulty. */
+       { -1, -1, },       /* Maximum search depth. */
+       { -1, -1, },       /* Animate option: */
+       { -1, -1, },       /* Best computer move option. */
+       { -1, -1, },       /* Last move option. */
+       { 60, 11, },       /* Show evaluation option. */
+       { -1, -1, },       /* Number move option. */
+       { -1, -1, },       /* Quick game option. */
  } ;
  
  
***************
*** 131,137 ****
  
  /*ARGSUSED*/
  void
! color_area(x, y, width, height, color)
  int x, y, width, height, color ;
  {
    char nextline[MAXLINE] ;
--- 142,149 ----
  
  /*ARGSUSED*/
  void
! color_area(wtype, x, y, width, height, color)
! enum win_type wtype ;
  int x, y, width, height, color ;
  {
    char nextline[MAXLINE] ;
***************
*** 175,189 ****
  }
  
  
- /*ARGSUSED*/
  void
- create_menu(mtype, values)     /* Create popup menus - null routine. */
- enum panel_type mtype ;
- char *values[] ;
- {}
- 
- 
- void
  destroy_frame()       /* Destroy reve window. */
  {
    tputs(CL, 1, outc) ;
--- 187,193 ----
***************
*** 200,213 ****
  }
  
  
- /*ARGSUSED*/
- do_menu(mtype)                /* Popup appropriate menu - not used. */
- enum panel_type mtype ;
- {
-   return 0 ;
- }
- 
- 
  static void
  do_standend()                 /* Finish inverted area. */
  {
--- 204,209 ----
***************
*** 224,230 ****
  
  /*ARGSUSED*/
  void
! draw_image(x, y, width, height, image)    /* Null routine. */
  int x, y, width, height ;
  enum image_type image ;
  {}
--- 220,227 ----
  
  /*ARGSUSED*/
  void
! draw_image(wtype, x, y, width, height, image)    /* Null routine. */
! enum win_type wtype ;
  int x, y, width, height ;
  enum image_type image ;
  {}
***************
*** 232,238 ****
  
  /*ARGSUSED*/
  void
! draw_line(x1, y1, x2, y2, op, color)
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
--- 229,236 ----
  
  /*ARGSUSED*/
  void
! draw_line(wtype, x1, y1, x2, y2, op, color)
! enum win_type wtype ;
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
***************
*** 258,264 ****
  
  /*ARGSUSED*/
  void
! draw_stencil(x, y, width, height, op, color, stencil, image)
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
--- 256,263 ----
  
  /*ARGSUSED*/
  void
! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
! enum win_type wtype ;
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
***************
*** 317,323 ****
  
  /*ARGSUSED*/
  void
! draw_text(x, y, ftype, color, str)
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
--- 316,323 ----
  
  /*ARGSUSED*/
  void
! draw_text(wtype, x, y, ftype, color, str)
! enum win_type wtype ;
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
***************
*** 339,348 ****
        return ;
      }
  
! /* Check for the four panel message types. */
  
!   else if (x == 15 && y == 195)        /* Panel message. */
      {
        if (EQUAL(str, "Use left"))
          STRCPY(str, "Select a letter/number pair for a move") ;
        draw_string(othervals[(int) PANEL_MES].column,
--- 339,360 ----
        return ;
      }
  
! /* Check for the six panel message types. */
  
!   else if (x == 15 && y == 111)        /* Black: message. */
      {
+       draw_string(othervals[(int) BLACK_PLAYS].column,
+                   othervals[(int) BLACK_PLAYS].row, str, FALSE) ;
+       return ;
+     }
+   else if (x == 237 && y == 111)       /* White: message. */
+     {
+       draw_string(othervals[(int) WHITE_PLAYS].column,
+                   othervals[(int) WHITE_PLAYS].row, str, FALSE) ;
+       return ;
+     }
+   else if (x == 15 && y == 153)        /* Panel message. */
+     {
        if (EQUAL(str, "Use left"))
          STRCPY(str, "Select a letter/number pair for a move") ;
        draw_string(othervals[(int) PANEL_MES].column,
***************
*** 349,361 ****
                    othervals[(int) PANEL_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 15 && y == 237)       /* Note message. */
      {
        draw_string(othervals[(int) EVAL_MES].column,
                    othervals[(int) EVAL_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 15 && y == 279)        /* Score message. */
      {
        if (sscanf(str, "Stones: Black: %d White: %d", &black, &white) == 2)
          SPRINTF(str, "Black (O): %d, White (X): %d", black, white) ;
--- 361,373 ----
                    othervals[(int) PANEL_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 15 && y == 195)       /* Evaluation message. */
      {
        draw_string(othervals[(int) EVAL_MES].column,
                    othervals[(int) EVAL_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 15 && y == 237)        /* Score message. */
      {
        if (sscanf(str, "Stones: Black: %d White: %d", &black, &white) == 2)
          SPRINTF(str, "Black (O): %d, White (X): %d", black, white) ;
***************
*** 363,369 ****
                    othervals[(int) SCORE_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 237 && y == 279)       /* Turn message. */
      {
        draw_string(othervals[(int) TURN_MES].column,
                    othervals[(int) TURN_MES].row, str, TRUE) ;
--- 375,381 ----
                    othervals[(int) SCORE_MES].row, str, TRUE) ;
        return ;
      }
!   else if (x == 237 && y == 237)       /* Turn message. */
      {
        draw_string(othervals[(int) TURN_MES].column,
                    othervals[(int) TURN_MES].row, str, TRUE) ;
***************
*** 370,378 ****
        return ;
      }
  
  /* Check for panel and cyclic items. */
  
!   for (i = 0; i < MAXITEMS-4; i++)
      if (EQUAL(str, items[i].text))
        if (ttyvals[i].column != -1)
          {
--- 382,405 ----
        return ;
      }
  
+ /* Check for the two player strings. */
+ 
+   else if (x == 163 && y == 111)       /* Black plays: value. */
+     {
+       draw_string(ttyvals[(int) BLACK_PLAYS].column,
+                   ttyvals[(int) BLACK_PLAYS].row, str, TRUE) ;
+       return ;
+     }
+   else if (x == 385 && y == 111)       /* White plays: value. */
+     {
+       draw_string(ttyvals[(int) WHITE_PLAYS].column,
+                   ttyvals[(int) WHITE_PLAYS].row, str, TRUE) ;
+       return ;
+     }
+ 
  /* Check for panel and cyclic items. */
  
!   for (i = 0; i < MAXITEMS-13; i++)
      if (EQUAL(str, items[i].text))
        if (ttyvals[i].column != -1)
          {
***************
*** 389,399 ****
  
    switch (y)
      {
!       case 111  : if (x == 182) pt = BLACK_PLAYS ;      /* Black plays. */
                    else          pt = WHITE_PLAYS ;      /* White plays. */
                    break ;
!       case 153  : if (x == 182) pt = DIFFICULTY ;       /* Difficulty. */
!                   else          pt = NOTES ;            /* Notes. */
                    break ;
        default   : return ;   /* We're not interested in this piece of text. */
      }
--- 416,426 ----
  
    switch (y)
      {
!       case 111  : if (x == 163) pt = BLACK_PLAYS ;      /* Black plays. */
                    else          pt = WHITE_PLAYS ;      /* White plays. */
                    break ;
!       case 153  : if (x == 163) pt = DIFF_CHOICE ;      /* Difficulty. */
!                   else          pt = OPT_EVAL ;         /* Notes. */
                    break ;
        default   : return ;   /* We're not interested in this piece of text. */
      }
***************
*** 413,418 ****
--- 440,453 ----
  }
   
   
+ char *
+ get_resource(rtype)      /* Null routine (currently only X11 and XView). */
+ enum res_type rtype ;
+ {
+   return((char *) NULL) ;
+ }
+ 
+ 
  /*ARGSUSED*/
  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  enum font_type ftype ;
***************
*** 430,435 ****
--- 465,477 ----
  }
  
  
+ init_graphics(argc, argv)
+ int *argc ;
+ char *argv[] ;
+ {
+ }
+ 
+ 
  init_ws_type()
  {
    char bp[1024], termtype[MAXLINE] ;
***************
*** 456,461 ****
--- 498,509 ----
  }
  
  
+ void
+ load_resources()     /* Dummy routine; used with X11 and XView versions. */
+ {
+ }
+ 
+ 
  /*ARGSUSED*/
  void
  lock_screen(state)     /* Graphics locking - null routine. */
***************
*** 489,494 ****
--- 537,550 ----
  {}
  
  
+ /*ARGSUSED*/
+ void
+ open_frame(wtype)
+ enum win_type wtype ;
+ {
+ }
+ 
+ 
  static void
  outc(c)                 /* Output the next character to the screen. */
  register int c ;
***************
*** 532,539 ****
    for (;;)
      {
        get_event() ;          /* Get next canvas event. */
!       process_event() ;      /* Find out what kind it is. */
!       handle_event() ;       /* And do the apropriate action. */
      }
  }
  
--- 588,594 ----
    for (;;)
      {
        get_event() ;          /* Get next canvas event. */
!       handle_event() ;       /* And do the appropriate action. */
      }
  }
  

------- x11.c -------
*** /tmp/da07675	Sun Dec  9 15:20:14 1990
--- x11.c	Sat Dec  8 19:50:52 1990
***************
*** 27,32 ****
--- 27,34 ----
  #include "color.h"
  #include "extern.h"
  #include "images.h"
+ #include <ctype.h>
+ #include <sys/param.h>
  #include <sys/time.h>
  
  #include <X11/Xlib.h>
***************
*** 35,40 ****
--- 37,43 ----
  #include <X11/Xos.h>
  #include <X11/cursorfont.h>
  #include <X11/keysym.h>
+ #include <X11/Xresource.h>
  
  #define  BOLDFONT    "lucidasanstypewriter-bold-12"
  #define  DEFFONT     "fixed"
***************
*** 44,50 ****
                        EnterWindowMask | KeyPressMask      | LeaveWindowMask | \
                        PointerMotionMask)
  
! #define  OTHELLO_BORDER_WIDTH  2
  
  enum gr_type gtype = GX11 ;        /* Graphics type. */
  
--- 47,53 ----
                        EnterWindowMask | KeyPressMask      | LeaveWindowMask | \
                        PointerMotionMask)
  
! #define  REVE_BORDER_WIDTH  2
  
  enum gr_type gtype = GX11 ;        /* Graphics type. */
  
***************
*** 60,71 ****
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
! Window frame[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
  XEvent event ;
  XFontStruct *font[MAXFONTS] ;
! XSizeHints size ;
  XWMHints wm_hints ;
  XGCValues gc_val ;              /* Used to setup graphics context values. */
  int gc_flags ;                  /* Used to set up graphics context flags. */
--- 63,75 ----
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
! Window frame[MAXDPY], pframe[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
  XEvent event ;
  XFontStruct *font[MAXFONTS] ;
! XrmDatabase reve_DB[MAXDPY] ;   /* Combined resources database. */
! XSizeHints psize, size ;
  XWMHints wm_hints ;
  XGCValues gc_val ;              /* Used to setup graphics context values. */
  int gc_flags ;                  /* Used to set up graphics context flags. */
***************
*** 139,154 ****
  
  
  void
! close_frame()            /* Iconise reve window. */
  {
    int d ;
    XEvent event ;
  
    d = (int) cur_dpyno ;
    iconic = 1 ;
    event.xclient.type = ClientMessage ;
    event.xclient.display = dpy[d] ;
!   event.xclient.window = frame[d] ;
    event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
    event.xclient.format = 32 ;
    event.xclient.data.l[0] = IconicState ;
--- 143,163 ----
  
  
  void
! close_frame(wtype)            /* Iconise reve window. */
! enum win_type wtype ;
  {
    int d ;
    XEvent event ;
+   Window window ;
  
    d = (int) cur_dpyno ;
+   if (wtype == W_MAIN) window = frame[d] ;
+   else                 window = pframe[d] ;
+ 
    iconic = 1 ;
    event.xclient.type = ClientMessage ;
    event.xclient.display = dpy[d] ;
!   event.xclient.window = window ;
    event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
    event.xclient.format = 32 ;
    event.xclient.data.l[0] = IconicState ;
***************
*** 158,169 ****
  
  
  void
! color_area(x, y, width, height, color)
  int x, y, width, height, color ;
  {
    int d ;
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
--- 167,181 ----
  
  
  void
! color_area(wtype, x, y, width, height, color)
! enum win_type wtype ;
  int x, y, width, height, color ;
  {
+   Window window ;
    int d ;
  
    d = (int) cur_dpyno ;
+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
***************
*** 172,191 ****
      }
    gc_val.function = GXcopy ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
!   XFillRectangle(dpy[d], frame[d], gc[d], x, y,
                   (unsigned int) width, (unsigned int) height) ;
  }
  
  
- /*ARGSUSED*/
  void
- create_menu(mtype, values)    /* Create the various popup menus. */
- enum panel_type mtype ;
- char *values[] ;
- {}
- 
- 
- void
  destroy_frame()          /* Destroy reve window. */
  {
    XDestroyWindow(dpy[(int) cur_dpyno], frame[(int) cur_dpyno]) ;
--- 184,195 ----
      }
    gc_val.function = GXcopy ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
!   XFillRectangle(dpy[d], window, gc[d], x, y,
                   (unsigned int) width, (unsigned int) height) ;
  }
  
  
  void
  destroy_frame()          /* Destroy reve window. */
  {
    XDestroyWindow(dpy[(int) cur_dpyno], frame[(int) cur_dpyno]) ;
***************
*** 192,230 ****
  }
  
  
- /*ARGSUSED*/
- do_menu(mtype)          /* Display popup menu for cyclic item. */
- enum item_type mtype ;
- {
-   return(0) ;
- }
- 
- 
  void
! draw_image(x, y, width, height, image)
  int x, y, width, height ;
  enum image_type image ;
  {
    int d ;
  
    d = (int) cur_dpyno ;
    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    gc_val.stipple = images[(int) image] ;
    gc_val.ts_x_origin = x ;
    gc_val.ts_y_origin = y ;
    XChangeGC(dpy[d], ropgc[d], gc_mask, &gc_val) ;
!   XFillRectangle(dpy[d], frame[d], ropgc[d], x, y, width, height) ;
  }
  
  
  void
! draw_line(x1, y1, x2, y2, op, color)
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
    int d ;
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      {
--- 196,232 ----
  }
  
  
  void
! draw_image(wtype, x, y, width, height, image)
! enum win_type wtype ;
  int x, y, width, height ;
  enum image_type image ;
  {
+   Window window ;
    int d ;
  
    d = (int) cur_dpyno ;
+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    gc_val.stipple = images[(int) image] ;
    gc_val.ts_x_origin = x ;
    gc_val.ts_y_origin = y ;
    XChangeGC(dpy[d], ropgc[d], gc_mask, &gc_val) ;
!   XFillRectangle(dpy[d], window, ropgc[d], x, y, width, height) ;
  }
  
  
  void
! draw_line(wtype, x1, y1, x2, y2, op, color)
! enum win_type wtype ;
  int x1, y1, x2, y2, color ;
  enum optype op ;
  {
+   Window window ;
    int d ;
  
    d = (int) cur_dpyno ;
+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      {
***************
*** 233,251 ****
      }
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
!   XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
  }
  
  
  void
! draw_stencil(x, y, width, height, op, color, stencil, image)
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
  {
    int d ;
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else            gc_val.foreground = foregnd[d] ;
    gc_val.function = opvals[(int) op] ;
--- 235,256 ----
      }
    gc_val.function = opvals[(int) op] ;
    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
!   XDrawLine(dpy[d], window, gc[d], x1, y1, x2, y2) ;
  }
  
  
  void
! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
! enum win_type wtype ;
  int x, y, width, height, color ;
  enum optype op ;
  enum image_type stencil, image ;
  {
+   Window window ;
    int d ;
  
    d = (int) cur_dpyno ;
+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else            gc_val.foreground = foregnd[d] ;
    gc_val.function = opvals[(int) op] ;
***************
*** 259,277 ****
              GCClipXOrigin | GCClipYOrigin |
              GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    XChangeGC(dpy[d], stencilgc[d], gc_mask, &gc_val) ;
!   XFillRectangle(dpy[d], frame[d], stencilgc[d], x, y, width, height) ;
  }
  
  
  void
! draw_text(x, y, ftype, color, str)
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
  {
    int d ;
  
    d = (int) cur_dpyno ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
--- 264,285 ----
              GCClipXOrigin | GCClipYOrigin |
              GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    XChangeGC(dpy[d], stencilgc[d], gc_mask, &gc_val) ;
!   XFillRectangle(dpy[d], window, stencilgc[d], x, y, width, height) ;
  }
  
  
  void
! draw_text(wtype, x, y, ftype, color, str)
! enum win_type wtype ;
  enum font_type ftype ;
  int x, y, color ;
  char *str ;
  {
+   Window window ;
    int d ;
  
    d = (int) cur_dpyno ;
+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
***************
*** 281,287 ****
    gc_val.font = font[(int) ftype]->fid ;
    gc_val.function = GXcopy ;
    XChangeGC(dpy[d], gc[d], GCFont | GCForeground | GCFunction, &gc_val) ;
!   XDrawString(dpy[d], frame[d], gc[d], x, y, str, strlen(str)) ;
  }
   
   
--- 289,295 ----
    gc_val.font = font[(int) ftype]->fid ;
    gc_val.function = GXcopy ;
    XChangeGC(dpy[d], gc[d], GCFont | GCForeground | GCFunction, &gc_val) ;
!   XDrawString(dpy[d], window, gc[d], x, y, str, strlen(str)) ;
  }
   
   
***************
*** 313,318 ****
--- 321,346 ----
  }
  
  
+ char *
+ get_resource(rtype)      /* Get Reve resource from merged databases. */
+ enum res_type rtype ;
+ {
+   char cstr[MAXLINE], nstr[MAXLINE], str[MAXLINE] ;
+   char *str_type[20] ;
+   int d ;
+   XrmValue value ;
+ 
+   d = (int) cur_dpyno ;
+   STRCPY(str, resources[(int) rtype]) ;
+   SPRINTF(nstr,  "reve.%s", str) ;
+   if (islower(str[0])) str[0] = toupper(str[0]) ;
+   SPRINTF(cstr, "Reve.%s", str) ;
+   if (XrmGetResource(reve_DB[d], nstr, cstr, str_type, &value) == NULL)
+     return((char *) NULL) ;
+   else return(value.addr) ;
+ }
+ 
+ 
  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  enum font_type ftype ;
  char *str ;
***************
*** 357,362 ****
--- 385,400 ----
  }
  
  
+ /*ARGSUSED*/
+ init_graphics(argc, argv)
+ int *argc ;
+ char *argv[] ;
+ {
+   dpy[(int) DPY1] = XOpenDisplay((char *) NULL) ;
+   reve_DB[(int) DPY1] = NULL ;
+ }
+ 
+ 
  init_ws_type()
  {
  #ifndef NOSELECT
***************
*** 382,387 ****
--- 420,427 ----
    images[(int) CY_STENCIL]  = load_image(cycle_stencil_image) ;
    images[(int) CY_LINVERT]  = load_image(cycle_linvert_image) ;
    images[(int) CY_RINVERT]  = load_image(cycle_rinvert_image) ;
+   images[(int) TOGGLE_ON]   = load_image(sch_on_image) ;
+   images[(int) TOGGLE_OFF]  = load_image(sch_off_image) ;
    images[(int) P_WHITE]     = load_image(white_image) ;
    images[(int) P_BLACK]     = load_image(black_image) ;
  
***************
*** 472,477 ****
--- 512,578 ----
  }
  
  
+ /*  Get the resource databases. These are looked for in the following ways:
+  *
+  *  Classname file in the app-defaults directory. In this case, Classname
+  *  is Reve.
+  *
+  *  Classname file in the directory specified by the XUSERFILESEARCHPATH
+  *  or XAPPLRESDIR environment variable.
+  *
+  *  Property set using xrdb, accessible through the XResourceManagerString
+  *  macro or, if that is empty, the ~/.Xdefaults file.
+  *
+  *  XENVIRONMENT environment variable or, if not set, .Xdefaults-hostname
+  *  file.
+  */
+ 
+ void
+ load_resources()
+ { 
+   XrmDatabase db ;
+   char *home, name[MAXPATHLEN], *ptr ;
+   int d, len ;
+   
+   d = (int) cur_dpyno ;
+   home = getenv("HOME") ;
+   XrmInitialize() ;
+   STRCPY(name, "/usr/lib/X11/app-defaults/Reve") ;
+   
+ /* Get applications defaults file, if any. */
+   
+   db = XrmGetFileDatabase(name) ;
+   XrmMergeDatabases(db, &reve_DB[d]) ;
+ 
+ /* Merge server defaults, created by xrdb. If nor defined, use ~/.Xdefaults. */
+ 
+ #ifndef X11R3
+   if (XResourceManagerString(dpy[d]) != NULL)
+     db = XrmGetStringDatabase(XResourceManagerString(dpy[d])) ;
+   else
+ #endif /*X11R3*/
+     { 
+       SPRINTF(name, "%s/.Xdefaults", home) ;
+       db = XrmGetFileDatabase(name) ;
+     }
+   XrmMergeDatabases(db, &reve_DB[d]) ;
+ 
+ /*  Open XENVIRONMENT file or, if not defined, the .Xdefaults, and merge
+  *  into existing database.
+  */
+ 
+   if ((ptr = getenv("XENVIRONMENT")) == NULL)
+     {
+       SPRINTF(name, "%s/.Xdefaults-", home) ;
+       len = strlen(name) ;
+       GETHOSTNAME(name+len, 1024-len) ;
+       db = XrmGetFileDatabase(name) ;
+     }
+   else db = XrmGetFileDatabase(ptr) ;
+   XrmMergeDatabases(db, &reve_DB[d]) ;
+ }
+ 
+ 
  /*ARGSUSED*/
  void
  lock_screen(state)     /* Turn graphics locking on or off - null routine. */
***************
*** 528,534 ****
  
    frame[d] = XCreateSimpleWindow(dpy[d], root[d],
                                   size.x, size.y, size.width, size.height,
!                                  OTHELLO_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  
    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
--- 629,635 ----
  
    frame[d] = XCreateSimpleWindow(dpy[d], root[d],
                                   size.x, size.y, size.width, size.height,
!                                  REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  
    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
***************
*** 552,557 ****
--- 653,676 ----
  
    XSetClassHint(dpy[d], frame[d], &class_hint) ;
  
+ /*  Setup property window. */
+ 
+   psize.flags = PMinSize | PMaxSize | PPosition | PSize ;
+   psize.x = TOTAL_WIDTH + 10 ;
+   psize.y = 0 ;
+   psize.max_width = size.min_width = size.width = PROPS_WIDTH ;
+   psize.max_height = size.min_height = size.height = PROPS_HEIGHT ;
+ 
+   pframe[d] = XCreateSimpleWindow(dpy[d], root[d],
+                                   size.x + TOTAL_WIDTH + 10, size.y,
+                                   PROPS_WIDTH, PROPS_HEIGHT,
+                                   REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
+ 
+   XSetStandardProperties(dpy[d], pframe[d], "reve properties",
+                          "Props", reve_icon[d], argv, argc, &psize) ;
+ 
+ /* Create graphics contexts. */
+ 
    gc_mask = GCForeground | GCBackground | GCGraphicsExposures ;
    gc_val.foreground = foregnd[d] ;
    gc_val.background = backgnd[d] ;
***************
*** 600,605 ****
--- 719,739 ----
  
  
  void
+ open_frame(wtype)
+ enum win_type wtype ;
+ {
+   int d ;
+   Window window ;
+ 
+   d = (int) cur_dpyno ;
+   if (wtype == W_MAIN) window = frame[d] ;
+   else                 window = pframe[d] ;
+   XSelectInput(dpy[0], window, FRAME_MASK) ;
+   XMapWindow(dpy[0], window) ;
+ }
+ 
+ 
+ void
  process_event()         /* Determine event type. */
  {
    XClientMessageEvent *ev ;
***************
*** 609,614 ****
--- 743,751 ----
    int d ;
  
    d = (int) cur_dpyno ; 
+        if (event.xany.window == frame[(int) cur_dpyno])  curwin = W_MAIN ;
+   else if (event.xany.window == pframe[(int) cur_dpyno]) curwin = W_PROPS ;
+ 
    switch (event.type)
      {
        case ClientMessage    : /* Catch ICCCM kill from WM. */
***************
*** 669,683 ****
  XExposeEvent *event ;
  {
    int d ;
!   int doframe = 0 ;
  
    d = (int) cur_dpyno ;
    do
!     if (event->count == 0 && event->window == frame[(int) cur_dpyno])
!       doframe++ ;
    while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
  
!   return(doframe ? FRAME_REPAINT : IGNORE_EVENT) ;
  }
  
  
--- 806,827 ----
  XExposeEvent *event ;
  {
    int d ;
!   int doframe  = 0 ;
!   int dopframe = 0 ;
  
    d = (int) cur_dpyno ;
    do
!     {
!       if (event->count == 0 && event->window == frame[(int) cur_dpyno])
!         doframe++ ;
!       if (event->count == 0 && event->window == pframe[(int) cur_dpyno])
!         dopframe++ ;
!     }
    while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
  
!        if (doframe)  return(FRAME_REPAINT) ;
!   else if (dopframe) return(PROPS_REPAINT) ;
!   else               return(IGNORE_EVENT) ;
  }
  
  
***************
*** 697,709 ****
  start_tool(dtype)            /* Start event dispatcher and display. */
  enum disp_type dtype ;
  {
!   XSelectInput(dpy[0], frame[0], FRAME_MASK) ;
!   XMapWindow(dpy[0], frame[0]) ;
  
    if (dtype == XTWO)
      {
        XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
        XMapWindow(dpy[1], frame[1]) ;
      }
  
    if (dtype == XTWO) Xselect_input() ;
--- 841,854 ----
  start_tool(dtype)            /* Start event dispatcher and display. */
  enum disp_type dtype ;
  {
!   open_frame(W_MAIN) ;
!   XSelectInput(dpy[0], pframe[0], FRAME_MASK) ;
  
    if (dtype == XTWO)
      {
        XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
        XMapWindow(dpy[1], frame[1]) ;
+       XSelectInput(dpy[1], pframe[1], FRAME_MASK) ;
      }
  
    if (dtype == XTWO) Xselect_input() ;