[comp.windows.x] Xhp widget fixes for R3 Xt Intrinsics

carlson@BLACK-ICE.TIS.LLNL.GOV (John Carlson) (02/08/89)

Here are the changes I made to the HP widgets distributed with
X.V11R3 to make the HP widgets work with Xt Intrinsics R3:

There is one additional change in VPW.c from the changes on
crg.llnl.gov (anonymous ftp).  Thanks to Johan Widen
<mcvax!sics.se!jw@uunet.UU.NET>.  I also include the changes
to the Makefiles.  You may want to change the Xhp/X11 link
to the the correct place.

John Carlson
carlson@aftac.tis.llnl.gov
carlson@tis.llnl.gov

Our news server is down; this will eventually get posted
to comp.sources.x.

Old is in XhpR2/
New is in Xhp/

diff -c XhpR2/MButton/Makefile Xhp/MButton/Makefile
*** XhpR2/MButton/Makefile	Fri Sep 16 10:07:01 1988
--- Xhp/MButton/Makefile	Tue Jan 31 00:40:58 1989
***************
*** 1,13 ****
  
  OBJECTS = multiTest.o MButton.o
! LIBS =  ../lib/libXw.a ../lib/libXt.a -lX11
  # DEC and Sun
! #CFLAGS = -I../ -I./
! CFLAGS = -I../ -I./ -Wc,-Nd2000 -Wc,-Ns2000
  
  Test: $(OBJECTS)
  	cc $(CFLAGS) -o multiTest $(OBJECTS) $(LIBS)
- 
- 
- 
- 
--- 1,9 ----
  
  OBJECTS = multiTest.o MButton.o
! LIBS =  ../lib/libXw.a -L/usr/lib/X11 -lXmu -lXt -lX11
  # DEC and Sun
! CFLAGS = -I../ -I./
! #CFLAGS = -I../ -I./ -Wc,-Nd2000 -Wc,-Ns2000
  
  Test: $(OBJECTS)
  	cc $(CFLAGS) -o multiTest $(OBJECTS) $(LIBS)
