1 /*
2 * Motif
3 *
4 * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5 *
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
16 * details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
22 */
23 #ifdef REV_INFO
24 #ifndef lint
25 static char rcsid[] = "$TOG: BaseClass.c /main/20 1997/03/31 13:14:31 dbl $"
26 #endif
27 #endif
28 #define HAVE_EXTENSIONS
29
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33
34
35 #include <Xm/XmP.h>
36 #include <X11/ShellP.h>
37 #include <Xm/ExtObjectP.h>
38 #include <Xm/Screen.h>
39 #include <Xm/VendorSEP.h>
40 #include <Xm/XmosP.h> /* for bzero */
41 #include "BaseClassI.h"
42 #include "CallbackI.h"
43 #include "DropSMgrI.h"
44 #include "MessagesI.h"
45 #include "TraversalI.h"
46 #include "XmI.h"
47
48
49 #define FIX_1392
50
51 #define MSG1 _XmMMsgBaseClass_0000
52 #define MSG2 _XmMMsgBaseClass_0001
53
54
55 #define IsBaseClass(wc) \
56 ((wc == xmGadgetClass) ||\
57 (wc == xmManagerWidgetClass) ||\
58 (wc == xmPrimitiveWidgetClass) ||\
59 (wc == vendorShellWidgetClass) ||\
60 (wc == xmDisplayClass) ||\
61 (wc == xmScreenClass) ||\
62 (wc == xmExtObjectClass) ||\
63 (_XmIsFastSubclass(wc, XmMENU_SHELL_BIT)))
64
65 #define isWrappedXtClass(wc) \
66 ((wc == rectObjClass) ||\
67 (wc == compositeWidgetClass))
68
69
70 /*
71 * These must be initialized; otherwise they are "secondary symbols"
72 * and are not actually present in the library under HP/UX 10.0. That
73 * caused exportlistgen to hide them entirely, causing links to fail.
74 */
75 externaldef(baseclass) XrmQuark XmQmotif = NULLQUARK;
76 externaldef(baseclass) XmBaseClassExt *_Xm_fastPtr = NULL;
77
78 typedef struct _XmObjectClassWrapper {
79 XtInitProc initialize;
80 XtSetValuesFunc setValues;
81 XtArgsProc getValues;
82 XtWidgetClassProc classPartInit;
83 } XmObjectClassWrapper;
84
85 static XmObjectClassWrapper objectClassWrapper;
86 static XContext resizeRefWContext = 0;
87 static XContext geoRefWContext = 0;
88
89 #define GetRefW(dpy, context, w) \
90 if (XFindContext(dpy, None, context, (XPointer *) &w)) w = NULL
91 #define SetRefW(dpy, context, w) \
92 XSaveContext(dpy, None, context, (char *)w)
93
94 externaldef(xminheritclass) int _XmInheritClass = 0;
95
96
97 /******** Static Function Declarations ********/
98
99 static XmWrapperData GetWrapperData(WidgetClass w_class);
100 static XContext ExtTypeToContext(unsigned char extType);
101 static void RealizeWrapper0(Widget w, Mask *vmask, XSetWindowAttributes *attr);
102 static void RealizeWrapper1(Widget w, Mask *vmask, XSetWindowAttributes *attr);
103 static void RealizeWrapper2(Widget w, Mask *vmask, XSetWindowAttributes *attr);
104 static void RealizeWrapper3(Widget w, Mask *vmask, XSetWindowAttributes *attr);
105 static void RealizeWrapper4(Widget w, Mask *vmask, XSetWindowAttributes *attr);
106 static void RealizeWrapper5(Widget w, Mask *vmask, XSetWindowAttributes *attr);
107 static void RealizeWrapper6(Widget w, Mask *vmask, XSetWindowAttributes *attr);
108 static void RealizeWrapper7(Widget w, Mask *vmask, XSetWindowAttributes *attr);
109 static void RealizeWrapper8(Widget w, Mask *vmask, XSetWindowAttributes *attr);
110 static void RealizeWrapper9(Widget w, Mask *vmask, XSetWindowAttributes *attr);
111 static void RealizeWrapper10(Widget w, Mask *vmask, XSetWindowAttributes *attr);
112 static Cardinal GetRealizeDepth(WidgetClass wc);
113 static void RealizeWrapper(Widget w,
114 Mask *vmask,
115 XSetWindowAttributes *attr,
116 Cardinal depth);
117 static void ResizeWrapper0(Widget w);
118 static void ResizeWrapper1(Widget w);
119 static void ResizeWrapper2(Widget w);
120 static void ResizeWrapper3(Widget w);
121 static void ResizeWrapper4(Widget w);
122 static void ResizeWrapper5(Widget w);
123 static void ResizeWrapper6(Widget w);
124 static void ResizeWrapper7(Widget w);
125 static void ResizeWrapper8(Widget w);
126 static void ResizeWrapper9(Widget w);
127 static void ResizeWrapper10(Widget w);
128 static void ResizeWrapper11(Widget w);
129 static void ResizeWrapper12(Widget w);
130 static void ResizeWrapper13(Widget w);
131 static Cardinal GetResizeDepth(WidgetClass wc);
132 static void ResizeWrapper(Widget w, int depth);
133 static XtGeometryResult GeometryHandlerWrapper0(Widget w,
134 XtWidgetGeometry *desired,
135 XtWidgetGeometry *allowed);
136 static XtGeometryResult GeometryHandlerWrapper1(Widget w,
137 XtWidgetGeometry *desired,
138 XtWidgetGeometry *allowed);
139 static XtGeometryResult GeometryHandlerWrapper2(Widget w,
140 XtWidgetGeometry *desired,
141 XtWidgetGeometry *allowed);
142 static XtGeometryResult GeometryHandlerWrapper3(Widget w,
143 XtWidgetGeometry *desired,
144 XtWidgetGeometry *allowed);
145 static XtGeometryResult GeometryHandlerWrapper4(Widget w,
146 XtWidgetGeometry *desired,
147 XtWidgetGeometry *allowed);
148 static XtGeometryResult GeometryHandlerWrapper5(Widget w,
149 XtWidgetGeometry *desired,
150 XtWidgetGeometry *allowed);
151 static XtGeometryResult GeometryHandlerWrapper6(Widget w,
152 XtWidgetGeometry *desired,
153 XtWidgetGeometry *allowed);
154 static XtGeometryResult GeometryHandlerWrapper7(Widget w,
155 XtWidgetGeometry *desired,
156 XtWidgetGeometry *allowed);
157 static XtGeometryResult GeometryHandlerWrapper8(Widget w,
158 XtWidgetGeometry *desired,
159 XtWidgetGeometry *allowed);
160 static XtGeometryResult GeometryHandlerWrapper9(Widget w,
161 XtWidgetGeometry *desired,
162 XtWidgetGeometry *allowed);
163 static XtGeometryResult GeometryHandlerWrapper10(Widget w,
164 XtWidgetGeometry *desired,
165 XtWidgetGeometry *allowed);
166 static XtGeometryResult GeometryHandlerWrapper11(Widget w,
167 XtWidgetGeometry *desired,
168 XtWidgetGeometry *allowed);
169 static XtGeometryResult GeometryHandlerWrapper12(Widget w,
170 XtWidgetGeometry *desired,
171 XtWidgetGeometry *allowed);
172 static Cardinal GetGeometryHandlerDepth(WidgetClass wc);
173 static XtGeometryResult GeometryHandlerWrapper(Widget w,
174 XtWidgetGeometry *desired,
175 XtWidgetGeometry *allowed,
176 int depth);
177 static XmBaseClassExt * BaseClassPartInitialize(WidgetClass wc);
178 static void ClassPartInitRootWrapper(WidgetClass wc);
179 static void ClassPartInitLeafWrapper(WidgetClass wc);
180 static XtResourceList * CreateIndirectionTable(XtResourceList resources,
181 Cardinal num_resources);
182 static void InitializeRootWrapper(
183 Widget req,
184 Widget new_w,
185 ArgList args,
186 Cardinal *num_args) ;
187 static void InitializeLeafWrapper(
188 Widget req,
189 Widget new_w,
190 ArgList args,
191 Cardinal *num_args,
192 int depth);
193 static void CInitializeLeafWrapper(
194 Widget req,
195 Widget new_w,
196 ArgList args,
197 Cardinal *num_args,
198 int depth);
199 static Boolean SetValuesRootWrapper(
200 Widget current,
201 Widget req,
202 Widget new_w,
203 ArgList args,
204 Cardinal *num_args);
205 static Boolean SetValuesLeafWrapper(
206 Widget current,
207 Widget req,
208 Widget new_w,
209 ArgList args,
210 Cardinal *num_args,
211 int depth);
212 static Boolean CSetValuesLeafWrapper(
213 Widget current,
214 Widget req,
215 Widget new_w,
216 ArgList args,
217 Cardinal *num_args,
218 int depth);
219 static void GetValuesRootWrapper(
220 Widget new_w,
221 ArgList args,
222 Cardinal *num_args);
223 static void GetValuesLeafWrapper(
224 Widget new_w,
225 ArgList args,
226 Cardinal *num_args,
227 int depth);
228 static int GetDepth(WidgetClass wc);
229
230 static void InitializeLeafWrapper0(
231 Widget req,
232 Widget new_w,
233 ArgList args,
234 Cardinal *num_args);
235 static void InitializeLeafWrapper1(
236 Widget req,
237 Widget new_w,
238 ArgList args,
239 Cardinal *num_args);
240 static void InitializeLeafWrapper2(
241 Widget req,
242 Widget new_w,
243 ArgList args,
244 Cardinal *num_args);
245 static void InitializeLeafWrapper3(
246 Widget req,
247 Widget new_w,
248 ArgList args,
249 Cardinal *num_args);
250 static void InitializeLeafWrapper4(
251 Widget req,
252 Widget new_w,
253 ArgList args,
254 Cardinal *num_args);
255 static void InitializeLeafWrapper5(
256 Widget req,
257 Widget new_w,
258 ArgList args,
259 Cardinal *num_args);
260 static void InitializeLeafWrapper6(
261 Widget req,
262 Widget new_w,
263 ArgList args,
264 Cardinal *num_args);
265 static void InitializeLeafWrapper7(
266 Widget req,
267 Widget new_w,
268 ArgList args,
269 Cardinal *num_args);
270 static void InitializeLeafWrapper8(
271 Widget req,
272 Widget new_w,
273 ArgList args,
274 Cardinal *num_args);
275 static void InitializeLeafWrapper9(
276 Widget req,
277 Widget new_w,
278 ArgList args,
279 Cardinal *num_args);
280
281 static void CInitializeLeafWrapper0(
282 Widget req,
283 Widget new_w,
284 ArgList args,
285 Cardinal *num_args);
286 static void CInitializeLeafWrapper1(
287 Widget req,
288 Widget new_w,
289 ArgList args,
290 Cardinal *num_args);
291 static void CInitializeLeafWrapper2(
292 Widget req,
293 Widget new_w,
294 ArgList args,
295 Cardinal *num_args);
296 static void CInitializeLeafWrapper3(
297 Widget req,
298 Widget new_w,
299 ArgList args,
300 Cardinal *num_args);
301 static void CInitializeLeafWrapper4(
302 Widget req,
303 Widget new_w,
304 ArgList args,
305 Cardinal *num_args);
306 static void CInitializeLeafWrapper5(
307 Widget req,
308 Widget new_w,
309 ArgList args,
310 Cardinal *num_args);
311 static void CInitializeLeafWrapper6(
312 Widget req,
313 Widget new_w,
314 ArgList args,
315 Cardinal *num_args);
316 static void CInitializeLeafWrapper7(
317 Widget req,
318 Widget new_w,
319 ArgList args,
320 Cardinal *num_args);
321 static void CInitializeLeafWrapper8(
322 Widget req,
323 Widget new_w,
324 ArgList args,
325 Cardinal *num_args);
326 static void CInitializeLeafWrapper9(
327 Widget req,
328 Widget new_w,
329 ArgList args,
330 Cardinal *num_args);
331
332
333 static Boolean SetValuesLeafWrapper0(
334 Widget current,
335 Widget req,
336 Widget new_w,
337 ArgList args,
338 Cardinal *num_args);
339 static Boolean SetValuesLeafWrapper1(
340 Widget current,
341 Widget req,
342 Widget new_w,
343 ArgList args,
344 Cardinal *num_args);
345 static Boolean SetValuesLeafWrapper2(
346 Widget current,
347 Widget req,
348 Widget new_w,
349 ArgList args,
350 Cardinal *num_args);
351 static Boolean SetValuesLeafWrapper3(
352 Widget current,
353 Widget req,
354 Widget new_w,
355 ArgList args,
356 Cardinal *num_args);
357 static Boolean SetValuesLeafWrapper4(
358 Widget current,
359 Widget req,
360 Widget new_w,
361 ArgList args,
362 Cardinal *num_args);
363 static Boolean SetValuesLeafWrapper5(
364 Widget current,
365 Widget req,
366 Widget new_w,
367 ArgList args,
368 Cardinal *num_args);
369 static Boolean SetValuesLeafWrapper6(
370 Widget current,
371 Widget req,
372 Widget new_w,
373 ArgList args,
374 Cardinal *num_args);
375 static Boolean SetValuesLeafWrapper7(
376 Widget current,
377 Widget req,
378 Widget new_w,
379 ArgList args,
380 Cardinal *num_args);
381 static Boolean SetValuesLeafWrapper8(
382 Widget current,
383 Widget req,
384 Widget new_w,
385 ArgList args,
386 Cardinal *num_args);
387 static Boolean SetValuesLeafWrapper9(
388 Widget current,
389 Widget req,
390 Widget new_w,
391 ArgList args,
392 Cardinal *num_args);
393
394 static Boolean CSetValuesLeafWrapper0(
395 Widget current,
396 Widget req,
397 Widget new_w,
398 ArgList args,
399 Cardinal *num_args);
400 static Boolean CSetValuesLeafWrapper1(
401 Widget current,
402 Widget req,
403 Widget new_w,
404 ArgList args,
405 Cardinal *num_args);
406 static Boolean CSetValuesLeafWrapper2(
407 Widget current,
408 Widget req,
409 Widget new_w,
410 ArgList args,
411 Cardinal *num_args);
412 static Boolean CSetValuesLeafWrapper3(
413 Widget current,
414 Widget req,
415 Widget new_w,
416 ArgList args,
417 Cardinal *num_args);
418 static Boolean CSetValuesLeafWrapper4(
419 Widget current,
420 Widget req,
421 Widget new_w,
422 ArgList args,
423 Cardinal *num_args);
424 static Boolean CSetValuesLeafWrapper5(
425 Widget current,
426 Widget req,
427 Widget new_w,
428 ArgList args,
429 Cardinal *num_args);
430 static Boolean CSetValuesLeafWrapper6(
431 Widget current,
432 Widget req,
433 Widget new_w,
434 ArgList args,
435 Cardinal *num_args);
436 static Boolean CSetValuesLeafWrapper7(
437 Widget current,
438 Widget req,
439 Widget new_w,
440 ArgList args,
441 Cardinal *num_args);
442 static Boolean CSetValuesLeafWrapper8(
443 Widget current,
444 Widget req,
445 Widget new_w,
446 ArgList args,
447 Cardinal *num_args);
448 static Boolean CSetValuesLeafWrapper9(
449 Widget current,
450 Widget req,
451 Widget new_w,
452 ArgList args,
453 Cardinal *num_args);
454
455
456 static void GetValuesLeafWrapper0(
457 Widget new_w,
458 ArgList args,
459 Cardinal *num_args);
460 static void GetValuesLeafWrapper1(
461 Widget new_w,
462 ArgList args,
463 Cardinal *num_args);
464 static void GetValuesLeafWrapper2(
465 Widget new_w,
466 ArgList args,
467 Cardinal *num_args);
468 static void GetValuesLeafWrapper3(
469 Widget new_w,
470 ArgList args,
471 Cardinal *num_args);
472 static void GetValuesLeafWrapper4(
473 Widget new_w,
474 ArgList args,
475 Cardinal *num_args);
476 static void GetValuesLeafWrapper5(
477 Widget new_w,
478 ArgList args,
479 Cardinal *num_args);
480 static void GetValuesLeafWrapper6(
481 Widget new_w,
482 ArgList args,
483 Cardinal *num_args);
484 static void GetValuesLeafWrapper7(
485 Widget new_w,
486 ArgList args,
487 Cardinal *num_args);
488 static void GetValuesLeafWrapper8(
489 Widget new_w,
490 ArgList args,
491 Cardinal *num_args);
492 static void GetValuesLeafWrapper9(
493 Widget new_w,
494 ArgList args,
495 Cardinal *num_args);
496
497 /******** End Static Function Declarations ********/
498
499
500 XmGenericClassExt *
_XmGetClassExtensionPtr(XmGenericClassExt * listHeadPtr,XrmQuark owner)501 _XmGetClassExtensionPtr(
502 XmGenericClassExt *listHeadPtr,
503 XrmQuark owner )
504 {
505 XmGenericClassExt *lclPtr = listHeadPtr;
506
507 #ifdef DEBUG
508 if (!lclPtr)
509 {
510 XmeWarning(NULL, "_XmGetClassExtensionPtr: invalid class ext pointer");
511 return NULL;
512 }
513 #endif /* DEBUG */
514
515 while (lclPtr && *lclPtr && ((*lclPtr)->record_type != owner))
516 lclPtr = (XmGenericClassExt *) &((*lclPtr)->next_extension);
517
518 return lclPtr;
519 }
520
521 static XmWrapperData
GetWrapperData(WidgetClass w_class)522 GetWrapperData(
523 WidgetClass w_class )
524 {
525 XmBaseClassExt *wcePtr;
526
527 wcePtr = _XmGetBaseClassExtPtr( w_class, XmQmotif);
528
529 if (!*wcePtr)
530 {
531 *wcePtr = (XmBaseClassExt) XtCalloc(1, sizeof(XmBaseClassExtRec));
532 (*wcePtr)->next_extension = NULL;
533 (*wcePtr)->record_type = XmQmotif;
534 (*wcePtr)->version = XmBaseClassExtVersion;
535 (*wcePtr)->record_size = sizeof( XmBaseClassExtRec);
536 }
537
538 if ((*wcePtr)->version < XmBaseClassExtVersion)
539 return NULL;
540
541 if (!((*wcePtr)->wrapperData))
542 (*wcePtr)->wrapperData =
543 (XmWrapperData) XtCalloc(1, sizeof(XmWrapperDataRec));
544
545 return (*wcePtr)->wrapperData;
546 }
547
548
549 typedef struct _ExtToContextRec {
550 unsigned char extType;
551 XContext context;
552 } ExtToContextRec, *ExtToContext;
553
554 static XContext
ExtTypeToContext(unsigned char extType)555 ExtTypeToContext(
556 unsigned char extType )
557 {
558 static ExtToContextRec extToContextMap[16];
559 Cardinal i;
560 ExtToContext curr;
561 XContext context = (XContext) NULL;
562
563 _XmProcessLock();
564 for (i = 0, curr = &extToContextMap[0];
565 i < XtNumber(extToContextMap) && !context;
566 i++, curr++)
567 {
568 if (curr->extType == extType)
569 context = curr->context;
570 else if (!curr->extType)
571 {
572 curr->extType = extType;
573 context = curr->context = XUniqueContext();
574 }
575 }
576 _XmProcessUnlock();
577
578 if (!context)
579 XmeWarning(NULL, MSG1);
580
581 return context;
582 }
583
584 typedef struct _XmAssocDataRec {
585 XtPointer data;
586 struct _XmAssocDataRec *next;
587 } XmAssocDataRec, *XmAssocData;
588
589 void
_XmPushWidgetExtData(Widget widget,XmWidgetExtData data,unsigned int extType)590 _XmPushWidgetExtData(
591 Widget widget,
592 XmWidgetExtData data,
593 #if NeedWidePrototypes
594 unsigned int extType )
595 #else
596 unsigned char extType )
597 #endif /* NeedWidePrototypes */
598 {
599 XmAssocData newData;
600 XmAssocData assocData = NULL;
601 XmAssocData *assocDataPtr;
602 Boolean empty;
603 XContext widgetExtContext = ExtTypeToContext(extType);
604
605 newData = (XmAssocData) XtCalloc(1, sizeof(XmAssocDataRec));
606
607 newData->data = (XtPointer)data;
608
609 empty = XFindContext(XtDisplay(widget), (Window) widget,
610 widgetExtContext, (char **) &assocData);
611
612 assocDataPtr = &assocData;
613 while (*assocDataPtr)
614 assocDataPtr = &((*assocDataPtr)->next);
615
616 *assocDataPtr = newData;
617
618 if (empty)
619 XSaveContext(XtDisplay(widget), (Window) widget,
620 widgetExtContext, (XPointer) assocData);
621 }
622
623 void
_XmPopWidgetExtData(Widget widget,XmWidgetExtData * dataRtn,unsigned int extType)624 _XmPopWidgetExtData(
625 Widget widget,
626 XmWidgetExtData *dataRtn,
627 #if NeedWidePrototypes
628 unsigned int extType )
629 #else
630 unsigned char extType )
631 #endif /* NeedWidePrototypes */
632 {
633 XmAssocData assocData = NULL;
634 XmAssocData *assocDataPtr;
635 XContext widgetExtContext = ExtTypeToContext(extType);
636
637 /* Initialize the return parameter. */
638 *dataRtn = NULL;
639
640 if (XFindContext(XtDisplay(widget),
641 (Window) widget,
642 widgetExtContext,
643 (char **) &assocData))
644 {
645 #ifdef DEBUG
646 XmeWarning(NULL, MSG2);
647 #endif
648 return;
649 }
650
651 assocDataPtr = &assocData;
652 while ((*assocDataPtr) && (*assocDataPtr)->next)
653 assocDataPtr = &((*assocDataPtr)->next);
654
655 if (*assocDataPtr == assocData)
656 XDeleteContext(XtDisplay(widget), (Window)widget, widgetExtContext);
657
658 if (*assocDataPtr)
659 {
660 *dataRtn = (XmWidgetExtData) (*assocDataPtr)->data;
661 XtFree((char *) *assocDataPtr);
662 *assocDataPtr = NULL;
663 }
664 }
665
666 XmWidgetExtData
_XmGetWidgetExtData(Widget widget,unsigned int extType)667 _XmGetWidgetExtData(
668 Widget widget,
669 #if NeedWidePrototypes
670 unsigned int extType )
671 #else
672 unsigned char extType )
673 #endif /* NeedWidePrototypes */
674 {
675 XmAssocData assocData = NULL;
676 XmAssocData *assocDataPtr;
677 XContext widgetExtContext = ExtTypeToContext(extType);
678
679
680 if ((XFindContext(XtDisplay(widget),
681 (Window) widget,
682 widgetExtContext,
683 (char **) &assocData)))
684 {
685 #ifdef DEBUG
686 XmeWarning(NULL, "no extension data on stack");
687 #endif /* DEBUG */
688 return NULL;
689 }
690 else
691 {
692 assocDataPtr = &assocData;
693 while ((*assocDataPtr)->next)
694 assocDataPtr = &((*assocDataPtr)->next);
695
696 return (XmWidgetExtData) (*assocDataPtr)->data;
697 }
698 }
699
700
701 Boolean
_XmIsSubclassOf(WidgetClass wc,WidgetClass sc)702 _XmIsSubclassOf(
703 WidgetClass wc,
704 WidgetClass sc)
705 {
706 WidgetClass p = wc;
707
708 while ((p) && (p != sc))
709 p = p->core_class.superclass;
710
711 return (p == sc);
712 }
713
714 /*********************************************************************
715 *
716 * RealizeWrappers for vendorShell
717 *
718 *********************************************************************/
719
720 static void
RealizeWrapper0(Widget w,Mask * vmask,XSetWindowAttributes * attr)721 RealizeWrapper0(
722 Widget w,
723 Mask *vmask,
724 XSetWindowAttributes *attr )
725 {
726 RealizeWrapper(w, vmask, attr, 0);
727 }
728
729 static void
RealizeWrapper1(Widget w,Mask * vmask,XSetWindowAttributes * attr)730 RealizeWrapper1(
731 Widget w,
732 Mask *vmask,
733 XSetWindowAttributes *attr )
734 {
735 RealizeWrapper(w, vmask, attr, 1);
736 }
737
738 static void
RealizeWrapper2(Widget w,Mask * vmask,XSetWindowAttributes * attr)739 RealizeWrapper2(
740 Widget w,
741 Mask *vmask,
742 XSetWindowAttributes *attr )
743 {
744 RealizeWrapper(w, vmask, attr, 2);
745 }
746
747 static void
RealizeWrapper3(Widget w,Mask * vmask,XSetWindowAttributes * attr)748 RealizeWrapper3(
749 Widget w,
750 Mask *vmask,
751 XSetWindowAttributes *attr )
752 {
753 RealizeWrapper(w, vmask, attr, 3);
754 }
755
756 static void
RealizeWrapper4(Widget w,Mask * vmask,XSetWindowAttributes * attr)757 RealizeWrapper4(
758 Widget w,
759 Mask *vmask,
760 XSetWindowAttributes *attr )
761 {
762 RealizeWrapper(w, vmask, attr, 4);
763 }
764
765 static void
RealizeWrapper5(Widget w,Mask * vmask,XSetWindowAttributes * attr)766 RealizeWrapper5(
767 Widget w,
768 Mask *vmask,
769 XSetWindowAttributes *attr )
770 {
771 RealizeWrapper(w, vmask, attr, 5);
772 }
773
774 static void
RealizeWrapper6(Widget w,Mask * vmask,XSetWindowAttributes * attr)775 RealizeWrapper6(
776 Widget w,
777 Mask *vmask,
778 XSetWindowAttributes *attr )
779 {
780 RealizeWrapper(w, vmask, attr, 6);
781 }
782
783 static void
RealizeWrapper7(Widget w,Mask * vmask,XSetWindowAttributes * attr)784 RealizeWrapper7(
785 Widget w,
786 Mask *vmask,
787 XSetWindowAttributes *attr )
788 {
789 RealizeWrapper(w, vmask, attr, 7);
790 }
791
792 static void
RealizeWrapper8(Widget w,Mask * vmask,XSetWindowAttributes * attr)793 RealizeWrapper8(
794 Widget w,
795 Mask *vmask,
796 XSetWindowAttributes *attr )
797 {
798 RealizeWrapper(w, vmask, attr, 8);
799 }
800
801 static void
RealizeWrapper9(Widget w,Mask * vmask,XSetWindowAttributes * attr)802 RealizeWrapper9(
803 Widget w,
804 Mask *vmask,
805 XSetWindowAttributes *attr )
806 {
807 RealizeWrapper(w, vmask, attr, 9);
808 }
809
810 static void
RealizeWrapper10(Widget w,Mask * vmask,XSetWindowAttributes * attr)811 RealizeWrapper10(
812 Widget w,
813 Mask *vmask,
814 XSetWindowAttributes *attr )
815 {
816 RealizeWrapper(w, vmask, attr, 10);
817 }
818
819 /* Used to be XmConst, but this was not linking on Solaris */
820 static XtRealizeProc realizeWrappers[] = {
821 RealizeWrapper0,
822 RealizeWrapper1,
823 RealizeWrapper2,
824 RealizeWrapper3,
825 RealizeWrapper4,
826 RealizeWrapper5,
827 RealizeWrapper6,
828 RealizeWrapper7,
829 RealizeWrapper8,
830 RealizeWrapper9,
831 RealizeWrapper10
832 };
833
834 static Cardinal
GetRealizeDepth(WidgetClass wc)835 GetRealizeDepth(
836 WidgetClass wc )
837 {
838 Cardinal i;
839
840 i = 0;
841 while (wc && wc != vendorShellWidgetClass)
842 {
843 i++;
844 wc = wc->core_class.superclass;
845 }
846
847 if (wc)
848 return i;
849 #ifdef DEBUG
850 else
851 XtError("bad class for shell realize");
852 #endif /* DEBUG */
853
854 return 0;
855 }
856
857 /************************************************************************
858 *
859 * RealizeWrapper
860 *
861 ************************************************************************/
862
863 static void
RealizeWrapper(Widget w,Mask * vmask,XSetWindowAttributes * attr,Cardinal depth)864 RealizeWrapper(
865 Widget w,
866 Mask *vmask,
867 XSetWindowAttributes *attr,
868 Cardinal depth )
869 {
870 if (XmIsVendorShell(w))
871 {
872 XmWidgetExtData extData;
873 WidgetClass wc = XtClass(w);
874 XmWrapperData wrapperData;
875 XtRealizeProc realize;
876 Cardinal leafDepth = GetRealizeDepth(wc);
877 Cardinal depthDiff = leafDepth - depth;
878
879 while (depthDiff)
880 {
881 depthDiff--;
882 wc = wc->core_class.superclass;
883 }
884
885 _XmProcessLock();
886 wrapperData = GetWrapperData(wc);
887 realize = wrapperData ? wrapperData->realize : NULL;
888 _XmProcessUnlock();
889 if (realize)
890 (*realize)(w, vmask, attr);
891
892 #if 0
893 /* DRK 6/20/94 -- This change breaks our test environment; when
894 * present the normal shell isn't added to the grab list
895 * because VendorExtRealize is never called. It used to
896 * be called for the ApplicationShell class.
897 */
898
899 /*
900 * CR 9266: Only call the RealizeCallback if we're doing the
901 * VendorShell class level. Do not call multiple times for
902 * VendorShell subclasses.
903 */
904 if ((extData = _XmGetWidgetExtData(w, XmSHELL_EXTENSION)) &&
905 (extData->widget) && wc == vendorShellWidgetClass)
906 #else
907 /*
908 * CR 3353 - Avoid calling the RealizeCallback twice for DialogShells
909 * by checking the WidgetClass name. If it is XmDialogShell,
910 * do not call the callback (it will be called prior when
911 * the WidgetClass is VendorShell).
912 */
913 if ((extData = _XmGetWidgetExtData(w, XmSHELL_EXTENSION)) &&
914 (extData->widget) &&
915 strcmp(wc->core_class.class_name, "XmDialogShell"))
916 #endif
917 {
918 _XmCallCallbackList(extData->widget,
919 ((XmVendorShellExtObject)
920 (extData->widget))->vendor.realize_callback,
921 NULL);
922 }
923 #ifdef DEBUG
924 else
925 XmeWarning(NULL, "we only support realize callbacks on shells");
926 #endif /* DEBUG */
927 }
928 }
929
930 /*********************************************************************
931 *
932 * ResizeWrappers for rectObj
933 *
934 *********************************************************************/
935
936 static void
ResizeWrapper0(Widget w)937 ResizeWrapper0(
938 Widget w )
939 {
940 ResizeWrapper(w, 0);
941 }
942
943 static void
ResizeWrapper1(Widget w)944 ResizeWrapper1(
945 Widget w )
946 {
947 ResizeWrapper(w, 1);
948 }
949
950 static void
ResizeWrapper2(Widget w)951 ResizeWrapper2(
952 Widget w )
953 {
954 ResizeWrapper(w, 2);
955 }
956
957 static void
ResizeWrapper3(Widget w)958 ResizeWrapper3(
959 Widget w )
960 {
961 ResizeWrapper(w, 3);
962 }
963
964 static void
ResizeWrapper4(Widget w)965 ResizeWrapper4(
966 Widget w )
967 {
968 ResizeWrapper(w, 4);
969 }
970
971 static void
ResizeWrapper5(Widget w)972 ResizeWrapper5(
973 Widget w )
974 {
975 ResizeWrapper(w, 5);
976 }
977
978 static void
ResizeWrapper6(Widget w)979 ResizeWrapper6(
980 Widget w )
981 {
982 ResizeWrapper(w, 6);
983 }
984
985 static void
ResizeWrapper7(Widget w)986 ResizeWrapper7(
987 Widget w )
988 {
989 ResizeWrapper(w, 7);
990 }
991
992 static void
ResizeWrapper8(Widget w)993 ResizeWrapper8(
994 Widget w )
995 {
996 ResizeWrapper(w, 8);
997 }
998
999 static void
ResizeWrapper9(Widget w)1000 ResizeWrapper9(
1001 Widget w )
1002 {
1003 ResizeWrapper(w, 9);
1004 }
1005
1006 static void
ResizeWrapper10(Widget w)1007 ResizeWrapper10(
1008 Widget w )
1009 {
1010 ResizeWrapper(w, 10);
1011 }
1012
1013 static void
ResizeWrapper11(Widget w)1014 ResizeWrapper11(
1015 Widget w )
1016 {
1017 ResizeWrapper(w, 11);
1018 }
1019
1020 static void
ResizeWrapper12(Widget w)1021 ResizeWrapper12(
1022 Widget w )
1023 {
1024 ResizeWrapper(w, 12);
1025 }
1026
1027 static void
ResizeWrapper13(Widget w)1028 ResizeWrapper13(
1029 Widget w )
1030 {
1031 ResizeWrapper(w, 13);
1032 }
1033
1034 /* Used to be XmConst, but this was not linking on Solaris */
1035 static XtWidgetProc resizeWrappers[] = {
1036 ResizeWrapper0,
1037 ResizeWrapper1,
1038 ResizeWrapper2,
1039 ResizeWrapper3,
1040 ResizeWrapper4,
1041 ResizeWrapper5,
1042 ResizeWrapper6,
1043 ResizeWrapper7,
1044 ResizeWrapper8,
1045 ResizeWrapper9,
1046 ResizeWrapper10,
1047 ResizeWrapper11,
1048 ResizeWrapper12,
1049 ResizeWrapper13
1050 };
1051
1052 static Cardinal
GetResizeDepth(WidgetClass wc)1053 GetResizeDepth(
1054 WidgetClass wc )
1055 {
1056 Cardinal i;
1057
1058 i = 0;
1059 while (wc && wc != rectObjClass)
1060 {
1061 i++;
1062 wc = wc->core_class.superclass;
1063 }
1064
1065 if (wc)
1066 return i;
1067
1068 return 0;
1069 }
1070
1071 /************************************************************************
1072 *
1073 * ResizeWrapper
1074 *
1075 ************************************************************************/
1076
1077 static void
ResizeWrapper(Widget w,int depth)1078 ResizeWrapper(
1079 Widget w,
1080 int depth )
1081 {
1082 Widget refW = NULL;
1083 WidgetClass wc = XtClass(w);
1084 Display *dpy = XtDisplay(w);
1085 XmWrapperData wrapperData;
1086 XtWidgetProc resize;
1087 Cardinal leafDepth = GetResizeDepth(wc);
1088 Cardinal depthDiff = leafDepth - depth;
1089 Boolean call_navig_resize = FALSE;
1090
1091 /* Call _XmNavigResize() only once per resize event, so nested
1092 * resize calls are completed before evaluating the status of
1093 * the focus widget. Only check for lost focus in
1094 * response to resize events from a Shell; otherwise
1095 * _XmNavigResize may (prematurely) determine that the
1096 * focus widget is no longer traversable before the
1097 * new layout is complete.
1098 */
1099 if (XtParent(w) && XtIsShell(XtParent(w)))
1100 call_navig_resize = TRUE;
1101
1102 while (depthDiff)
1103 {
1104 depthDiff--;
1105 wc = wc->core_class.superclass;
1106 }
1107
1108 GetRefW(dpy, resizeRefWContext, refW);
1109 _XmProcessLock();
1110 wrapperData = GetWrapperData(wc);
1111 resize = wrapperData ? wrapperData->resize: NULL;
1112 _XmProcessUnlock();
1113
1114 if (resize)
1115 {
1116 if ((refW == NULL) && (_XmDropSiteWrapperCandidate(w)))
1117 {
1118 refW = w;
1119 SetRefW(dpy, resizeRefWContext, refW);
1120 XmDropSiteStartUpdate(refW);
1121 (*resize)(w);
1122 XmDropSiteEndUpdate(refW);
1123 refW = NULL;
1124 SetRefW(dpy, resizeRefWContext, refW);
1125 }
1126 else
1127 (*resize)(w);
1128 }
1129
1130 if (call_navig_resize)
1131 _XmNavigResize( w);
1132 }
1133
1134 /*********************************************************************
1135 *
1136 * GeometryHandlerWrappers for composite
1137 *
1138 *********************************************************************/
1139
1140 static XtGeometryResult
GeometryHandlerWrapper0(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1141 GeometryHandlerWrapper0(
1142 Widget w,
1143 XtWidgetGeometry *desired,
1144 XtWidgetGeometry *allowed )
1145 {
1146 return GeometryHandlerWrapper(w, desired, allowed, 0);
1147 }
1148
1149 static XtGeometryResult
GeometryHandlerWrapper1(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1150 GeometryHandlerWrapper1(
1151 Widget w,
1152 XtWidgetGeometry *desired,
1153 XtWidgetGeometry *allowed )
1154 {
1155 return GeometryHandlerWrapper(w, desired, allowed, 1);
1156 }
1157
1158 static XtGeometryResult
GeometryHandlerWrapper2(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1159 GeometryHandlerWrapper2(
1160 Widget w,
1161 XtWidgetGeometry *desired,
1162 XtWidgetGeometry *allowed )
1163 {
1164 return GeometryHandlerWrapper(w, desired, allowed, 2);
1165 }
1166
1167 static XtGeometryResult
GeometryHandlerWrapper3(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1168 GeometryHandlerWrapper3(
1169 Widget w,
1170 XtWidgetGeometry *desired,
1171 XtWidgetGeometry *allowed )
1172 {
1173 return GeometryHandlerWrapper(w, desired, allowed, 3);
1174 }
1175
1176 static XtGeometryResult
GeometryHandlerWrapper4(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1177 GeometryHandlerWrapper4(
1178 Widget w,
1179 XtWidgetGeometry *desired,
1180 XtWidgetGeometry *allowed )
1181 {
1182 return GeometryHandlerWrapper(w, desired, allowed, 4);
1183 }
1184
1185 static XtGeometryResult
GeometryHandlerWrapper5(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1186 GeometryHandlerWrapper5(
1187 Widget w,
1188 XtWidgetGeometry *desired,
1189 XtWidgetGeometry *allowed )
1190 {
1191 return GeometryHandlerWrapper(w, desired, allowed, 5);
1192 }
1193
1194 static XtGeometryResult
GeometryHandlerWrapper6(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1195 GeometryHandlerWrapper6(
1196 Widget w,
1197 XtWidgetGeometry *desired,
1198 XtWidgetGeometry *allowed )
1199 {
1200 return GeometryHandlerWrapper(w, desired, allowed, 6);
1201 }
1202
1203 static XtGeometryResult
GeometryHandlerWrapper7(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1204 GeometryHandlerWrapper7(
1205 Widget w,
1206 XtWidgetGeometry *desired,
1207 XtWidgetGeometry *allowed )
1208 {
1209 return GeometryHandlerWrapper(w, desired, allowed, 7);
1210 }
1211
1212 static XtGeometryResult
GeometryHandlerWrapper8(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1213 GeometryHandlerWrapper8(
1214 Widget w,
1215 XtWidgetGeometry *desired,
1216 XtWidgetGeometry *allowed )
1217 {
1218 return GeometryHandlerWrapper(w, desired, allowed, 8);
1219 }
1220
1221 static XtGeometryResult
GeometryHandlerWrapper9(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1222 GeometryHandlerWrapper9(
1223 Widget w,
1224 XtWidgetGeometry *desired,
1225 XtWidgetGeometry *allowed )
1226 {
1227 return GeometryHandlerWrapper(w, desired, allowed, 9);
1228 }
1229
1230 static XtGeometryResult
GeometryHandlerWrapper10(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1231 GeometryHandlerWrapper10(
1232 Widget w,
1233 XtWidgetGeometry *desired,
1234 XtWidgetGeometry *allowed )
1235 {
1236 return GeometryHandlerWrapper(w, desired, allowed, 10);
1237 }
1238
1239 static XtGeometryResult
GeometryHandlerWrapper11(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1240 GeometryHandlerWrapper11(
1241 Widget w,
1242 XtWidgetGeometry *desired,
1243 XtWidgetGeometry *allowed )
1244 {
1245 return GeometryHandlerWrapper(w, desired, allowed, 11);
1246 }
1247
1248 static XtGeometryResult
GeometryHandlerWrapper12(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed)1249 GeometryHandlerWrapper12(
1250 Widget w,
1251 XtWidgetGeometry *desired,
1252 XtWidgetGeometry *allowed )
1253 {
1254 return GeometryHandlerWrapper(w, desired, allowed, 12);
1255 }
1256
1257 /* Used to be XmConst, but this was not linkking on Solaris */
1258 static XtGeometryHandler geometryHandlerWrappers[] = {
1259 GeometryHandlerWrapper0,
1260 GeometryHandlerWrapper1,
1261 GeometryHandlerWrapper2,
1262 GeometryHandlerWrapper3,
1263 GeometryHandlerWrapper4,
1264 GeometryHandlerWrapper5,
1265 GeometryHandlerWrapper6,
1266 GeometryHandlerWrapper7,
1267 GeometryHandlerWrapper8,
1268 GeometryHandlerWrapper9,
1269 GeometryHandlerWrapper10,
1270 GeometryHandlerWrapper11,
1271 GeometryHandlerWrapper12
1272 };
1273
1274 static Cardinal
GetGeometryHandlerDepth(WidgetClass wc)1275 GetGeometryHandlerDepth(
1276 WidgetClass wc )
1277 {
1278 Cardinal i;
1279
1280 i = 0;
1281 while (wc && wc != rectObjClass)
1282 {
1283 i++;
1284 wc = wc->core_class.superclass;
1285 }
1286
1287 if (wc)
1288 return i;
1289
1290 return 0;
1291 }
1292
1293 /************************************************************************
1294 *
1295 * GeometryHandlerWrapper
1296 *
1297 ************************************************************************/
1298 static XtGeometryResult
GeometryHandlerWrapper(Widget w,XtWidgetGeometry * desired,XtWidgetGeometry * allowed,int depth)1299 GeometryHandlerWrapper(
1300 Widget w,
1301 XtWidgetGeometry *desired,
1302 XtWidgetGeometry *allowed,
1303 int depth)
1304 {
1305 Widget refW = NULL;
1306 XtGeometryResult result = XtGeometryNo;
1307 Widget parent = XtParent(w);
1308 WidgetClass wc = XtClass(parent);
1309 Display *dpy = XtDisplay(w);
1310 XmWrapperData wrapperData;
1311 XtGeometryHandler geometry_manager;
1312 Cardinal leafDepth = GetGeometryHandlerDepth(wc);
1313 Cardinal depthDiff = leafDepth - depth;
1314
1315 while (depthDiff)
1316 {
1317 depthDiff--;
1318 wc = wc->core_class.superclass;
1319 }
1320
1321 GetRefW(dpy, geoRefWContext, refW);
1322 _XmProcessLock();
1323 wrapperData = GetWrapperData(wc);
1324 geometry_manager = wrapperData ? wrapperData->geometry_manager: NULL;
1325 _XmProcessUnlock();
1326
1327 if (geometry_manager)
1328 {
1329 if ((refW == NULL) && (_XmDropSiteWrapperCandidate(w)))
1330 {
1331 refW = w;
1332 SetRefW(dpy, geoRefWContext, refW);
1333 XmDropSiteStartUpdate(refW);
1334 result = (*geometry_manager) (w, desired, allowed);
1335 XmDropSiteEndUpdate(refW);
1336 refW = NULL;
1337 SetRefW(dpy, geoRefWContext, refW);
1338 }
1339 else
1340 result = (*geometry_manager) (w, desired, allowed);
1341 }
1342
1343 return result;
1344 }
1345
1346 /************************************************************************
1347 *
1348 * BaseClassPartInitialize
1349 *
1350 ************************************************************************/
1351 static XmBaseClassExt *
BaseClassPartInitialize(WidgetClass wc)1352 BaseClassPartInitialize(
1353 WidgetClass wc )
1354 {
1355 XmBaseClassExt *wcePtr, *scePtr;
1356 Cardinal i;
1357 Boolean inited;
1358 XmWrapperData wcData, scData;
1359 Boolean isBaseClass = IsBaseClass(wc);
1360
1361 /*
1362 * This routine is called out of the ClassPartInitRootWrapper. It
1363 * needs to make sure that this is a Motif class and if it is,
1364 * then to initialize it. We assume that the base classes always
1365 * have a static initializer !!!
1366 */
1367
1368 wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
1369 scePtr = _XmGetBaseClassExtPtr(wc->core_class.superclass, XmQmotif);
1370
1371 if (!isBaseClass &&
1372 !isWrappedXtClass(wc) &&
1373 (!scePtr || !(*scePtr)))
1374 return NULL;
1375
1376 if ((isBaseClass) || (scePtr && (*scePtr)))
1377 {
1378 if (!(*wcePtr))
1379 {
1380 inited = False;
1381 *wcePtr = (XmBaseClassExt) XtCalloc(1, sizeof(XmBaseClassExtRec));
1382 (*wcePtr)->classPartInitPrehook = XmInheritClassPartInitPrehook;
1383 (*wcePtr)->classPartInitPosthook = XmInheritClassPartInitPosthook;
1384 (*wcePtr)->initializePrehook = XmInheritInitializePrehook;
1385 (*wcePtr)->setValuesPrehook = XmInheritSetValuesPrehook;
1386 (*wcePtr)->getValuesPrehook = XmInheritGetValuesPrehook;
1387 (*wcePtr)->initializePosthook = XmInheritInitializePosthook;
1388 (*wcePtr)->setValuesPosthook = XmInheritSetValuesPosthook;
1389 (*wcePtr)->getValuesPosthook = XmInheritGetValuesPosthook;
1390 (*wcePtr)->secondaryObjectClass = XmInheritClass;
1391 (*wcePtr)->secondaryObjectCreate = XmInheritSecObjectCreate;
1392 (*wcePtr)->getSecResData = XmInheritGetSecResData;
1393 (*wcePtr)->widgetNavigable = XmInheritWidgetNavigable;
1394 (*wcePtr)->focusChange = XmInheritFocusChange;
1395 }
1396 else
1397 inited = True;
1398
1399 /* this should get done by the static initializers */
1400 for (i = 0; i < 32; i++)
1401 (*wcePtr)->flags[i] = 0;
1402
1403 if (scePtr && *scePtr)
1404 {
1405 if (!inited)
1406 {
1407 (*wcePtr)->next_extension = NULL;
1408 (*wcePtr)->record_type = (*scePtr)->record_type;
1409 (*wcePtr)->version = (*scePtr)->version;
1410 (*wcePtr)->record_size = (*scePtr)->record_size;
1411 }
1412 if ((*wcePtr)->classPartInitPrehook == XmInheritClassPartInitPrehook)
1413 (*wcePtr)->classPartInitPrehook = (*scePtr)->classPartInitPrehook;
1414 if ((*wcePtr)->classPartInitPosthook == XmInheritClassPartInitPosthook)
1415 (*wcePtr)->classPartInitPosthook = (*scePtr)->classPartInitPosthook;
1416 if ((*wcePtr)->initializePrehook == XmInheritInitializePrehook)
1417 (*wcePtr)->initializePrehook = (*scePtr)->initializePrehook;
1418 if ((*wcePtr)->setValuesPrehook == XmInheritSetValuesPrehook)
1419 (*wcePtr)->setValuesPrehook = (*scePtr)->setValuesPrehook;
1420 if ((*wcePtr)->getValuesPrehook == XmInheritGetValuesPrehook)
1421 (*wcePtr)->getValuesPrehook = (*scePtr)->getValuesPrehook;
1422 if ((*wcePtr)->initializePosthook == XmInheritInitializePosthook)
1423 (*wcePtr)->initializePosthook = (*scePtr)->initializePosthook;
1424 if ((*wcePtr)->setValuesPosthook == XmInheritSetValuesPosthook)
1425 (*wcePtr)->setValuesPosthook = (*scePtr)->setValuesPosthook;
1426 if ((*wcePtr)->getValuesPosthook == XmInheritGetValuesPosthook)
1427 (*wcePtr)->getValuesPosthook = (*scePtr)->getValuesPosthook;
1428 if ((*wcePtr)->secondaryObjectClass == XmInheritClass)
1429 (*wcePtr)->secondaryObjectClass = (*scePtr)->secondaryObjectClass;
1430 if ((*wcePtr)->secondaryObjectCreate == XmInheritSecObjectCreate)
1431 (*wcePtr)->secondaryObjectCreate = (*scePtr)->secondaryObjectCreate;
1432 if ((*wcePtr)->getSecResData == XmInheritGetSecResData)
1433 (*wcePtr)->getSecResData = (*scePtr)->getSecResData;
1434 if ((*wcePtr)->widgetNavigable == XmInheritWidgetNavigable)
1435 (*wcePtr)->widgetNavigable = (*scePtr)->widgetNavigable;
1436 if ((*wcePtr)->focusChange == XmInheritFocusChange)
1437 (*wcePtr)->focusChange = (*scePtr)->focusChange;
1438 }
1439 #ifdef DEBUG
1440 else if (!IsBaseClass(wc))
1441 XtError("class must have non-null superclass extension");
1442 #endif /* DEBUG */
1443
1444 /*
1445 * If this class has a secondary object class and that
1446 * class does not have it's own extension (or has not
1447 * been class inited because its a pseudo class) then
1448 * we will give a dummy pointer so that fast subclass
1449 * checking will not fail for the meta classes
1450 * (gadget, manager, etc...)
1451 */
1452 {
1453 WidgetClass sec = (*wcePtr)->secondaryObjectClass;
1454 static XmBaseClassExtRec xmExtExtensionRec = {
1455 NULL, /* Next extension */
1456 NULLQUARK, /* record type XmQmotif */
1457 XmBaseClassExtVersion, /* version */
1458 sizeof(XmBaseClassExtRec), /* size */
1459 };
1460
1461 if (xmExtExtensionRec.record_type == NULLQUARK)
1462 xmExtExtensionRec.record_type = XmQmotif;
1463
1464 if (sec && !sec->core_class.extension)
1465 sec->core_class.extension = (XtPointer)&xmExtExtensionRec;
1466 }
1467 }
1468
1469 wcData = GetWrapperData(wc);
1470 scData = GetWrapperData(wc->core_class.superclass);
1471
1472 if ((wc == vendorShellWidgetClass) ||
1473 _XmIsSubclassOf(wc, vendorShellWidgetClass))
1474 {
1475 /* Wrap Realize */
1476 /*
1477 * check if this widget was using XtInherit and got the wrapper
1478 * from the superclass
1479 */
1480 if (wc->core_class.realize == XtInheritRealize)
1481 {
1482 wcData->realize = scData->realize;
1483 }
1484 /*
1485 * It has declared it's own realize routine so save it
1486 */
1487 else
1488 {
1489 wcData->realize = wc->core_class.realize;
1490 }
1491 wc->core_class.realize = realizeWrappers[GetRealizeDepth(wc)];
1492 }
1493
1494 if ((wc == rectObjClass) ||
1495 _XmIsSubclassOf(wc, rectObjClass))
1496 {
1497 /* Wrap resize */
1498 /*
1499 * check if this widget was using XtInherit and got the wrapper
1500 * from the superclass
1501 */
1502 if (wc->core_class.resize == XtInheritResize)
1503 {
1504 wcData->resize = scData->resize;
1505 }
1506 /*
1507 * It has declared it's own resize routine so save it
1508 */
1509 else
1510 {
1511 wcData->resize = wc->core_class.resize;
1512 }
1513 wc->core_class.resize = resizeWrappers[GetResizeDepth(wc)];
1514 }
1515
1516 if ((wc == compositeWidgetClass) ||
1517 _XmIsSubclassOf(wc, compositeWidgetClass))
1518 {
1519 /* Wrap GeometryManager */
1520 /*
1521 * check if this widget was using XtInherit and got the wrapper
1522 * from the superclass
1523 */
1524 if (((CompositeWidgetClass) wc)->composite_class.geometry_manager
1525 == XtInheritGeometryManager)
1526 {
1527 wcData->geometry_manager = scData->geometry_manager;
1528 }
1529 /*
1530 * It has declared it's own resize routine so save it
1531 */
1532 else
1533 {
1534 wcData->geometry_manager = ((CompositeWidgetClass) wc)
1535 ->composite_class.geometry_manager;
1536 }
1537 ((CompositeWidgetClass) wc)->composite_class.geometry_manager =
1538 (XtGeometryHandler)
1539 geometryHandlerWrappers[GetGeometryHandlerDepth(wc)];
1540 }
1541
1542 return wcePtr;
1543 }
1544
1545 /*
1546 * This function replaces the objectClass classPartInit slot and is
1547 * called at the start of the first XtCreate invocation.
1548 */
1549 static void
ClassPartInitRootWrapper(WidgetClass wc)1550 ClassPartInitRootWrapper(
1551 WidgetClass wc )
1552 {
1553 XtWidgetClassProc *leafFuncPtr;
1554 XmBaseClassExt *wcePtr;
1555
1556
1557 wcePtr = BaseClassPartInitialize(wc);
1558 /*
1559 * check that it's a class that we know about
1560 */
1561 if (wcePtr && *wcePtr)
1562 {
1563 if ((*wcePtr)->classPartInitPrehook)
1564 (*((*wcePtr)->classPartInitPrehook)) (wc);
1565
1566 /*
1567 * If we have a prehook, then envelop the leaf class function
1568 * that whould be called last.
1569 */
1570 if ((*wcePtr)->classPartInitPosthook)
1571 {
1572 XmWrapperData wrapperData;
1573
1574 wrapperData = GetWrapperData(wc);
1575 leafFuncPtr = (XtWidgetClassProc *)
1576 &(wc->core_class.class_part_initialize);
1577 wrapperData->classPartInitLeaf = *leafFuncPtr;
1578 *leafFuncPtr = ClassPartInitLeafWrapper;
1579 }
1580 }
1581
1582 if (objectClassWrapper.classPartInit)
1583 (* objectClassWrapper.classPartInit) (wc);
1584 }
1585
1586 static void
ClassPartInitLeafWrapper(WidgetClass wc)1587 ClassPartInitLeafWrapper(
1588 WidgetClass wc )
1589 {
1590 XtWidgetClassProc *leafFuncPtr;
1591 XmBaseClassExt *wcePtr;
1592
1593 wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
1594
1595 if (*wcePtr && (*wcePtr)->classPartInitPosthook)
1596 {
1597 XmWrapperData wrapperData;
1598
1599 wrapperData = GetWrapperData(wc);
1600 leafFuncPtr = (XtWidgetClassProc *)
1601 &(wc->core_class.class_part_initialize);
1602
1603 if (wrapperData->classPartInitLeaf)
1604 (* wrapperData->classPartInitLeaf) (wc);
1605 if ((*wcePtr)->classPartInitPosthook)
1606 (*((*wcePtr)->classPartInitPosthook)) (wc);
1607 #ifdef DEBUG
1608 else
1609 XmeWarning(NULL, "there should be a non-null hook for a leaf wrapper");
1610 #endif /* DEBUG */
1611 *leafFuncPtr = wrapperData->classPartInitLeaf;
1612 wrapperData->classPartInitLeaf = NULL;
1613 }
1614 }
1615
1616 static Boolean
is_constraint_subclass(WidgetClass cls)1617 is_constraint_subclass(WidgetClass cls)
1618 {
1619 WidgetClass sc;
1620
1621 for (sc = cls; sc != NULL; sc = sc->core_class.superclass)
1622 if (sc == (WidgetClass) &constraintClassRec)
1623 return True;
1624
1625 return False;
1626 }
1627
1628
1629 void
_XmInitializeExtensions(void)1630 _XmInitializeExtensions( void )
1631 {
1632 static Boolean firstTime = True;
1633
1634 if (firstTime)
1635 {
1636 XmQmotif = XrmPermStringToQuark("OSF_MOTIF");
1637
1638 objectClassWrapper.initialize =
1639 objectClass->core_class.initialize;
1640 objectClassWrapper.setValues =
1641 objectClass->core_class.set_values;
1642 objectClassWrapper.getValues =
1643 objectClass->core_class.get_values_hook;
1644 objectClassWrapper.classPartInit =
1645 objectClass->core_class.class_part_initialize;
1646 objectClass->core_class.class_part_initialize =
1647 ClassPartInitRootWrapper;
1648 objectClass->core_class.initialize =
1649 InitializeRootWrapper;
1650 objectClass->core_class.set_values =
1651 SetValuesRootWrapper;
1652 objectClass->core_class.get_values_hook =
1653 GetValuesRootWrapper;
1654 firstTime = False;
1655 }
1656 resizeRefWContext = XUniqueContext();
1657 geoRefWContext = XUniqueContext();
1658 }
1659
1660
1661 Cardinal
_XmSecondaryResourceData(XmBaseClassExt bcePtr,XmSecondaryResourceData ** secResDataRtn,XtPointer client_data,String name,String class_name,XmResourceBaseProc basefunctionpointer)1662 _XmSecondaryResourceData(
1663 XmBaseClassExt bcePtr,
1664 XmSecondaryResourceData **secResDataRtn,
1665 XtPointer client_data,
1666 String name,
1667 String class_name,
1668 XmResourceBaseProc basefunctionpointer )
1669 {
1670 WidgetClass secObjClass;
1671 XmSecondaryResourceData secResData, *sd;
1672 Cardinal count = 0;
1673
1674 if (bcePtr)
1675 {
1676 secObjClass = ( (bcePtr)->secondaryObjectClass);
1677 if (secObjClass)
1678 {
1679 secResData = XtNew(XmSecondaryResourceDataRec);
1680
1681 _XmTransformSubResources(secObjClass->core_class.resources,
1682 secObjClass->core_class.num_resources,
1683 &(secResData->resources),
1684 &(secResData->num_resources));
1685
1686 secResData->name = name;
1687 secResData->res_class = class_name;
1688 secResData->client_data = client_data;
1689 secResData->base_proc = basefunctionpointer;
1690 sd = XtNew(XmSecondaryResourceData);
1691 *sd = secResData;
1692 *secResDataRtn = sd;
1693 count++;
1694 }
1695 }
1696
1697 return count;
1698 }
1699
1700 /*
1701 * This function makes assumptions about what the Intrinsics is
1702 * doing with the resource lists. It is based on the X11R5 version
1703 * of the Intrinsics. It is used as a work around for a bug in
1704 * the Intrinsics that deals with recompiling already compiled resource
1705 * lists. When that bug is fixed, this function should be removed.
1706 */
1707 static XtResourceList*
CreateIndirectionTable(XtResourceList resources,Cardinal num_resources)1708 CreateIndirectionTable(XtResourceList resources,
1709 Cardinal num_resources)
1710 {
1711 register int i;
1712 XtResourceList* table;
1713
1714 table = (XtResourceList*)XtMalloc(num_resources * sizeof(XtResourceList));
1715 for (i = 0; i < num_resources; i++)
1716 table[i] = (XtResourceList)(&(resources[i]));
1717
1718 return table;
1719 }
1720
1721 /*
1722 * The statement in this function calls CreateIndirectionTable() which
1723 * is scheduled for removal (see comment in function above).
1724 * It is used as a work around for an X11R5 Intrinsics bug. When the
1725 * bug is fixed, change to the assignement statement so the
1726 * constraint_class.reources is assigned comp_resources. Next,
1727 * change the class_inited field of the core_class record to False.
1728 * Then remove the check for class_inited, in the conditional statement
1729 * which calls XtInitializeWidgetClass() and move the call to
1730 * XtInitializeWidgetClass() to just above the call to
1731 * XtGetConstraintResourceList(). Then remove the call to
1732 * XtFree() and the last two assignment statements.
1733 */
1734 void
_XmTransformSubResources(XtResourceList comp_resources,Cardinal num_comp_resources,XtResourceList * resources,Cardinal * num_resources)1735 _XmTransformSubResources(
1736 XtResourceList comp_resources,
1737 Cardinal num_comp_resources,
1738 XtResourceList *resources,
1739 Cardinal *num_resources)
1740 {
1741 static ConstraintClassRec shadowObjectClassRec = {
1742 {
1743 /* superclass */ (WidgetClass) &constraintClassRec,
1744 /* class_name */ "Shadow",
1745 /* widget_size */ sizeof(ConstraintRec),
1746 /* class_initialize */ NULL,
1747 /* class_part_initialize*/ NULL,
1748 /* class_inited */ FALSE,
1749 /* initialize */ NULL,
1750 /* initialize_hook */ NULL,
1751 /* realize */ XtInheritRealize,
1752 /* actions */ NULL,
1753 /* num_actions */ 0,
1754 /* resources */ NULL,
1755 /* num_resources */ 0,
1756 /* xrm_class */ NULLQUARK,
1757 /* compress_motion */ FALSE,
1758 /* compress_exposure */ TRUE,
1759 /* compress_enterleave */ FALSE,
1760 /* visible_interest */ FALSE,
1761 /* destroy */ NULL,
1762 /* resize */ NULL,
1763 /* expose */ NULL,
1764 /* set_values */ NULL,
1765 /* set_values_hook */ NULL,
1766 /* set_values_almost */ XtInheritSetValuesAlmost,
1767 /* get_values_hook */ NULL,
1768 /* accept_focus */ NULL,
1769 /* version */ XtVersion,
1770 /* callback_offsets */ NULL,
1771 /* tm_table */ NULL,
1772 /* query_geometry */ NULL,
1773 /* display_accelerator */ NULL,
1774 /* extension */ NULL
1775 },
1776
1777 { /**** CompositePart *****/
1778 /* geometry_handler */ NULL,
1779 /* change_managed */ NULL,
1780 /* insert_child */ XtInheritInsertChild,
1781 /* delete_child */ XtInheritDeleteChild,
1782 /* extension */ NULL
1783 },
1784
1785 { /**** ConstraintPart ****/
1786 /* resources */ NULL,
1787 /* num_resources */ 0,
1788 /* constraint_size */ 0,
1789 /* initialize */ NULL,
1790 /* destroy */ NULL,
1791 /* set_values */ NULL,
1792 /* extension */ NULL
1793 }
1794 };
1795
1796 if (((int)comp_resources[0].resource_offset) >= 0)
1797 {
1798 XtResourceList tmp_resources;
1799
1800 tmp_resources = (XtResourceList)
1801 XtMalloc(sizeof(XtResource) * num_comp_resources);
1802
1803 memcpy(tmp_resources, comp_resources,
1804 sizeof(XtResource) * num_comp_resources);
1805
1806 *resources = tmp_resources;
1807 *num_resources = num_comp_resources;
1808 }
1809 else
1810 {
1811 if (!shadowObjectClassRec.core_class.class_inited)
1812 XtInitializeWidgetClass((WidgetClass) &shadowObjectClassRec);
1813
1814 /* This next statement is marked for change */
1815 shadowObjectClassRec.constraint_class.resources = (XtResourceList)
1816 CreateIndirectionTable(comp_resources, num_comp_resources);
1817
1818 shadowObjectClassRec.constraint_class.num_resources = num_comp_resources;
1819
1820 XtGetConstraintResourceList((WidgetClass) &shadowObjectClassRec,
1821 resources, num_resources);
1822
1823 if (shadowObjectClassRec.constraint_class.resources)
1824 XtFree((char *) shadowObjectClassRec.constraint_class.resources);
1825
1826 shadowObjectClassRec.constraint_class.resources = NULL;
1827 shadowObjectClassRec.constraint_class.num_resources = 0;
1828 }
1829 }
1830
1831 static XtInitProc InitializeLeafWrappers[] = {
1832 InitializeLeafWrapper0,
1833 InitializeLeafWrapper1,
1834 InitializeLeafWrapper2,
1835 InitializeLeafWrapper3,
1836 InitializeLeafWrapper4,
1837 InitializeLeafWrapper5,
1838 InitializeLeafWrapper6,
1839 InitializeLeafWrapper7,
1840 InitializeLeafWrapper8,
1841 InitializeLeafWrapper9
1842 };
1843 static XtInitProc CInitializeLeafWrappers[] = {
1844 CInitializeLeafWrapper0,
1845 CInitializeLeafWrapper1,
1846 CInitializeLeafWrapper2,
1847 CInitializeLeafWrapper3,
1848 CInitializeLeafWrapper4,
1849 CInitializeLeafWrapper5,
1850 CInitializeLeafWrapper6,
1851 CInitializeLeafWrapper7,
1852 CInitializeLeafWrapper8,
1853 CInitializeLeafWrapper9
1854 };
1855
1856 /*
1857 * This function replaces the objectClass initialize slot and is
1858 * called at the start of every XtCreate invocation.
1859 */
1860 static void
InitializeRootWrapper(Widget req,Widget new_w,ArgList args,Cardinal * num_args)1861 InitializeRootWrapper(
1862 Widget req,
1863 Widget new_w,
1864 ArgList args,
1865 Cardinal *num_args)
1866 {
1867 WidgetClass wc = XtClass(new_w);
1868 XmBaseClassExt *wcePtr;
1869
1870 wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
1871
1872 if (wcePtr && *wcePtr) {
1873
1874 if ((*wcePtr)->initializePrehook)
1875 (*((*wcePtr)->initializePrehook))(req, new_w, args, num_args);
1876
1877
1878 if ((*wcePtr)->initializePosthook) {
1879 XmWrapperData wrapperData;
1880
1881 _XmProcessLock();
1882
1883 if (!XtIsShell(new_w) && XtParent(new_w)
1884 && XtIsConstraint(XtParent(new_w))) {
1885 ConstraintWidgetClass cwc;
1886
1887 cwc = (ConstraintWidgetClass) XtClass(XtParent(new_w));
1888 wrapperData = GetWrapperData((WidgetClass) cwc);
1889 if (wrapperData->constraintInitializeLeafCount ==0)
1890 {
1891 wrapperData->constraintInitializeLeaf =
1892 cwc->constraint_class.initialize;
1893 cwc->constraint_class.initialize =
1894 CInitializeLeafWrappers[
1895 GetDepth((WidgetClass) cwc)];
1896 }
1897 (wrapperData->constraintInitializeLeafCount)++;
1898 }
1899 else {
1900 wrapperData = GetWrapperData(wc);
1901 if (wrapperData->initializeLeafCount ==0) {
1902 wrapperData->initializeLeaf =
1903 wc->core_class.initialize;
1904 wc->core_class.initialize =
1905 InitializeLeafWrappers[
1906 GetDepth(wc)];
1907 }
1908 (wrapperData->initializeLeafCount)++;
1909 }
1910
1911 _XmProcessUnlock();
1912 }
1913
1914 if (objectClassWrapper.initialize)
1915 (*objectClassWrapper.initialize)(req, new_w,args, num_args);
1916 }
1917 }
1918
1919 static void
InitializeLeafWrapper(Widget req,Widget new_w,ArgList args,Cardinal * num_args,int depth)1920 InitializeLeafWrapper(
1921 Widget req,
1922 Widget new_w,
1923 ArgList args,
1924 Cardinal *num_args,
1925 int depth)
1926 {
1927 WidgetClass wc = XtClass(new_w);
1928 XtInitProc init_proc = NULL;
1929 XtInitProc post_proc = NULL;
1930 int leafDepth = GetDepth(wc);
1931 XmWrapperData wrapperData;
1932
1933 _XmProcessLock();
1934
1935 if (leafDepth == depth) { /* Correct depth */
1936 wrapperData = GetWrapperData(wc);
1937
1938 if (!XtIsShell(new_w) && XtParent(new_w) &&
1939 XtIsConstraint(XtParent(new_w))) {
1940 init_proc = wrapperData->initializeLeaf;
1941 }
1942 else {
1943 /* We're home ! */
1944 XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
1945 init_proc = wrapperData->initializeLeaf;
1946 post_proc = (*wcePtr)->initializePosthook;
1947
1948 #ifdef FIX_1392
1949 if (post_proc) {
1950 #endif
1951 if ((--(wrapperData->initializeLeafCount)) == 0)
1952 wc->core_class.initialize =
1953 wrapperData->initializeLeaf;
1954 #ifdef FIX_1392
1955 }
1956 #endif
1957 }
1958 }
1959 else {
1960 int depthDiff = leafDepth - depth;
1961
1962 for ( ; depthDiff;
1963 depthDiff--, wc = wc->core_class.superclass)
1964 {};
1965
1966 wrapperData = GetWrapperData(wc);
1967 init_proc = wrapperData->initializeLeaf;
1968 }
1969
1970 _XmProcessUnlock();
1971
1972 if (init_proc)
1973 (*init_proc)(req, new_w, args, num_args);
1974 if (post_proc)
1975 (*post_proc)(req, new_w, args, num_args);
1976 }
1977
1978 static void
CInitializeLeafWrapper(Widget req,Widget new_w,ArgList args,Cardinal * num_args,int depth)1979 CInitializeLeafWrapper(
1980 Widget req,
1981 Widget new_w,
1982 ArgList args,
1983 Cardinal *num_args,
1984 int depth)
1985 {
1986 WidgetClass wc = XtClass(new_w);
1987 ConstraintWidgetClass cwc = (ConstraintWidgetClass)
1988 XtClass(XtParent(new_w));
1989 XtInitProc init_proc = NULL;
1990 XtInitProc post_proc = NULL;
1991 int leafDepth = GetDepth((WidgetClass) cwc);
1992 XmWrapperData wrapperData;
1993
1994 _XmProcessLock();
1995
1996 if (leafDepth == depth) {
1997 XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
1998 wrapperData = GetWrapperData((WidgetClass) cwc);
1999
2000 init_proc = wrapperData->constraintInitializeLeaf;
2001 post_proc = (*wcePtr)->initializePosthook;
2002
2003 #ifdef FIX_1392
2004 if (post_proc) {
2005 #endif
2006 if ((--(wrapperData->constraintInitializeLeafCount)) ==0)
2007 cwc->constraint_class.initialize =
2008 wrapperData->constraintInitializeLeaf;
2009 #ifdef FIX_1392
2010 }
2011 #endif
2012 }
2013 else {
2014 int depthDiff = leafDepth - depth;
2015
2016 for ( ; depthDiff;
2017 depthDiff--, cwc = (ConstraintWidgetClass)
2018 cwc->core_class.superclass)
2019 {};
2020
2021 wrapperData = GetWrapperData((WidgetClass) cwc);
2022 init_proc = wrapperData->constraintInitializeLeaf;
2023 }
2024
2025 _XmProcessUnlock();
2026
2027 if (init_proc)
2028 (*init_proc)(req, new_w, args, num_args);
2029 if (post_proc)
2030 (*post_proc)(req, new_w, args, num_args);
2031 }
2032
2033 static void
InitializeLeafWrapper0(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2034 InitializeLeafWrapper0(
2035 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2036 {
2037 InitializeLeafWrapper(req, new_w, args, num_args, 0);
2038 }
2039 static void
InitializeLeafWrapper1(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2040 InitializeLeafWrapper1(
2041 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2042 {
2043 InitializeLeafWrapper(req, new_w, args, num_args, 1);
2044 }
2045 static void
InitializeLeafWrapper2(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2046 InitializeLeafWrapper2(
2047 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2048 {
2049 InitializeLeafWrapper(req, new_w, args, num_args, 2);
2050 }
2051 static void
InitializeLeafWrapper3(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2052 InitializeLeafWrapper3(
2053 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2054 {
2055 InitializeLeafWrapper(req, new_w, args, num_args, 3);
2056 }
2057 static void
InitializeLeafWrapper4(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2058 InitializeLeafWrapper4(
2059 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2060 {
2061 InitializeLeafWrapper(req, new_w, args, num_args, 4);
2062 }
2063 static void
InitializeLeafWrapper5(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2064 InitializeLeafWrapper5(
2065 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2066 {
2067 InitializeLeafWrapper(req, new_w, args, num_args, 5);
2068 }
2069 static void
InitializeLeafWrapper6(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2070 InitializeLeafWrapper6(
2071 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2072 {
2073 InitializeLeafWrapper(req, new_w, args, num_args, 6);
2074 }
2075 static void
InitializeLeafWrapper7(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2076 InitializeLeafWrapper7(
2077 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2078 {
2079 InitializeLeafWrapper(req, new_w, args, num_args, 7);
2080 }
2081 static void
InitializeLeafWrapper8(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2082 InitializeLeafWrapper8(
2083 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2084 {
2085 InitializeLeafWrapper(req, new_w, args, num_args, 8);
2086 }
2087 static void
InitializeLeafWrapper9(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2088 InitializeLeafWrapper9(
2089 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2090 {
2091 InitializeLeafWrapper(req, new_w, args, num_args, 9);
2092 }
2093
2094 static void
CInitializeLeafWrapper0(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2095 CInitializeLeafWrapper0(
2096 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2097 {
2098 CInitializeLeafWrapper(req, new_w, args, num_args,0);
2099 }
2100 static void
CInitializeLeafWrapper1(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2101 CInitializeLeafWrapper1(
2102 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2103 {
2104 CInitializeLeafWrapper(req, new_w, args, num_args,1);
2105 }
2106 static void
CInitializeLeafWrapper2(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2107 CInitializeLeafWrapper2(
2108 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2109 {
2110 CInitializeLeafWrapper(req, new_w, args, num_args,2);
2111 }
2112 static void
CInitializeLeafWrapper3(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2113 CInitializeLeafWrapper3(
2114 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2115 {
2116 CInitializeLeafWrapper(req, new_w, args, num_args,3);
2117 }
2118 static void
CInitializeLeafWrapper4(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2119 CInitializeLeafWrapper4(
2120 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2121 {
2122 CInitializeLeafWrapper(req, new_w, args, num_args,4);
2123 }
2124 static void
CInitializeLeafWrapper5(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2125 CInitializeLeafWrapper5(
2126 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2127 {
2128 CInitializeLeafWrapper(req, new_w, args, num_args,5);
2129 }
2130 static void
CInitializeLeafWrapper6(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2131 CInitializeLeafWrapper6(
2132 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2133 {
2134 CInitializeLeafWrapper(req, new_w, args, num_args,6);
2135 }
2136 static void
CInitializeLeafWrapper7(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2137 CInitializeLeafWrapper7(
2138 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2139 {
2140 CInitializeLeafWrapper(req, new_w, args, num_args,7);
2141 }
2142 static void
CInitializeLeafWrapper8(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2143 CInitializeLeafWrapper8(
2144 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2145 {
2146 CInitializeLeafWrapper(req, new_w, args, num_args,8);
2147 }
2148 static void
CInitializeLeafWrapper9(Widget req,Widget new_w,ArgList args,Cardinal * num_args)2149 CInitializeLeafWrapper9(
2150 Widget req, Widget new_w, ArgList args, Cardinal *num_args)
2151 {
2152 CInitializeLeafWrapper(req, new_w, args, num_args,9);
2153 }
2154
2155 static XtSetValuesFunc SetValuesLeafWrappers[] = {
2156 SetValuesLeafWrapper0,
2157 SetValuesLeafWrapper1,
2158 SetValuesLeafWrapper2,
2159 SetValuesLeafWrapper3,
2160 SetValuesLeafWrapper4,
2161 SetValuesLeafWrapper5,
2162 SetValuesLeafWrapper6,
2163 SetValuesLeafWrapper7,
2164 SetValuesLeafWrapper8,
2165 SetValuesLeafWrapper9
2166 };
2167 static XtSetValuesFunc CSetValuesLeafWrappers[] = {
2168 CSetValuesLeafWrapper0,
2169 CSetValuesLeafWrapper1,
2170 CSetValuesLeafWrapper2,
2171 CSetValuesLeafWrapper3,
2172 CSetValuesLeafWrapper4,
2173 CSetValuesLeafWrapper5,
2174 CSetValuesLeafWrapper6,
2175 CSetValuesLeafWrapper7,
2176 CSetValuesLeafWrapper8,
2177 CSetValuesLeafWrapper9
2178 };
2179
2180 /*
2181 * This function replaces the objectClass set_values slot and is
2182 * called at the start of every XtSetValues invocation.
2183 */
2184 static Boolean
SetValuesRootWrapper(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2185 SetValuesRootWrapper(
2186 Widget current,
2187 Widget req,
2188 Widget new_w,
2189 ArgList args,
2190 Cardinal *num_args)
2191 {
2192 WidgetClass wc = XtClass(new_w);
2193 XmBaseClassExt *wcePtr;
2194 Boolean returnVal = False;
2195
2196 wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2197
2198 if (wcePtr && *wcePtr) {
2199
2200 if ((*wcePtr)->setValuesPrehook)
2201 returnVal |= (*((*wcePtr)->setValuesPrehook))
2202 (current, req, new_w, args, num_args);
2203
2204 if ((*wcePtr)->setValuesPosthook) {
2205 XmWrapperData wrapperData;
2206
2207 _XmProcessLock();
2208
2209 if (!XtIsShell(new_w) && XtParent(new_w)
2210 && XtIsConstraint(XtParent(new_w))) {
2211 ConstraintWidgetClass cwc;
2212
2213 cwc = (ConstraintWidgetClass) XtClass(XtParent(new_w));
2214 wrapperData = GetWrapperData((WidgetClass) cwc);
2215 if (wrapperData->constraintSetValuesLeafCount ==0)
2216 {
2217 wrapperData->constraintSetValuesLeaf =
2218 cwc->constraint_class.set_values;
2219 cwc->constraint_class.set_values =
2220 CSetValuesLeafWrappers[
2221 GetDepth((WidgetClass) cwc)];
2222 }
2223 (wrapperData->constraintSetValuesLeafCount)++;
2224 }
2225 else {
2226 wrapperData = GetWrapperData(wc);
2227 if (wrapperData->setValuesLeafCount ==0) {
2228 wrapperData->setValuesLeaf =
2229 wc->core_class.set_values;
2230 wc->core_class.set_values =
2231 SetValuesLeafWrappers[
2232 GetDepth(wc)];
2233 }
2234 (wrapperData->setValuesLeafCount)++;
2235 }
2236
2237 _XmProcessUnlock();
2238 }
2239 }
2240
2241 if (objectClassWrapper.setValues)
2242 returnVal |= (*objectClassWrapper.setValues)
2243 (current, req, new_w, args, num_args);
2244
2245 return returnVal;
2246 }
2247
2248 static Boolean
SetValuesLeafWrapper(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args,int depth)2249 SetValuesLeafWrapper(
2250 Widget current,
2251 Widget req,
2252 Widget new_w,
2253 ArgList args,
2254 Cardinal *num_args,
2255 int depth)
2256 {
2257 WidgetClass wc = XtClass(new_w);
2258 XtSetValuesFunc setvalues_proc = NULL;
2259 XtSetValuesFunc post_proc = NULL;
2260 Boolean returnVal = False;
2261 int leafDepth = GetDepth(wc);
2262 XmWrapperData wrapperData;
2263
2264 _XmProcessLock();
2265
2266 if (leafDepth == depth) { /* Correct depth */
2267 wrapperData = GetWrapperData(wc);
2268
2269 if (!XtIsShell(new_w) && XtParent(new_w) &&
2270 XtIsConstraint(XtParent(new_w))) {
2271 setvalues_proc = wrapperData->setValuesLeaf;
2272 }
2273 else {
2274 /* We're home ! */
2275 XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2276 setvalues_proc = wrapperData->setValuesLeaf;
2277 post_proc = (*wcePtr)->setValuesPosthook;
2278
2279 #ifdef FIX_1392
2280 if (post_proc) {
2281 #endif
2282 if ((--(wrapperData->setValuesLeafCount)) ==0)
2283 wc->core_class.set_values =
2284 wrapperData->setValuesLeaf;
2285 #ifdef FIX_1392
2286 }
2287 #endif
2288 }
2289 }
2290 else {
2291 int depthDiff = leafDepth - depth;
2292
2293 for ( ; depthDiff;
2294 depthDiff--, wc = wc->core_class.superclass)
2295 {};
2296
2297 wrapperData = GetWrapperData(wc);
2298 setvalues_proc = wrapperData->setValuesLeaf;
2299 }
2300
2301 _XmProcessUnlock();
2302
2303 if (setvalues_proc)
2304 returnVal |= (*setvalues_proc)
2305 (current, req, new_w, args, num_args);
2306 if (post_proc)
2307 returnVal |= (*post_proc)
2308 (current, req, new_w, args, num_args);
2309
2310 return returnVal;
2311 }
2312
2313 static Boolean
CSetValuesLeafWrapper(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args,int depth)2314 CSetValuesLeafWrapper(
2315 Widget current,
2316 Widget req,
2317 Widget new_w,
2318 ArgList args,
2319 Cardinal *num_args,
2320 int depth)
2321 {
2322 WidgetClass wc = XtClass(new_w);
2323 ConstraintWidgetClass cwc = (ConstraintWidgetClass)
2324 XtClass(XtParent(new_w));
2325 XtSetValuesFunc setvalues_proc = NULL;
2326 XtSetValuesFunc post_proc = NULL;
2327 Boolean returnVal = False;
2328 int leafDepth = GetDepth((WidgetClass) cwc);
2329 XmWrapperData wrapperData;
2330
2331 _XmProcessLock();
2332
2333 if (leafDepth == depth) {
2334 XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2335 wrapperData = GetWrapperData((WidgetClass) cwc);
2336
2337 setvalues_proc = wrapperData->constraintSetValuesLeaf;
2338 post_proc = (*wcePtr)->setValuesPosthook;
2339 #ifdef FIX_1392
2340 if (post_proc) {
2341 #endif
2342 if ((--(wrapperData->constraintSetValuesLeafCount)) ==0)
2343 cwc->constraint_class.set_values =
2344 wrapperData->constraintSetValuesLeaf;
2345 #ifdef FIX_1392
2346 }
2347 #endif
2348 }
2349 else {
2350 int depthDiff = leafDepth - depth;
2351
2352 for ( ; depthDiff;
2353 depthDiff--, cwc = (ConstraintWidgetClass)
2354 cwc->core_class.superclass)
2355 {};
2356
2357 wrapperData = GetWrapperData((WidgetClass) cwc);
2358 setvalues_proc = wrapperData->constraintSetValuesLeaf;
2359 }
2360
2361 _XmProcessUnlock();
2362
2363 if (setvalues_proc)
2364 returnVal |= (*setvalues_proc)
2365 (current, req, new_w, args, num_args);
2366 if (post_proc)
2367 returnVal |= (*post_proc)
2368 (current, req, new_w, args, num_args);
2369
2370 return returnVal;
2371 }
2372
2373 static Boolean
SetValuesLeafWrapper0(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2374 SetValuesLeafWrapper0(
2375 Widget current, Widget req, Widget new_w, ArgList args,
2376 Cardinal *num_args )
2377 {
2378 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 0);
2379 }
2380 static Boolean
SetValuesLeafWrapper1(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2381 SetValuesLeafWrapper1(
2382 Widget current, Widget req, Widget new_w, ArgList args,
2383 Cardinal *num_args)
2384 {
2385 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 1);
2386 }
2387 static Boolean
SetValuesLeafWrapper2(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2388 SetValuesLeafWrapper2(
2389 Widget current, Widget req, Widget new_w, ArgList args,
2390 Cardinal *num_args)
2391 {
2392 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 2);
2393 }
2394 static Boolean
SetValuesLeafWrapper3(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2395 SetValuesLeafWrapper3(
2396 Widget current, Widget req, Widget new_w, ArgList args,
2397 Cardinal *num_args)
2398 {
2399 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 3);
2400 }
2401 static Boolean
SetValuesLeafWrapper4(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2402 SetValuesLeafWrapper4(
2403 Widget current, Widget req, Widget new_w, ArgList args,
2404 Cardinal *num_args)
2405 {
2406 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 4);
2407 }
2408 static Boolean
SetValuesLeafWrapper5(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2409 SetValuesLeafWrapper5(
2410 Widget current, Widget req, Widget new_w, ArgList args,
2411 Cardinal *num_args)
2412 {
2413 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 5);
2414 }
2415 static Boolean
SetValuesLeafWrapper6(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2416 SetValuesLeafWrapper6(
2417 Widget current, Widget req, Widget new_w, ArgList args,
2418 Cardinal *num_args)
2419 {
2420 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 6);
2421 }
2422 static Boolean
SetValuesLeafWrapper7(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2423 SetValuesLeafWrapper7(
2424 Widget current, Widget req, Widget new_w, ArgList args,
2425 Cardinal *num_args)
2426 {
2427 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 7);
2428 }
2429 static Boolean
SetValuesLeafWrapper8(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2430 SetValuesLeafWrapper8(
2431 Widget current, Widget req, Widget new_w, ArgList args,
2432 Cardinal *num_args)
2433 {
2434 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 8);
2435 }
2436 static Boolean
SetValuesLeafWrapper9(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2437 SetValuesLeafWrapper9(
2438 Widget current, Widget req, Widget new_w, ArgList args,
2439 Cardinal *num_args)
2440 {
2441 return SetValuesLeafWrapper(current, req, new_w, args, num_args, 9);
2442 }
2443
2444 static Boolean
CSetValuesLeafWrapper0(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2445 CSetValuesLeafWrapper0(
2446 Widget current, Widget req, Widget new_w, ArgList args,
2447 Cardinal *num_args)
2448 {
2449 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 0);
2450 }
2451 static Boolean
CSetValuesLeafWrapper1(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2452 CSetValuesLeafWrapper1(
2453 Widget current, Widget req, Widget new_w, ArgList args,
2454 Cardinal *num_args)
2455 {
2456 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 1);
2457 }
2458 static Boolean
CSetValuesLeafWrapper2(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2459 CSetValuesLeafWrapper2(
2460 Widget current, Widget req, Widget new_w, ArgList args,
2461 Cardinal *num_args)
2462 {
2463 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 2);
2464 }
2465 static Boolean
CSetValuesLeafWrapper3(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2466 CSetValuesLeafWrapper3(
2467 Widget current, Widget req, Widget new_w, ArgList args,
2468 Cardinal *num_args)
2469 {
2470 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 3);
2471 }
2472 static Boolean
CSetValuesLeafWrapper4(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2473 CSetValuesLeafWrapper4(
2474 Widget current, Widget req, Widget new_w, ArgList args,
2475 Cardinal *num_args)
2476 {
2477 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 4);
2478 }
2479 static Boolean
CSetValuesLeafWrapper5(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2480 CSetValuesLeafWrapper5(
2481 Widget current, Widget req, Widget new_w, ArgList args,
2482 Cardinal *num_args)
2483 {
2484 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 5);
2485 }
2486 static Boolean
CSetValuesLeafWrapper6(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2487 CSetValuesLeafWrapper6(
2488 Widget current, Widget req, Widget new_w, ArgList args,
2489 Cardinal *num_args)
2490 {
2491 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 6);
2492 }
2493 static Boolean
CSetValuesLeafWrapper7(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2494 CSetValuesLeafWrapper7(
2495 Widget current, Widget req, Widget new_w, ArgList args,
2496 Cardinal *num_args)
2497 {
2498 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 7);
2499 }
2500 static Boolean
CSetValuesLeafWrapper8(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2501 CSetValuesLeafWrapper8(
2502 Widget current, Widget req, Widget new_w, ArgList args,
2503 Cardinal *num_args)
2504 {
2505 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 8);
2506 }
2507 static Boolean
CSetValuesLeafWrapper9(Widget current,Widget req,Widget new_w,ArgList args,Cardinal * num_args)2508 CSetValuesLeafWrapper9(
2509 Widget current, Widget req, Widget new_w, ArgList args,
2510 Cardinal *num_args)
2511 {
2512 return CSetValuesLeafWrapper(current, req, new_w, args, num_args, 9);
2513 }
2514
2515 static XtArgsProc GetValuesLeafWrappers[] = {
2516 GetValuesLeafWrapper0,
2517 GetValuesLeafWrapper1,
2518 GetValuesLeafWrapper2,
2519 GetValuesLeafWrapper3,
2520 GetValuesLeafWrapper4,
2521 GetValuesLeafWrapper5,
2522 GetValuesLeafWrapper6,
2523 GetValuesLeafWrapper7,
2524 GetValuesLeafWrapper8,
2525 GetValuesLeafWrapper9
2526 };
2527
2528 /*
2529 * This function replaces the objectClass get_values slot and is
2530 * called at the start of every XtGetValues invocation.
2531 */
2532 static void
GetValuesRootWrapper(Widget new_w,ArgList args,Cardinal * num_args)2533 GetValuesRootWrapper(
2534 Widget new_w,
2535 ArgList args,
2536 Cardinal *num_args)
2537 {
2538 WidgetClass wc = XtClass(new_w);
2539 XmBaseClassExt *wcePtr;
2540
2541 wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2542
2543 if (wcePtr && *wcePtr) {
2544
2545 if ((*wcePtr)->getValuesPrehook)
2546 (*((*wcePtr)->getValuesPrehook))(new_w, args, num_args);
2547
2548 if ((*wcePtr)->getValuesPosthook) {
2549 XmWrapperData wrapperData;
2550
2551 _XmProcessLock();
2552
2553 wrapperData = GetWrapperData(wc);
2554 if (wrapperData->getValuesLeafCount == 0) {
2555 wrapperData->getValuesLeaf =
2556 wc->core_class.get_values_hook;
2557 wc->core_class.get_values_hook =
2558 GetValuesLeafWrappers[GetDepth(wc)];
2559 }
2560 (wrapperData->getValuesLeafCount)++;
2561
2562 _XmProcessUnlock();
2563 }
2564 }
2565 if (objectClassWrapper.getValues)
2566 (*objectClassWrapper.getValues) (new_w, args, num_args);
2567 }
2568
2569 static void
GetValuesLeafWrapper(Widget new_w,ArgList args,Cardinal * num_args,int depth)2570 GetValuesLeafWrapper(
2571 Widget new_w,
2572 ArgList args,
2573 Cardinal *num_args,
2574 int depth)
2575 {
2576 WidgetClass wc = XtClass(new_w);
2577 XtArgsProc getvalues_proc = NULL;
2578 XtArgsProc post_proc = NULL;
2579 int leafDepth = GetDepth(wc);
2580 XmWrapperData wrapperData;
2581
2582 _XmProcessLock();
2583
2584 if (leafDepth == depth) { /* Correct depth */
2585 XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2586
2587 wrapperData = GetWrapperData(wc);
2588 getvalues_proc = wrapperData->getValuesLeaf;
2589 post_proc = ((*wcePtr)->getValuesPosthook);
2590
2591 #ifdef FIX_1392
2592 if (post_proc) {
2593 #endif
2594 if ((--(wrapperData->getValuesLeafCount)) == 0)
2595 wc->core_class.get_values_hook =
2596 wrapperData->getValuesLeaf;
2597 #ifdef FIX_1392
2598 }
2599 #endif
2600 }
2601 else {
2602 int depthDiff = leafDepth - depth;
2603
2604 for ( ; depthDiff;
2605 depthDiff--, wc = wc->core_class.superclass)
2606 {};
2607
2608 wrapperData = GetWrapperData(wc);
2609 getvalues_proc = wrapperData->getValuesLeaf;
2610 }
2611
2612 _XmProcessUnlock();
2613
2614 if (getvalues_proc)
2615 (*getvalues_proc)(new_w, args, num_args);
2616 if (post_proc)
2617 (*post_proc)(new_w, args, num_args);
2618 }
2619
2620 static void
GetValuesLeafWrapper0(Widget new_w,ArgList args,Cardinal * num_args)2621 GetValuesLeafWrapper0( Widget new_w, ArgList args,Cardinal *num_args)
2622 {
2623 GetValuesLeafWrapper(new_w, args, num_args, 0);
2624 }
2625 static void
GetValuesLeafWrapper1(Widget new_w,ArgList args,Cardinal * num_args)2626 GetValuesLeafWrapper1( Widget new_w, ArgList args,Cardinal *num_args)
2627 {
2628 GetValuesLeafWrapper(new_w, args, num_args, 1);
2629 }
2630 static void
GetValuesLeafWrapper2(Widget new_w,ArgList args,Cardinal * num_args)2631 GetValuesLeafWrapper2( Widget new_w, ArgList args,Cardinal *num_args)
2632 {
2633 GetValuesLeafWrapper(new_w, args, num_args, 2);
2634 }
2635 static void
GetValuesLeafWrapper3(Widget new_w,ArgList args,Cardinal * num_args)2636 GetValuesLeafWrapper3( Widget new_w, ArgList args,Cardinal *num_args)
2637 {
2638 GetValuesLeafWrapper(new_w, args, num_args, 3);
2639 }
2640 static void
GetValuesLeafWrapper4(Widget new_w,ArgList args,Cardinal * num_args)2641 GetValuesLeafWrapper4( Widget new_w, ArgList args,Cardinal *num_args)
2642 {
2643 GetValuesLeafWrapper(new_w, args, num_args, 4);
2644 }
2645 static void
GetValuesLeafWrapper5(Widget new_w,ArgList args,Cardinal * num_args)2646 GetValuesLeafWrapper5( Widget new_w, ArgList args,Cardinal *num_args)
2647 {
2648 GetValuesLeafWrapper(new_w, args, num_args, 5);
2649 }
2650 static void
GetValuesLeafWrapper6(Widget new_w,ArgList args,Cardinal * num_args)2651 GetValuesLeafWrapper6( Widget new_w, ArgList args,Cardinal *num_args)
2652 {
2653 GetValuesLeafWrapper(new_w, args, num_args, 6);
2654 }
2655 static void
GetValuesLeafWrapper7(Widget new_w,ArgList args,Cardinal * num_args)2656 GetValuesLeafWrapper7( Widget new_w, ArgList args,Cardinal *num_args)
2657 {
2658 GetValuesLeafWrapper(new_w, args, num_args, 7);
2659 }
2660 static void
GetValuesLeafWrapper8(Widget new_w,ArgList args,Cardinal * num_args)2661 GetValuesLeafWrapper8( Widget new_w, ArgList args,Cardinal *num_args)
2662 {
2663 GetValuesLeafWrapper(new_w, args, num_args, 8);
2664 }
2665 static void
GetValuesLeafWrapper9(Widget new_w,ArgList args,Cardinal * num_args)2666 GetValuesLeafWrapper9( Widget new_w, ArgList args,Cardinal *num_args)
2667 {
2668 GetValuesLeafWrapper(new_w, args, num_args, 9);
2669 }
2670
2671 static int
GetDepth(WidgetClass wc)2672 GetDepth(WidgetClass wc)
2673 {
2674 int i;
2675
2676 for (i = 0;
2677 wc && wc != rectObjClass;
2678 i++, wc = wc->core_class.superclass) {};
2679
2680 if (wc)
2681 return i;
2682 else
2683 return 0;
2684 }
2685
2686 /*
2687 * These symbols must always be present so applications compiling with
2688 * -DXTHREADS can still link against libraries built without it. How
2689 * those applications recognize non MT-safe libraries is a different
2690 * issue.
2691 */
2692 #ifndef XTHREADS
2693 # undef _XmFastSubclassInit
2694 # undef _XmIsFastSubclass
2695 #endif
2696
2697 void
_XmFastSubclassInit(WidgetClass wc,unsigned int bit)2698 _XmFastSubclassInit(WidgetClass wc, unsigned int bit)
2699 {
2700 XmBaseClassExt *basePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2701
2702 if (basePtr && (*basePtr))
2703 _XmSetFlagsBit(((*basePtr)->flags), bit);
2704 }
2705
2706 Boolean
_XmIsFastSubclass(WidgetClass wc,unsigned int bit)2707 _XmIsFastSubclass(WidgetClass wc, unsigned int bit)
2708 {
2709 XmBaseClassExt *basePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
2710
2711 if (!basePtr || !(*basePtr))
2712 return False;
2713
2714 if (_XmGetFlagsBit(((*basePtr)->flags), bit))
2715 return True;
2716 else
2717 return False;
2718 }
2719
2720