From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
Subject: Re: mixing motif 1.2 and other widgets
Date: Tue, 26 Jan 1993 13:16:41 GMT
Distribution: comp
Reply-To: jay@vnet.ibm.com
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM Rochester, MN

In article <JOERN.93Jan26114337@khym.imf.unit.no>, joern@imf.unit.no (Joern Amundsen) writes: 
|> It seems to that mixing for instance custom widgets not subclassed
|> from any Xm* widget with motif 1.2 widget isn't a good idea. And
|> particularly, it seems that mixed widget applications working fine
|> with 1.1.x and X11R4 core dumps with 1.2/X11R5 :-(
|> 
|> Has anyone else experienced this kind of trouble ??

I believe this is a known problem; here's what one of the OSF guys posted
a while back:

-------- Begin Excerpt ---------
From: daniel@moonshine.osf.org (Daniel Dardailler)
Subject: Re: Motif 1.2 widgets with non-Motif parents
Organization: Open Software Foundation, Motif Team
Distribution: comp
Date: Mon, 4 Jan 1993 20:41:31 GMT

1.2 has introduced a bug that precludes mixing of Motif and non-Motif
widgets.
 
The problem is a blind access of the core class extension
record without proper checking.

The bug has been fixed in 1.2.2.

In the mean time, if you have the problem,
you need to do one of the following:
	- subclass out of a Motif widget
	- add a Motif core class extension to your widget

I already post something describing how to implement option 2 in the past.
Here it is again:

In your widget JoeWidget.c, you need to create a Motif extension record.
(the typedef you already get with XmP.h I think)

static XmBaseClassExtRec baseClassExtRec = {
    NULL,
    NULLQUARK,
    XmBaseClassExtVersion,
    sizeof(XmBaseClassExtRec),
    NULL,				/* InitializePrehook	*/
    NULL,				/* SetValuesPrehook	*/
    NULL,				/* InitializePosthook	*/
    NULL,				/* SetValuesPosthook	*/
    NULL,				/* secondaryObjectClass	*/
    NULL,				/* secondaryCreate	*/
    NULL,               		/* getSecRes data	*/
    { 0 },      			/* fastSubclass flags	*/
    NULL,				/* getValuesPrehook	*/
    NULL,				/* getValuesPosthook	*/
    NULL,                               /* classPartInitPrehook */
    NULL,                               /* classPartInitPosthook*/
    NULL,                               /* ext_resources        */
    NULL,                               /* compiled_ext_resources*/
    0,                                  /* num_ext_resources    */
    FALSE,                              /* use_sub_resources    */
    NULL,                               /* widgetNavigable      */
    NULL                                /* focusChange          */
};

/******* then you stuck it in your class record:  *******/

JoeClassRec joeClassRec =
{
   {			/* core_class fields      */
      (WidgetClass) &superJoeClassRec,		/* superclass         */
      "Joe",				        /* class_name         */
      sizeof(JoeRec),			        /* widget_size        */
      ClassInitialize,	        		/* class_initialize   */
      ClassPartInitialize,			/* class_part_init    */
      ..........
      QueryGeometry,                    	/* query_geometry     */
      NULL,             	                /* display_accelerator*/
      (XtPointer)&baseClassExtRec,              /* extension          */
   },


/******* and you also initialize the record_type   
         (can't be done statically becasue it's a variable *******/

static void ClassInitialize( void )
{   
  baseClassExtRec.record_type = XmQmotif ;
}


I haven't actually test this code, tell me if there is a problem.

--------   End Exceprt ---------

-- 
: jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
: shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1992.  All rights reserved.
Xref: sparky comp.windows.x.motif:8889 comp.windows.x.intrinsics:806