diff -c XhpR2/Xw/BBoard.c Xhp/Xw/BBoard.c
*** XhpR2/Xw/BBoard.c	Fri Sep 16 09:59:35 1988
--- Xhp/Xw/BBoard.c	Tue Jan 31 01:21:09 1989
***************
*** 86,93 ****
      /* change_managed     */    (XtWidgetProc) ChangeManaged,
      /* insert_child	  */	XtInheritInsertChild,	/*  from superclass */
      /* delete_child	  */	XtInheritDeleteChild,	/*  from superclass */
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL,
    },{
  /* constraint_class fields */
     /* resource list        */   NULL,
--- 86,91 ----
diff -c XhpR2/Xw/Cascade.c Xhp/Xw/Cascade.c
*** XhpR2/Xw/Cascade.c	Fri Sep 16 09:59:54 1988
--- Xhp/Xw/Cascade.c	Tue Jan 31 01:21:25 1989
***************
*** 148,155 ****
      /* change_managed     */    ChangeManaged,
      /* insert_child	  */	XtInheritInsertChild,
      /* delete_child	  */	XtInheritDeleteChild,	
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* constraint class fields */
      /* resources          */    NULL,
--- 148,153 ----
diff -c XhpR2/Xw/Form.c Xhp/Xw/Form.c
*** XhpR2/Xw/Form.c	Fri Sep 16 10:00:22 1988
--- Xhp/Xw/Form.c	Tue Jan 31 01:21:46 1989
***************
*** 205,212 ****
        (XtWidgetProc) ChangeManaged,          /*  change_managed            */
        XtInheritInsertChild,		     /* insert_child	           */
        XtInheritDeleteChild,                  /*  delete_child (inherited)  */
-       XtInheritMoveFocusToNext,              /*  move_focus_to_next        */
-       XtInheritMoveFocusToPrev               /*  move_focus_to_prev        */
     },
  
     {                                      /*  constraint class            */
--- 205,210 ----
diff -c XhpR2/Xw/List.c Xhp/Xw/List.c
*** XhpR2/Xw/List.c	Fri Sep 16 10:00:49 1988
--- Xhp/Xw/List.c	Tue Jan 31 01:22:04 1989
***************
*** 282,289 ****
      /* change_managed     */    ChangeManaged,
      /* insert_child	  */	InsertChild,
      /* delete_child	  */	XtInheritDeleteChild,
-     /* move_focus_to_next */    XtInheritMoveFocusToNext,
-     /* move_focus_to_prev */    XtInheritMoveFocusToPrev,
    },{
  /* Constraint class Init */
      /* Constraint res.   */	ListConstraintResources,
--- 282,287 ----
diff -c XhpR2/Xw/ListRC.c Xhp/Xw/ListRC.c
*** XhpR2/Xw/ListRC.c	Tue Feb  7 08:18:02 1989
--- Xhp/Xw/ListRC.c	Tue Jan 31 01:22:21 1989
***************
*** 179,186 ****
      /* change_managed     */    ChangeManaged,
      /* insert_child	  */	InsertChild,	      /* Basically Inherited */
      /* delete_child	  */	XtInheritDeleteChild,	/*  from Composite */
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* Constraint class Init */
      /* Constraint res.   */	ConstraintResources,
--- 179,184 ----
diff -c XhpR2/Xw/Manager.c Xhp/Xw/Manager.c
*** XhpR2/Xw/Manager.c	Fri Sep 16 10:01:09 1988
--- Xhp/Xw/Manager.c	Tue Jan 31 06:03:30 1989
***************
*** 162,169 ****
        NULL,                             /* Change Managed    */
        _XwManagerInsertChild,            /* Insert Child      */
        XtInheritDeleteChild,             /* Delete Child      */
-       NULL,                             /* Focus Next        */
-       NULL,                             /* Focus Previous    */
     },
  
     {  /* constraint class fields */
--- 162,167 ----
***************
*** 261,267 ****
--- 259,267 ----
        (XwBLOCK * sizeof(Widget));
     mw -> composite.num_slots = XwBLOCK;
     mw -> composite.num_children = 0;
+    /* No longer in R3
     mw -> composite.num_mapped_children = 0;
+    */
  
     mw -> composite.insert_position = (XtOrderProc) _XwInsertOrder;
  
diff -c XhpR2/Xw/MenuMgr.c Xhp/Xw/MenuMgr.c
*** XhpR2/Xw/MenuMgr.c	Fri Sep 16 10:01:35 1988
--- Xhp/Xw/MenuMgr.c	Tue Jan 31 01:22:32 1989
***************
*** 113,120 ****
      /* change_managed     */    NULL,
      /* insert_child	  */	XtInheritInsertChild,
      /* delete_child	  */	XtInheritDeleteChild,	
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* constraint class fields */
      /* resources          */    NULL,
--- 113,118 ----
diff -c XhpR2/Xw/MenuPane.c Xhp/Xw/MenuPane.c
*** XhpR2/Xw/MenuPane.c	Fri Sep 16 10:01:39 1988
--- Xhp/Xw/MenuPane.c	Tue Jan 31 01:22:43 1989
***************
*** 125,132 ****
      /* change_managed     */    NULL,
      /* insert_child	  */	InsertChild,
      /* delete_child	  */	XtInheritDeleteChild,	
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* constraint class fields */
      /* resources          */    NULL,
--- 125,130 ----
diff -c XhpR2/Xw/Panel.c Xhp/Xw/Panel.c
*** XhpR2/Xw/Panel.c	Fri Sep 16 10:02:05 1988
--- Xhp/Xw/Panel.c	Tue Jan 31 01:22:59 1989
***************
*** 206,213 ****
      /* change_managed     */    (XtWidgetProc) ChangeManaged,
      /* insert_child	  */	    (XtArgsProc) InsertChild,
      /* delete_child	  */	    (XtArgsProc) DeleteChild,
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL,
    },{
  /* constraint_class fields */
     /* resource list        */   constraintResources,
--- 206,211 ----
diff -c XhpR2/Xw/PopupMgr.c Xhp/Xw/PopupMgr.c
*** XhpR2/Xw/PopupMgr.c	Thu Oct  6 08:38:24 1988
--- Xhp/Xw/PopupMgr.c	Tue Jan 31 01:23:32 1989
***************
*** 214,221 ****
      /* change_managed     */    NULL,
      /* insert_child	  */	XtInheritInsertChild,
      /* delete_child	  */	XtInheritDeleteChild,	
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* constraint class fields */
      /* resources          */    NULL,
--- 214,219 ----
diff -c XhpR2/Xw/Primitive.c Xhp/Xw/Primitive.c
*** XhpR2/Xw/Primitive.c	Fri Sep 16 10:02:37 1988
--- Xhp/Xw/Primitive.c	Tue Jan 31 06:20:24 1989
***************
*** 806,811 ****
--- 806,812 ----
                                        (tw, ul, lr, dir);
     }
  
