These are a few patches for PDCurses in order to use it with GPC's
CRT unit. They were written by Frank Heckenbach <frank@pascal.gnu.de>.
They will be incorporated into the next PDCurses release, but
currently, they are unofficial patches.

--- Makefile.in.orig	Mon Mar  1 12:13:54 1999
+++ Makefile.in	Wed May 26 03:02:16 1999
@@ -32,12 +32,13 @@
 	cd tools; $(MAKE) $(MFLAGS) $@
 
 install:
+	$(INSTALL) -d $(includedir) $(libdir)
 	$(INSTALL_DATA) $(srcdir)/curses.h $(includedir)/xcurses.h
-	$(INSTALL_DATA) $(srcdir)/panel.h $(includedir)/panel.h
+	$(INSTALL_DATA) $(srcdir)/panel.h $(includedir)/xpanel.h
 	$(INSTALL_DATA) pdcurses/libXCurses.a $(libdir)/libXCurses.a
 	$(RANLIB) $(libdir)/libXCurses.a
-	$(INSTALL_DATA) panel/libpanel.a $(libdir)/libpanel.a
-	$(RANLIB) $(libdir)/libpanel.a
+	$(INSTALL_DATA) panel/libpanel.a $(libdir)/libXPanel.a
+	$(RANLIB) $(libdir)/libXPanel.a
 
 clean ::
 	rm -f config.log config.cache config.status
--- curses.h.orig	Sat May 22 03:46:29 1999
+++ curses.h	Wed May 26 02:40:08 1999
@@ -2024,6 +2024,10 @@
 #define PDC_KEY_MODIFIER_CONTROL   (1 << 1)
 #define PDC_KEY_MODIFIER_ALT       (1 << 2)
 #define PDC_KEY_MODIFIER_NUMLOCK   (1 << 3)
+#define PDC_KEY_MODIFIER_CAPSLOCK  (1 << 4)
+#define PDC_KEY_MODIFIER_MOD3      (1 << 5)
+#define PDC_KEY_MODIFIER_MOD4      (1 << 6)
+#define PDC_KEY_MODIFIER_MOD5      (1 << 7)
 
 /*
  *      Load up curspriv.h.     This should be in the same place as
--- x11/x11.c.orig	Fri May 21 14:53:29 1999
+++ x11/x11.c	Wed May 26 05:22:43 1999
@@ -3191,7 +3191,7 @@
 #ifdef FOREIGN
  wchar_t buffer[120];
 #else
- char buffer[120];
+ unsigned char buffer[120];
 #endif
  int buflen=40;
  int count,key,i;
@@ -3378,6 +3378,22 @@
     if (event->xkey.state & Mod1Mask)  /* 0x08: usually, alt modifier */
     {
        modifier |= PDC_KEY_MODIFIER_ALT;
+    }
+    if (event->xkey.state & LockMask)  /* 0x02: lock modifier */
+    {
+       modifier |= PDC_KEY_MODIFIER_CAPSLOCK;
+    }
+    if (event->xkey.state & Mod3Mask)  /* 0x20: modifier #3 */
+    {
+       modifier |= PDC_KEY_MODIFIER_MOD3;
+    }
+    if (event->xkey.state & Mod4Mask)  /* 0x40: modifier #4 */
+    {
+       modifier |= PDC_KEY_MODIFIER_MOD4;
+    }
+    if (event->xkey.state & Mod5Mask)  /* 0x80: modifier #5 */
+    {
+       modifier |= PDC_KEY_MODIFIER_MOD5;
     }
  }
  for (i=0;XCursesKeys[i].keycode != 0;i++)
--- pdcurses/getyx.c.orig	Sun Sep  8 05:40:04 1996
+++ pdcurses/getyx.c	Tue Jun  1 02:15:04 1999
@@ -163,6 +163,7 @@
 
 	return(win->_parx);
 }
+#ifndef LIBBCC
 /***********************************************************************/
 #ifdef HAVE_PROTO
 int	PDC_CDECL	getmaxy(WINDOW *win)
@@ -199,3 +200,4 @@
 
 	return(win->_maxx);
 }
