home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xt / Create.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-21  |  18.5 KB  |  565 lines

  1. /* $XConsortium: Create.c,v 1.90 93/04/26 19:09:28 converse Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #include "IntrinsicI.h"
  28. #include "VarargsI.h"
  29. #include "StringDefs.h"
  30. #include "Shell.h"
  31. #include "ShellP.h"
  32. #include <stdio.h>
  33.  
  34. static String XtNxtCreateWidget = "xtCreateWidget";
  35. static String XtNxtCreatePopupShell = "xtCreatePopupShell";
  36.  
  37. static void CallClassPartInit(ancestor, wc)
  38.      WidgetClass ancestor, wc;
  39. {
  40.     if (ancestor->core_class.superclass != NULL) {
  41.     CallClassPartInit(ancestor->core_class.superclass, wc);
  42.     }
  43.     if (ancestor->core_class.class_part_initialize != NULL) {
  44.     (*(ancestor->core_class.class_part_initialize)) (wc);
  45.     }
  46. }
  47.  
  48. void XtInitializeWidgetClass(wc)
  49.     WidgetClass wc;
  50. {
  51.     XtEnum inited;
  52.     if (wc->core_class.class_inited) return;
  53.     inited = 0x01;
  54.     {
  55.     WidgetClass pc;
  56. #define LeaveIfClass(c, d) if (pc == c) { inited = d; break; }
  57.     for (pc = wc; pc; pc = pc->core_class.superclass) {
  58.         LeaveIfClass(rectObjClass, 0x01 |
  59.              RectObjClassFlag);
  60.         LeaveIfClass(coreWidgetClass, 0x01 |
  61.              RectObjClassFlag |
  62.              WidgetClassFlag);
  63.         LeaveIfClass(compositeWidgetClass, 0x01 |
  64.              RectObjClassFlag |
  65.              WidgetClassFlag |
  66.              CompositeClassFlag);
  67.         LeaveIfClass(constraintWidgetClass, 0x01 |
  68.              RectObjClassFlag |
  69.              WidgetClassFlag |
  70.              CompositeClassFlag |
  71.              ConstraintClassFlag);
  72.         LeaveIfClass(shellWidgetClass, 0x01 |
  73.              RectObjClassFlag |
  74.              WidgetClassFlag |
  75.              CompositeClassFlag |
  76.              ShellClassFlag);
  77.         LeaveIfClass(wmShellWidgetClass, 0x01 |
  78.              RectObjClassFlag |
  79.              WidgetClassFlag |
  80.              CompositeClassFlag |
  81.              ShellClassFlag |
  82.              WMShellClassFlag);
  83.         LeaveIfClass(topLevelShellWidgetClass, 0x01 |
  84.              RectObjClassFlag |
  85.              WidgetClassFlag |
  86.              CompositeClassFlag |
  87.              ShellClassFlag |
  88.              WMShellClassFlag |
  89.              TopLevelClassFlag);
  90.     }
  91. #undef LeaveIfClass
  92.     }
  93.     if (wc->core_class.version != XtVersion &&
  94.     wc->core_class.version != XtVersionDontCheck &&
  95.     wc->core_class.version != (11 * 1000 + 4)) { /* MIT R4 is OK */
  96.     String param[3];
  97.         param[0] = wc->core_class.class_name;
  98.     if (wc->core_class.version == (11 * 1000 + 3)) { /* MIT X11R3 */
  99.         if (inited & ShellClassFlag) {
  100.         Cardinal num_params=1;
  101.         XtWarningMsg("r3versionMismatch","widget",XtCXtToolkitError,
  102.                  "Shell Widget class %s binary compiled for R3",
  103.                  param,&num_params);
  104.         }
  105.     }
  106.     else {
  107.         Cardinal num_params=3;
  108.         param[1] = (String)wc->core_class.version;
  109.         param[2] = (String)XtVersion;
  110.         XtWarningMsg("versionMismatch","widget",XtCXtToolkitError,
  111.              "Widget class %s version mismatch (recompilation needed):\n  widget %d vs. intrinsics %d.",
  112.              param,&num_params);
  113.         if (wc->core_class.version == (2 * 1000 + 2)) /* MIT X11R2 */ {
  114.         Cardinal num_params=1;
  115.         XtErrorMsg("r2versionMismatch","widget",XtCXtToolkitError,
  116.                "Widget class %s must be re-compiled.",
  117.                param, &num_params);
  118.         }
  119.     }
  120.     }
  121.  
  122.     if ((wc->core_class.superclass != NULL) 
  123.         && (!(wc->core_class.superclass->core_class.class_inited)))
  124.      XtInitializeWidgetClass(wc->core_class.superclass);
  125.  
  126.     if (wc->core_class.class_initialize != NULL)
  127.     (*(wc->core_class.class_initialize))();
  128.     CallClassPartInit(wc, wc);
  129.     wc->core_class.class_inited = inited;
  130. }
  131.  
  132. static void CallInitialize (class, req_widget, new_widget, args, num_args)
  133.     WidgetClass class;
  134.     Widget      req_widget;
  135.     Widget      new_widget;
  136.     ArgList     args;
  137.     Cardinal    num_args;
  138. {
  139.     if (class->core_class.superclass)
  140.         CallInitialize (class->core_class.superclass,
  141.         req_widget, new_widget, args, num_args);
  142.     if (class->core_class.initialize != NULL)
  143.     (*class->core_class.initialize)
  144.         (req_widget, new_widget, args, &num_args);
  145.     if (class->core_class.initialize_hook != NULL)
  146.     (*class->core_class.initialize_hook) (new_widget, args, &num_args);
  147. }
  148.  
  149. static void CallConstraintInitialize (class, req_widget, new_widget, args, num_args)
  150.     ConstraintWidgetClass class;
  151.     Widget    req_widget, new_widget;
  152.     ArgList    args;
  153.     Cardinal    num_args;
  154. {
  155.     if (class->core_class.superclass != constraintWidgetClass)
  156.     CallConstraintInitialize(
  157.         (ConstraintWidgetClass) class->core_class.superclass,
  158.         req_widget, new_widget, args, num_args);
  159.     if (class->constraint_class.initialize != NULL)
  160.         (*class->constraint_class.initialize)
  161.         (req_widget, new_widget, args, &num_args);
  162. }
  163.  
  164. static Widget _XtCreate(
  165.     name, class, widget_class, parent, default_screen,
  166.     args, num_args, typed_args, num_typed_args, parent_constraint_class)
  167.     char        *name, *class;
  168.     WidgetClass widget_class;
  169.     Widget      parent;
  170.     Screen*     default_screen; /* undefined when creating a nonwidget */
  171.     ArgList     args;        /* must be NULL if typed_args is non-NULL */
  172.     Cardinal    num_args;
  173.     XtTypedArgList typed_args;    /* must be NULL if args is non-NULL */
  174.     Cardinal    num_typed_args;
  175.     ConstraintWidgetClass parent_constraint_class;
  176.         /* NULL if not a subclass of Constraint or if child is popup shell */
  177. {
  178.     register CallbackTable  offsets;
  179.     InternalCallbackList    *cl;
  180.     /* need to use strictest alignment rules possible in next two decls. */
  181.     double                  widget_cache[100];
  182.     double                  constraint_cache[20];
  183.     Widget                  req_widget;
  184.     XtPointer               req_constraints;
  185.     Cardinal                wsize, csize;
  186.     register Widget        widget;
  187.     XtCacheRef            *cache_refs;
  188.     register int        i;
  189.  
  190.     if (! (widget_class->core_class.class_inited))
  191.     XtInitializeWidgetClass(widget_class);
  192.     wsize = widget_class->core_class.widget_size;
  193.     csize = 0;
  194.     if (parent_constraint_class) {
  195.     csize = parent_constraint_class->constraint_class.constraint_size;
  196.     if (sizeof(struct {char a; double b;}) !=
  197.         (sizeof(struct {char a; unsigned long b;}) -
  198.          sizeof(unsigned long) + sizeof(double))) {
  199.         if (csize && !(csize & (sizeof(double) - 1)))
  200.         wsize = (wsize + sizeof(double) - 1) & ~(sizeof(double)-1);
  201.     }
  202.     }
  203.     widget = (Widget) XtMalloc((unsigned)(wsize + csize));
  204.     widget->core.self = widget;
  205.     widget->core.parent = parent;
  206.     widget->core.widget_class = widget_class;
  207.     widget->core.xrm_name = StringToName((name != NULL) ? name : "");
  208.     widget->core.being_destroyed =
  209.     (parent != NULL ? parent->core.being_destroyed : FALSE);
  210.     if (csize)
  211.     widget->core.constraints = (XtPointer)((char *)widget + wsize);
  212.     else
  213.     widget->core.constraints = NULL;
  214.     if (XtIsWidget(widget)) {
  215.     widget->core.name = XrmNameToString(widget->core.xrm_name);
  216.         widget->core.screen = default_screen;
  217.         widget->core.tm.translations = NULL;
  218.     };
  219.     if (XtIsApplicationShell(widget)) {
  220.     ApplicationShellWidget a = (ApplicationShellWidget) widget;
  221.     if (class != NULL)
  222.         a->application.xrm_class = StringToClass(class);
  223.     else
  224.         a->application.xrm_class = widget_class->core_class.xrm_class;
  225.     a->application.class = XrmQuarkToString(a->application.xrm_class);
  226.     }
  227.  
  228.     /* fetch resources */
  229.     cache_refs = _XtGetResources(widget, args, num_args, 
  230.                       typed_args, &num_typed_args);
  231.  
  232.     /* Convert typed arg list to arg list */
  233.     if (typed_args != NULL && num_typed_args > 0) {
  234.     args = (ArgList)ALLOCATE_LOCAL(sizeof(Arg) * num_typed_args);
  235.     if (args == NULL) _XtAllocError(NULL);
  236.     for (i = 0; i < num_typed_args; i++) {
  237.         args[i].name = typed_args[i].name;
  238.         args[i].value = typed_args[i].value;
  239.     }
  240.     num_args = num_typed_args;
  241.     }
  242.     
  243.     /* Compile any callback lists into internal form */
  244.     offsets = (CallbackTable)
  245.     widget->core.widget_class->core_class.callback_private;
  246.  
  247.     for (i = (int) *(offsets++); --i >= 0; offsets++) {
  248.     cl = (InternalCallbackList *)
  249.         ((char *) widget - (*offsets)->xrm_offset - 1);
  250.     if (*cl)
  251.         *cl = _XtCompileCallbackList((XtCallbackList) *cl);
  252.     }
  253.  
  254.     if (cache_refs != NULL) {
  255.     extern void _XtCallbackReleaseCacheRefs();
  256.     XtAddCallback( widget, XtNdestroyCallback,
  257.                XtCallbackReleaseCacheRefList, (XtPointer)cache_refs );
  258.     }
  259.  
  260.     wsize = widget_class->core_class.widget_size;
  261.     req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
  262.     bcopy ((char *) widget, (char *) req_widget, (int) wsize);
  263.     CallInitialize (XtClass(widget), req_widget, widget, args, num_args);
  264.     if (parent_constraint_class != NULL) {
  265.     if (csize) {
  266.         req_constraints = XtStackAlloc(csize, constraint_cache);
  267.         bcopy(widget->core.constraints, (char*)req_constraints,(int)csize);
  268.         req_widget->core.constraints = req_constraints;
  269.     } else req_widget->core.constraints = NULL;
  270.     CallConstraintInitialize(parent_constraint_class, req_widget, widget,
  271.                  args, num_args);
  272.     if (csize) XtStackFree(req_constraints, constraint_cache);
  273.     }
  274.     XtStackFree((XtPointer)req_widget, widget_cache);
  275.  
  276.     if (typed_args != NULL) {
  277.     while (num_typed_args-- > 0) {
  278.     
  279.         /* In GetResources we may have dynamically alloc'd store to hold */
  280.         /* a copy of a resource which was larger then sizeof(XtArgVal). */
  281.         /* We must free this store now in order to prevent a memory leak */
  282.         /* A typed arg that has a converted value in dynamic store has a */
  283.         /* negated size field. */
  284.  
  285.         if (typed_args->type != NULL && typed_args->size < 0) {
  286.         XtFree((char*)typed_args->value);
  287.         typed_args->size = -(typed_args->size);
  288.         }
  289.         typed_args++;
  290.     }
  291.     DEALLOCATE_LOCAL((char*)args);
  292.     }
  293.     return (widget);
  294. }
  295.  
  296.  
  297. Widget _XtCreateWidget(name, widget_class, parent, args, num_args,
  298.                typed_args, num_typed_args)
  299.     String      name;
  300.     WidgetClass widget_class;
  301.     Widget      parent;
  302.     ArgList     args;
  303.     Cardinal    num_args;
  304.     XtTypedArgList typed_args;
  305.     Cardinal    num_typed_args;
  306. {
  307.     register Widget        widget;
  308.     ConstraintWidgetClass   cwc;
  309.     XtWidgetProc        insert_child;
  310.     Screen*                 default_screen;
  311.  
  312.     if (parent == NULL) {
  313.     XtErrorMsg("invalidParent",XtNxtCreateWidget,XtCXtToolkitError,
  314.                 "XtCreateWidget requires non-NULL parent",
  315.                   (String *)NULL, (Cardinal *)NULL);
  316.     } else if (widget_class == NULL) {
  317.     XtAppErrorMsg(XtWidgetToApplicationContext(parent),
  318.         "invalidClass",XtNxtCreateWidget,XtCXtToolkitError,
  319.                 "XtCreateWidget requires non-NULL widget class",
  320.                   (String *)NULL, (Cardinal *)NULL);
  321.     }
  322.     if (!widget_class->core_class.class_inited)
  323.     XtInitializeWidgetClass(widget_class);
  324.     if ((widget_class->core_class.class_inited & WidgetClassFlag) == 0) {
  325.     /* not a widget */
  326.     default_screen = NULL;
  327.     if (XtIsComposite(parent)) {
  328.         CompositeClassExtension ext;
  329.         for (ext = (CompositeClassExtension)
  330.                ((CompositeWidgetClass)XtClass(parent))
  331.              ->composite_class.extension;
  332.          ext != NULL && ext->record_type != NULLQUARK;
  333.          ext = (CompositeClassExtension)ext->next_extension);
  334.         if (ext != NULL &&
  335.         (ext->version != XtCompositeExtensionVersion
  336.          || ext->record_size != sizeof(CompositeClassExtensionRec))) {
  337.         String params[1];
  338.         Cardinal num_params = 1;
  339.         params[0] = XtClass(parent)->core_class.class_name;
  340.         XtAppWarningMsg(XtWidgetToApplicationContext(parent),
  341.           "invalidExtension", XtNxtCreateWidget, XtCXtToolkitError,
  342.           "widget class %s has invalid CompositeClassExtension record",
  343.           params, &num_params);
  344.         ext = NULL;
  345.         }
  346.         if (ext == NULL || !ext->accepts_objects) {
  347.         String params[2];
  348.         Cardinal num_params = 2;
  349.         params[0] = name;
  350.         params[1] = XtName(parent);
  351.         XtAppErrorMsg(XtWidgetToApplicationContext(parent),
  352.                   "nonWidget",XtNxtCreateWidget,XtCXtToolkitError,
  353.                   "attempt to add non-widget child \"%s\" to parent \"%s\" which supports only widgets",
  354.                   params, &num_params);
  355.         }
  356.     }
  357.     } else {
  358.     default_screen = parent->core.screen;
  359.     }
  360.  
  361.     if (XtIsConstraint(parent)) {
  362.     cwc = (ConstraintWidgetClass) parent->core.widget_class;
  363.     } else {
  364.     cwc = NULL;
  365.     }
  366.     widget = _XtCreate(name, (char *)NULL, widget_class, parent,
  367.                default_screen, args, num_args,
  368.                typed_args, num_typed_args, cwc);
  369.     if (XtIsComposite(parent)) {
  370.         insert_child = ((CompositeWidgetClass) parent->core.widget_class)->
  371.         composite_class.insert_child;
  372.     } else {
  373.     return(widget);
  374.     }
  375.     if (insert_child == NULL) {
  376.     XtAppErrorMsg(XtWidgetToApplicationContext(parent),
  377.         "nullProc","insertChild",XtCXtToolkitError,
  378.                 "NULL insert_child procedure",
  379.                   (String *)NULL, (Cardinal *)NULL);
  380.     } else {
  381.     (*insert_child) (widget);
  382.     }
  383.     return (widget);
  384. }
  385.  
  386. #if NeedFunctionPrototypes
  387. Widget XtCreateWidget(
  388.     _Xconst char* name,
  389.     WidgetClass widget_class,
  390.     Widget       parent,
  391.     ArgList     args,
  392.     Cardinal    num_args
  393.     )
  394. #else
  395. Widget XtCreateWidget(name, widget_class, parent, args, num_args)
  396.     String    name;
  397.     WidgetClass widget_class;
  398.     Widget       parent;
  399.     ArgList     args;
  400.     Cardinal    num_args;
  401. #endif
  402. {
  403.     return(_XtCreateWidget(name, widget_class, parent, args, num_args,
  404.                (XtTypedArgList)NULL, (Cardinal)0));
  405. }
  406.  
  407.  
  408. #if NeedFunctionPrototypes
  409. Widget XtCreateManagedWidget(
  410.     _Xconst char* name,
  411.     WidgetClass widget_class,
  412.     Widget      parent,
  413.     ArgList     args,
  414.     Cardinal    num_args
  415.     )
  416. #else
  417. Widget XtCreateManagedWidget(name, widget_class, parent, args, num_args)
  418.     String      name;
  419.     WidgetClass widget_class;
  420.     Widget      parent;
  421.     ArgList     args;
  422.     Cardinal    num_args;
  423. #endif
  424. {
  425.     register Widget        widget;
  426.  
  427.     XtCheckSubclass(parent, compositeWidgetClass, "in XtCreateManagedWidget");
  428.     widget = XtCreateWidget(name, widget_class, parent, args, num_args);
  429.     XtManageChild(widget);
  430.     return widget;
  431. }
  432.  
  433. Widget _XtCreatePopupShell(name, widget_class, parent, args, num_args,
  434.                typed_args, num_typed_args)
  435.     String      name;
  436.     WidgetClass widget_class;
  437.     Widget      parent;
  438.     ArgList     args;
  439.     Cardinal    num_args;
  440.     XtTypedArgList      typed_args;
  441.     Cardinal            num_typed_args;
  442. {
  443.     register Widget widget;
  444.     Screen* default_screen;
  445.  
  446.     if (parent == NULL) {
  447.     XtErrorMsg("invalidParent",XtNxtCreatePopupShell,XtCXtToolkitError,
  448.                 "XtCreatePopupShell requires non-NULL parent",
  449.                   (String *)NULL, (Cardinal *)NULL);
  450.     } else if (widget_class == NULL) {
  451.     XtAppErrorMsg(XtWidgetToApplicationContext(parent),
  452.         "invalidClass",XtNxtCreatePopupShell,XtCXtToolkitError,
  453.                 "XtCreatePopupShell requires non-NULL widget class",
  454.                   (String *)NULL, (Cardinal *)NULL);
  455.     }
  456.     XtCheckSubclass(parent, coreWidgetClass, "in XtCreatePopupShell");
  457.     default_screen = parent->core.screen;
  458.     widget = _XtCreate(
  459.                name, (char *)NULL, widget_class, parent,
  460.                default_screen, args, num_args, typed_args,
  461.                num_typed_args, (ConstraintWidgetClass)NULL);
  462.  
  463.     parent->core.popup_list =
  464.     (WidgetList) XtRealloc((char*) parent->core.popup_list,
  465.                (unsigned) (parent->core.num_popups+1) * sizeof(Widget));
  466.     parent->core.popup_list[parent->core.num_popups++] = widget;
  467.     return(widget);
  468. }
  469.  
  470.  
  471. #if NeedFunctionPrototypes
  472. Widget XtCreatePopupShell(
  473.     _Xconst char* name,
  474.     WidgetClass widget_class,
  475.     Widget      parent,
  476.     ArgList     args,
  477.     Cardinal    num_args
  478.     )
  479. #else
  480. Widget XtCreatePopupShell(name, widget_class, parent, args, num_args)
  481.     String      name;
  482.     WidgetClass widget_class;
  483.     Widget      parent;
  484.     ArgList     args;
  485.     Cardinal    num_args;
  486. #endif
  487. {
  488.     return _XtCreatePopupShell(name, widget_class, parent, args, num_args,
  489.                    (XtTypedArgList)NULL, (Cardinal)0);
  490. }
  491.  
  492.  
  493. Widget _XtAppCreateShell(name, class, widget_class, display, args, num_args,
  494.              typed_args, num_typed_args)
  495.     String      name, class;
  496.     WidgetClass widget_class;
  497.     Display*    display;
  498.     ArgList     args;
  499.     Cardinal    num_args;
  500.     XtTypedArgList typed_args;
  501.     Cardinal    num_typed_args;
  502. {
  503.     if (widget_class == NULL) {
  504.     XtAppErrorMsg(XtDisplayToApplicationContext(display),
  505.            "invalidClass","xtAppCreateShell",XtCXtToolkitError,
  506.                "XtAppCreateShell requires non-NULL widget class",
  507.                  (String *)NULL, (Cardinal *)NULL);
  508.     }
  509.  
  510.     if (name == NULL)
  511.     name = XrmNameToString(_XtGetPerDisplay(display)->name);
  512.  
  513.     return _XtCreate(name, class, widget_class, (Widget)NULL,
  514.         (Screen*)DefaultScreenOfDisplay(display),
  515.         args, num_args, typed_args, num_typed_args,
  516.         (ConstraintWidgetClass) NULL);
  517. }
  518.  
  519. #if NeedFunctionPrototypes
  520. Widget XtAppCreateShell(
  521.     _Xconst char*       name,
  522.     _Xconst char*       class,
  523.     WidgetClass         widget_class,
  524.     Display             *display,
  525.     ArgList             args,
  526.     Cardinal            num_args
  527.     )
  528. #else
  529. Widget XtAppCreateShell(name, class, widget_class, display, args, num_args)
  530.     String              name, class;
  531.     WidgetClass         widget_class;
  532.     Display             *display;
  533.     ArgList             args;
  534.     Cardinal            num_args;
  535. #endif
  536. {
  537.     return _XtAppCreateShell(name, class, widget_class, display, args, 
  538.                  num_args, (XtTypedArgList)NULL, (Cardinal)0);
  539. }
  540.  
  541. /* ARGSUSED */
  542. #if NeedFunctionPrototypes
  543. Widget XtCreateApplicationShell(
  544.     _Xconst char* name,        /* unused in R3 and later */
  545.     WidgetClass widget_class,
  546.     ArgList     args,
  547.     Cardinal    num_args
  548.     )
  549. #else
  550. Widget XtCreateApplicationShell(name, widget_class, args, num_args)
  551.     String      name;        /* unused in R3 and later */
  552.     WidgetClass widget_class;
  553.     ArgList     args;
  554.     Cardinal    num_args;
  555. #endif
  556. {
  557.     Display *dpy = _XtDefaultAppContext()->list[0];
  558.     XrmClass class = _XtGetPerDisplay(dpy)->class;
  559.  
  560.     return _XtAppCreateShell((String)NULL, XrmQuarkToString((XrmQuark)class),
  561.                  widget_class, dpy, args, num_args,
  562.                  (XtTypedArgList)NULL, (Cardinal)0);
  563. }
  564.  
  565.