+    /*
     else if (dir == XwTRAVERSE_NEXT &&
             ((CompositeWidgetClass)(tw -> core.widget_class)) ->
                                     composite_class.move_focus_to_next != NULL)
***************
*** 821,826 ****
--- 822,828 ----
        (*(((CompositeWidgetClass) tw -> core.widget_class) ->
                                   composite_class.move_focus_to_prev))(w);
     }
+    */
  }
  
  
diff -c XhpR2/Xw/RCManager.c Xhp/Xw/RCManager.c
*** XhpR2/Xw/RCManager.c	Fri Sep 16 10:02:43 1988
--- Xhp/Xw/RCManager.c	Tue Jan 31 01:25:04 1989
***************
*** 150,157 ****
      /* change_managed     */    (XtWidgetProc) ChangeManaged,
      /* insert_child	  */	(XtWidgetProc) InsertChild,
      /* delete_child	  */	XtInheritDeleteChild,
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* constraint_class fields */
     /* resource list        */   NULL,
--- 150,155 ----
diff -c XhpR2/Xw/SWindow.c Xhp/Xw/SWindow.c
*** XhpR2/Xw/SWindow.c	Fri Sep 16 10:03:24 1988
--- Xhp/Xw/SWindow.c	Tue Jan 31 01:25:20 1989
***************
*** 327,334 ****
      /* change_managed     */    ChangeManaged,
      /* insert_child	  */	InsertChild,	/* Basically Inherited */
      /* delete_child	  */	NULL,	/* Inherit from superclass */
-     /* move_focus_to_next */    NULL,
-     /* move_focus_to_prev */    NULL
    },{
  /* Constraint class Init */
      NULL,
--- 327,332 ----
diff -c XhpR2/Xw/ScrollBar.c Xhp/Xw/ScrollBar.c
*** XhpR2/Xw/ScrollBar.c	Fri Sep 16 10:03:45 1988
--- Xhp/Xw/ScrollBar.c	Tue Jan 31 01:25:35 1989
***************
*** 215,222 ****
        NULL,                                   /*  change_managed      */    
        XtInheritInsertChild,                   /*  insert_child        */
        XtInheritDeleteChild,                   /*  delete_child        */
-       XtInheritMoveFocusToNext,               /*  move_focus_to_next  */
-       XtInheritMoveFocusToPrev                /*  move_focus_to_prev  */
     },
  
     {                 /*  constraint class  */
--- 215,220 ----
diff -c XhpR2/Xw/TitleBar.c Xhp/Xw/TitleBar.c
*** XhpR2/Xw/TitleBar.c	Fri Sep 16 10:04:36 1988
--- Xhp/Xw/TitleBar.c	Tue Jan 31 01:26:01 1989
***************
*** 454,461 ****
        (XtWidgetProc) ChangeManaged,        /*  change_managed      */
        (XtArgsProc) InsertChild,            /*  insert_child        */
        (XtArgsProc) DeleteChild,            /*  delete_child        */
-       NULL,                                /*  move_focus_to_next  */
-       NULL                                 /*  move_focus_to_prev  */
     },
  
     {  /* constraint class part */
--- 454,459 ----
diff -c XhpR2/Xw/VPW.c Xhp/Xw/VPW.c
*** XhpR2/Xw/VPW.c	Fri Sep 16 10:05:09 1988
--- Xhp/Xw/VPW.c	Tue Feb  7 08:02:48 1989
***************
*** 174,181 ****
      /* change_managed     */   ChangeManaged,
      /* insert_child       */   InsertChild,
      /* delete_child       */   XtInheritDeleteChild,
-     /* move_focus_to_next */   NULL,
-     /* move_focus_to_prev */   NULL
     }, {
  /* constraint class fields */
      /* subresourses       */   subresources,
--- 174,179 ----
***************
*** 705,713 ****
  		vpw->v_paned.top_pane = pane;
  	    }
  	    (void) XGrabPointer(XtDisplay(vpw), XtWindow(w), False,
! 				_XtBuildEventMask(w),
  				GrabModeAsync, GrabModeAsync, None,
! 				XtGetCursor(XtDisplay(vpw),
  				CursorNums[call_data->event->xbutton.button]),
  				time);
  	    vpw->v_paned.starty = y;