+#endif
--- Makefile.in.orig	Fri Jul 30 00:29:12 1999
+++ Makefile.in	Fri Jul 30 00:29:54 1999
@@ -34,7 +34,8 @@
 install:
 	$(INSTALL) -d $(includedir) $(libdir)
 	$(INSTALL_DATA) $(srcdir)/curses.h $(includedir)/xcurses.h
-	$(INSTALL_DATA) $(srcdir)/panel.h $(includedir)/xpanel.h
+	sed -e 's/#include <curses.h>/#include <xcurses.h>/' < panel.h > xpanel.h
+	$(INSTALL_DATA) $(srcdir)/xpanel.h $(includedir)/xpanel.h
 	$(INSTALL_DATA) pdcurses/libXCurses.a $(libdir)/libXCurses.a
 	$(RANLIB) $(libdir)/libXCurses.a
 	$(INSTALL_DATA) panel/libpanel.a $(libdir)/libXPanel.a
--- panel/panel.c.orig	Fri Apr 26 06:19:34 1996
+++ panel/panel.c	Fri Jul 30 00:59:23 1999
@@ -218,13 +218,10 @@
 {
 	if(!pan1 || !pan2)
 		return(0);
-	if((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy) &&
-		(pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx))
-		return(1);
-	if((pan1->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy) &&
-		(pan1->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx))
-		return(1);
-	return(0);
+	return ((pan1->wstarty >= pan2->wstarty && pan1->wstarty < pan2->wendy) ||
+	        (pan2->wstarty >= pan1->wstarty && pan2->wstarty < pan1->wendy)) &&
+	       ((pan1->wstartx >= pan2->wstartx && pan1->wstartx < pan2->wendx) ||
+	        (pan2->wstartx >= pan1->wstartx && pan2->wstartx < pan1->wendx));
 }	/* end of __panels_overlapped */
 
 /*+-------------------------------------------------------------------------
--- pdcurses/pdcwin.c.orig	Sun Aug  2 08:50:26 1998
+++ pdcurses/pdcwin.c	Fri Jul 30 01:31:52 1999
@@ -1098,8 +1098,12 @@
  *                   a window when scrolling occurs via a newline.  This
  *                   could be a feature that isn't intended, but I'll
  *                   implement it here as well for consistency.
+ *
+ * fh -- 7/30/99 ** but it causes problems with panels -- a lower panel
+ *                  might be refreshed without updating the obscuring
+ *                  parts of other panels.
  */
- 			wrefresh(win);
+ 			/* wrefresh(win); */
 		}
 		else
 			return( -1 );