--- 703,711 ----
  		vpw->v_paned.top_pane = pane;
  	    }
  	    (void) XGrabPointer(XtDisplay(vpw), XtWindow(w), False,
! 				XtBuildEventMask(w),
  				GrabModeAsync, GrabModeAsync, None,
! 				XCreateFontCursor(XtDisplay(vpw),
  				CursorNums[call_data->event->xbutton.button]),
  				time);
  	    vpw->v_paned.starty = y;
diff -c XhpR2/Xw/Xw.h Xhp/Xw/Xw.h
*** XhpR2/Xw/Xw.h	Fri Sep 16 10:05:49 1988
--- Xhp/Xw/Xw.h	Tue Jan 31 06:17:40 1989
***************
*** 512,518 ****
  #define XtCEraseOn		"EraseOn"
  
  
! /*  MenuBtn esource manager definitions  */
  
  #define XtNlabelType	      "labelType"
  #define XtCLabelType	      "LabelType"
--- 512,518 ----
  #define XtCEraseOn		"EraseOn"
  
  
! /*  MenuBtn resource manager definitions  */
  
  #define XtNlabelType	      "labelType"
  #define XtCLabelType	      "LabelType"
***************
*** 535,540 ****
--- 535,541 ----
  #define XtNcascadeUnselect    "cascadeUnselect"
  #define XtNmenuMgrId	      "menuMgrId"
  #define XtCMenuMgrId	      "MenuMgrId"
+ #define XtRWidget	      "Widget"
  
  
  /*  ScrollBar resource definitions  */
***************
*** 572,578 ****
--- 573,581 ----
  #define XtNpadding              "padding"
  #define XtCPadding              "Padding"
  #define XtNmin			"min"
+ #define XtCMin			"Min"
  #define XtNmax			"max"
+ #define XtCMax			"Max"
  #define XtNskipAdjust		"skipAdjust"
  #define XtNframed               "framed"
  #define XtNborderFrame          "borderFrame"
diff -c XhpR2/test/Makefile Xhp/test/Makefile
*** XhpR2/test/Makefile	Mon Nov 14 23:51:58 1988
--- Xhp/test/Makefile	Tue Feb  7 08:03:33 1989
***************
*** 1,7 ****
  #   Makefile for HP X Widgets test programs
  
  OBJECTS = 
! LIBS =  -L../../../../lib ../lib/libXw.a -lXt -lX11
  #CFLAGS = -O -I./ -I../ -Wc,-Nd4000 -Wc,-Ns4000 +Nt100000
  # DEC and Sun
  CFLAGS = -O -I./ -I../ -I../../../../
--- 1,7 ----
  #   Makefile for HP X Widgets test programs
  
  OBJECTS = 
! LIBS =  -L../../../../lib ../lib/libXw.a -lXmu -lXt -lX11
  #CFLAGS = -O -I./ -I../ -Wc,-Nd4000 -Wc,-Ns4000 +Nt100000
  # DEC and Sun
  CFLAGS = -O -I./ -I../ -I../../../../
***************
*** 13,19 ****
       tog11 vpw13 workspace1 xpanel2
  
  clean:
! 	rm -f bull2 gen2 imagedit2 list9 menuTest1 menuTest5 \
                swin1 tog11 vpw13 workspace1 xpanel2
  
  bull2: bull2.h
--- 13,19 ----
       tog11 vpw13 workspace1 xpanel2
  
  clean:
! 	rm -f bull2 gen2 imageedit2 list9 menuTest1 menuTest5 \
                swin1 tog11 vpw13 workspace1 xpanel2
  
  bull2: bull2.h

carlson@aftac.tis.llnl.gov (John Carlson) (02/10/89)

>Here are the changes I made to the HP widgets distributed with
>X.V11R3 to make the HP widgets work with Xt Intrinsics R3:

Here are some more patches to make the HP widgets distributed with R3
work with R3 Xt Intrinsics.

The first patch to Xw/SourceStr.c was made because I was getting name
conflicts between Xw and Xaw (Xaw may need to be patched too!).

The second patch is for Xw/WClassing.c.  I neglected to change this
previously because I was only trying to get the widgets to work with
XtCreateManagedWidget.

Good Luck!

John Carlson
carlson@tis.llnl.gov

*** XhpR2/Xw/SourceStr.c	Fri Sep 16 10:04:01 1988
--- Xhp/Xw/SourceStr.c	Wed Feb  8 13:36:43 1989
***************
*** 75,81 ****
  };
  
  /*--------------------------------------------------------------------------+*/
! unsigned char Look(data, position, direction)
  /*--------------------------------------------------------------------------+*/
    StringSourcePtr data;
    XwTextPosition  position;
--- 75,81 ----
  };
  
  /*--------------------------------------------------------------------------+*/
! static unsigned char Look(data, position, direction)
  /*--------------------------------------------------------------------------+*/
    StringSourcePtr data;
    XwTextPosition  position;
*** XhpR2/Xw/WClassing.c	Fri Sep 16 10:05:30 1988
--- Xhp/Xw/WClassing.c	Fri Feb 10 03:22:01 1989
***************
*** 38,44 ****
  
  #undef XtCreateWidget
  
- extern XrmDatabase	XtDefaultDB;
  extern XwWCViewLoadProc	XwWCViewLoadProcs[];
  extern int	XwNumWCViewLoadProcs;
  extern XwTaskTableEntry	XwTasks[];
--- 38,43 ----
***************
*** 163,169 ****
  
  	/*
  	 * Set up the resource lists.  First, traverse the widget 
! 	 * heirarchy and get names and classes.
  	 */
  	for(length = 0; w != NULL; w = w->core.parent, length++)
  	{
--- 162,168 ----
  
  	/*
  	 * Set up the resource lists.  First, traverse the widget 
! 	 * hierarchy and get names and classes.
  	 */
  	for(length = 0; w != NULL; w = w->core.parent, length++)
  	{
***************
*** 173,179 ****
  	}
  
  	/*
! 	 * Because the heirarchy was traversed bottom-up, the
  	 * lists are backwards from what we need.  Invert them.
  	 */
  	for (i = 0; i < length/2; i++)
--- 172,178 ----
  	}
  
  	/*
! 	 * Because the hierarchy was traversed bottom-up, the
  	 * lists are backwards from what we need.  Invert them.
  	 */
  	for (i = 0; i < length/2; i++)
***************
*** 205,211 ****
  	/*
  	 * Get the resource.
  	 */
! 	if (XrmQGetResource(XtDefaultDB,names,classes,&typeQ,&res_ret))
  	{
  		/*
  		 * See if we can get a match with an entry in the
--- 204,211 ----
  	/*
  	 * Get the resource.
  	 */
! 	if (XrmQGetResource(XtDatabase(XtDisplay(parent)),
! 		names,classes,&typeQ,&res_ret))
  	{
  		/*
  		 * See if we can get a match with an entry in the

net@TUB.BITNET (Oliver Laumann) (03/20/89)

In article <8902081425.AA06738@black-ice.tis.llnl.gov> you write:
> Here are the changes I made to the HP widgets distributed with
> X.V11R3 to make the HP widgets work with Xt Intrinsics R3:

But the HP widgets don't work with the R3 intrinsics; try to compile
and invoke the test programs for the HP widgets.  Some get a
segmentation fault; some just display garbage.

One problem is that the HP widgets declare resources with representation
types that conflict with the representation types of resources in
the widget class's superclass (e.g. width, hight, and border_width are
declared as "int", but are actually of type "Dimension", i.e. "unsigned
 short").

Call the "vpw13" test program and watch all the "Representation type FOO must
match superclass's to override BAR" messages.

Simply replacing "int" by "dimension" doesn't work.

Does someone have the necessary fixes?

Regards,
--
Oliver Laumann              net@TUB.BITNET              net@tub.UUCP