--- panel/panel.c.orig	Fri Jul 30 02:40:03 1999
+++ panel/panel.c	Fri Jul 30 02:40:06 1999
@@ -989,7 +989,7 @@
 	{
 		while(pan)
 		{
-			if(is_wintouched(pan->win))
+			if(is_wintouched(pan->win) || !pan->above)
 				Wnoutrefresh(pan);
 			pan = pan->above;
 		}
--- panel/panel.c.orig	Mon Aug  2 01:24:48 1999
+++ panel/panel.c	Mon Aug  2 01:24:52 1999
@@ -846,6 +846,10 @@
 	if(__panel_is_linked(pan))
 		__override(pan,0);
 	pan->win = win;
+	pan->wstarty = getbegy(win);
+	pan->wstartx = getbegx(win);
+	pan->wendy = pan->wstarty + getmaxy(win);
+	pan->wendx = pan->wstartx + getmaxx(win);
 	if(__panel_is_linked(pan))
 		__calculate_obscure();
 	return(OK);
--- dos/pdcscrn.c.orig	Thu Nov 11 07:43:03 1999
+++ dos/pdcscrn.c	Thu Nov 11 07:59:49 1999
@@ -319,9 +319,11 @@
 		break;
 
 	case _VGACOLOR:
+		if	(ncols > 40)		PDC_set_scrn_mode(3);
+		else				PDC_set_scrn_mode(1);
 		if	(nlines > 28)		PDC_set_font(_FONT8);
 		else	if (nlines > 25)	PDC_set_font(_FONT14);
-		else				PDC_set_80x25();
+		else				PDC_set_font(_FONT16);
 		break;
 
 	default:
--- x11/x11.c.orig	Mon Sep  2 02:50:48 2002
+++ x11/x11.c	Mon Sep  2 02:52:23 2002
@@ -1972,6 +1972,17 @@
          if (trace_on) PDC_debug("%s:XCursesDisplayCursor() - draw line at row %d col %d\n",(XCursesProcess)?"     X":"CURSES",new_row,new_x);
 #endif
          break;
+    case 3:
+         makeXY(new_x,new_row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos);
+         ch = (chtype *)(Xcurscr+XCURSCR_Y_OFF(new_row)+(new_x*sizeof(chtype)));
+         SetCursorColor(ch,&fore,&back);
+         XSetForeground(XCURSESDISPLAY, rect_cursor_gc, colors[back]);
+         XDrawLine(XCURSESDISPLAY,XCURSESWIN,rect_cursor_gc,
+           xpos+1,ypos-XCURSESNORMALFONTINFO->ascent,xpos+1,ypos-XCURSESNORMALFONTINFO->ascent+XCursesFontHeight-1);
+#ifdef PDCDEBUG
+         if (trace_on) PDC_debug("%s:XCursesDisplayCursor() - draw vertical line at row %d col %d\n",(XCursesProcess)?"     X":"CURSES",new_row,new_x);
+#endif
+         break;
     default:
 #if 0
          makeXY(new_x,new_row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos);
@@ -2757,7 +2757,8 @@
 /* Trap all signals when XCurses is the child process...               */
 /*---------------------------------------------------------------------*/
  for (i=0;i<NSIG;i++)
-    (void)signal(i,XCursesSignalHandler);
+    if (signal(i,XCursesSignalHandler) == SIG_IGN)
+      (void)signal(i,SIG_IGN);
 /*---------------------------------------------------------------------*/
 /* Start defining X Toolkit things...                                  */
 /*---------------------------------------------------------------------*/
--- x11.h.orig	Sun Jul 13 08:00:16 1997
+++ x11.h	Fri Feb 29 03:07:11 2008
@@ -145,7 +145,7 @@
   sizeof(Pixel),
   XtOffsetOf(AppData,cursorColor),
   XtRString,
-  (XtPointer)"Red",
+  (XtPointer)"White",
  },
  {
   XtNcolorBlack,
@@ -208,7 +208,7 @@
   sizeof(Pixel),
   XtOffsetOf(AppData,colorCyan),
   XtRString,
-  (XtPointer)"Cyan",
+  (XtPointer)"#00ee99",
  },
  {
   XtNcolorWhite,
--- x11/x11.c.orig	Fri Feb 29 03:14:49 2008
+++ x11/x11.c	Fri Feb 29 03:23:01 2008
@@ -98,6 +98,8 @@
 #include <curses.h>
 #include <x11.h>
 
+int XCursesDefaultColumns = 0, XCursesDefaultLines = 0;
+
 static char *XCursesClassName="XCurses";
 static XtAppContext app_context;
 Widget  topLevel,drawing,d1,scrollBox,scrollVert,scrollHoriz;
@@ -2825,8 +2827,8 @@
 /*---------------------------------------------------------------------*/
 /* Calculate size of display window...                                 */
 /*---------------------------------------------------------------------*/
- XCursesCOLS = XCURSESCOLS;
- XCursesLINES = XCURSESLINES;
+ XCursesCOLS = XCursesDefaultColumns != 0 ? XCursesDefaultColumns : XCURSESCOLS;
+ XCursesLINES = XCursesDefaultLines != 0 ? XCursesDefaultLines : XCURSESLINES;
  XCursesWindowWidth = (XCursesFontWidth * XCursesCOLS) + (2 * XCURSESBORDERWIDTH);
  XCursesWindowHeight = (XCursesFontHeight * XCursesLINES) + (2 * XCURSESBORDERWIDTH);
  minwidth = (XCursesFontWidth*2)+(XCURSESBORDERWIDTH*2);

