1444c061aSmrg/*
2444c061aSmrg
3fdf6a26fSmrgCopyright (c) 1993, Oracle and/or its affiliates.
41477040fSmrg
51477040fSmrgPermission is hereby granted, free of charge, to any person obtaining a
61477040fSmrgcopy of this software and associated documentation files (the "Software"),
71477040fSmrgto deal in the Software without restriction, including without limitation
81477040fSmrgthe rights to use, copy, modify, merge, publish, distribute, sublicense,
91477040fSmrgand/or sell copies of the Software, and to permit persons to whom the
101477040fSmrgSoftware is furnished to do so, subject to the following conditions:
111477040fSmrg
121477040fSmrgThe above copyright notice and this permission notice (including the next
131477040fSmrgparagraph) shall be included in all copies or substantial portions of the
141477040fSmrgSoftware.
151477040fSmrg
161477040fSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171477040fSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181477040fSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
191477040fSmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
201477040fSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
211477040fSmrgFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
221477040fSmrgDEALINGS IN THE SOFTWARE.
23444c061aSmrg
24444c061aSmrg*/
25444c061aSmrg
26444c061aSmrg/*
27444c061aSmrg
28444c061aSmrgCopyright 1985, 1986, 1987, 1988, 1989, 1994, 1998  The Open Group
29444c061aSmrg
30444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its
31444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that
32444c061aSmrgthe above copyright notice appear in all copies and that both that
33444c061aSmrgcopyright notice and this permission notice appear in supporting
34444c061aSmrgdocumentation.
35444c061aSmrg
36444c061aSmrgThe above copyright notice and this permission notice shall be included in
37444c061aSmrgall copies or substantial portions of the Software.
38444c061aSmrg
39444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
42444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
43444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
44444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45444c061aSmrg
46444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be
47444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings
48444c061aSmrgin this Software without prior written authorization from The Open Group.
49444c061aSmrg
50444c061aSmrg*/
51444c061aSmrg
52444c061aSmrg#ifdef HAVE_CONFIG_H
53444c061aSmrg#include <config.h>
54444c061aSmrg#endif
55444c061aSmrg#include "IntrinsicI.h"
56444c061aSmrg#include <X11/Shell.h>
57444c061aSmrg#include <X11/Vendor.h>
58444c061aSmrg
59444c061aSmrg/*
60444c061aSmrg * This file defines functional equivalents to all macros defined
61444c061aSmrg * in Intrinsic.h
62444c061aSmrg *
63444c061aSmrg */
64444c061aSmrg
65444c061aSmrg#undef XtIsRectObj
66a3bd7f05SmrgBoolean
67a3bd7f05SmrgXtIsRectObj(Widget object)
68444c061aSmrg{
69444c061aSmrg    return _XtCheckSubclassFlag(object, 0x02);
70444c061aSmrg}
71444c061aSmrg
72444c061aSmrg#undef XtIsWidget
73a3bd7f05SmrgBoolean
74a3bd7f05SmrgXtIsWidget(Widget object)
75444c061aSmrg{
76444c061aSmrg    return _XtCheckSubclassFlag(object, 0x04);
77444c061aSmrg}
78444c061aSmrg
79444c061aSmrg#undef XtIsComposite
80a3bd7f05SmrgBoolean
81a3bd7f05SmrgXtIsComposite(Widget object)
82444c061aSmrg{
83444c061aSmrg    return _XtCheckSubclassFlag(object, 0x08);
84444c061aSmrg}
85444c061aSmrg
86444c061aSmrg#undef XtIsConstraint
87a3bd7f05SmrgBoolean
88a3bd7f05SmrgXtIsConstraint(Widget object)
89444c061aSmrg{
90444c061aSmrg    return _XtCheckSubclassFlag(object, 0x10);
91444c061aSmrg}
92444c061aSmrg
93444c061aSmrg#undef XtIsShell
94a3bd7f05SmrgBoolean
95a3bd7f05SmrgXtIsShell(Widget object)
96444c061aSmrg{
97444c061aSmrg    return _XtCheckSubclassFlag(object, 0x20);
98444c061aSmrg}
99444c061aSmrg
100444c061aSmrg#undef XtIsOverrideShell
101a3bd7f05SmrgBoolean
102a3bd7f05SmrgXtIsOverrideShell(Widget object)
103444c061aSmrg{
104a3bd7f05Smrg    return _XtIsSubclassOf(object, (WidgetClass) overrideShellWidgetClass,
105a3bd7f05Smrg                           (WidgetClass) shellWidgetClass, 0x20);
106444c061aSmrg}
107444c061aSmrg
108444c061aSmrg#undef XtIsWMShell
109a3bd7f05SmrgBoolean
110a3bd7f05SmrgXtIsWMShell(Widget object)
111444c061aSmrg{
112444c061aSmrg    return _XtCheckSubclassFlag(object, 0x40);
113444c061aSmrg}
114444c061aSmrg
115444c061aSmrg#undef XtIsVendorShell
116a3bd7f05SmrgBoolean
117a3bd7f05SmrgXtIsVendorShell(Widget object)
118444c061aSmrg{
119444c061aSmrg    Boolean retval;
120444c061aSmrg
121444c061aSmrg    LOCK_PROCESS;
122444c061aSmrg    retval = _XtIsSubclassOf(object,
123444c061aSmrg#ifdef notdef
124444c061aSmrg/*
125444c061aSmrg * We don't refer to vendorShell directly, because some shared libraries
126444c061aSmrg * bind local references tightly.
127444c061aSmrg */
128a3bd7f05Smrg                             (WidgetClass) vendorShellWidgetClass,
129444c061aSmrg#endif
130a3bd7f05Smrg                             transientShellWidgetClass->core_class.superclass,
131a3bd7f05Smrg                             (WidgetClass) wmShellWidgetClass, 0x40);
132444c061aSmrg    UNLOCK_PROCESS;
133444c061aSmrg    return retval;
134444c061aSmrg}
135444c061aSmrg
136444c061aSmrg#undef XtIsTransientShell
137a3bd7f05SmrgBoolean
138a3bd7f05SmrgXtIsTransientShell(Widget object)
139444c061aSmrg{
140a3bd7f05Smrg    return _XtIsSubclassOf(object, (WidgetClass) transientShellWidgetClass,
141a3bd7f05Smrg                           (WidgetClass) wmShellWidgetClass, 0x40);
142444c061aSmrg}
143444c061aSmrg
144444c061aSmrg#undef XtIsTopLevelShell
145a3bd7f05SmrgBoolean
146a3bd7f05SmrgXtIsTopLevelShell(Widget object)
147444c061aSmrg{
148444c061aSmrg    return _XtCheckSubclassFlag(object, 0x80);
149444c061aSmrg}
150444c061aSmrg
151444c061aSmrg#undef XtIsApplicationShell
152a3bd7f05SmrgBoolean
153a3bd7f05SmrgXtIsApplicationShell(Widget object)
154444c061aSmrg{
155a3bd7f05Smrg    return _XtIsSubclassOf(object, (WidgetClass) applicationShellWidgetClass,
156a3bd7f05Smrg                           (WidgetClass) topLevelShellWidgetClass, 0x80);
157444c061aSmrg}
158444c061aSmrg
159444c061aSmrg#undef XtIsSessionShell
160a3bd7f05SmrgBoolean
161a3bd7f05SmrgXtIsSessionShell(Widget object)
162444c061aSmrg{
163a3bd7f05Smrg    return _XtIsSubclassOf(object, (WidgetClass) sessionShellWidgetClass,
164a3bd7f05Smrg                           (WidgetClass) topLevelShellWidgetClass, 0x80);
165444c061aSmrg}
166444c061aSmrg
167444c061aSmrg#undef XtMapWidget
168a3bd7f05Smrgvoid
169a3bd7f05SmrgXtMapWidget(Widget w)
170444c061aSmrg{
171444c061aSmrg    Widget hookobj;
172a3bd7f05Smrg
173444c061aSmrg    WIDGET_TO_APPCON(w);
174444c061aSmrg
175444c061aSmrg    LOCK_APP(app);
176444c061aSmrg    XMapWindow(XtDisplay(w), XtWindow(w));
177444c061aSmrg    hookobj = XtHooksOfDisplay(XtDisplay(w));
178444c061aSmrg    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
179a3bd7f05Smrg        XtChangeHookDataRec call_data;
180444c061aSmrg
181a3bd7f05Smrg        call_data.type = XtHmapWidget;
182a3bd7f05Smrg        call_data.widget = w;
183a3bd7f05Smrg        XtCallCallbackList(hookobj,
184a3bd7f05Smrg                           ((HookObject) hookobj)->hooks.changehook_callbacks,
185a3bd7f05Smrg                           (XtPointer) &call_data);
186444c061aSmrg    }
187444c061aSmrg    UNLOCK_APP(app);
188444c061aSmrg}
189444c061aSmrg
190444c061aSmrg#undef XtUnmapWidget
191a3bd7f05Smrgvoid
192a3bd7f05SmrgXtUnmapWidget(Widget w)
193444c061aSmrg{
194444c061aSmrg    Widget hookobj;
195a3bd7f05Smrg
196444c061aSmrg    WIDGET_TO_APPCON(w);
197444c061aSmrg
198444c061aSmrg    LOCK_APP(app);
199444c061aSmrg    XUnmapWindow(XtDisplay(w), XtWindow(w));
200444c061aSmrg    hookobj = XtHooksOfDisplay(XtDisplay(w));
201444c061aSmrg    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
202a3bd7f05Smrg        XtChangeHookDataRec call_data;
203444c061aSmrg
204a3bd7f05Smrg        call_data.type = XtHunmapWidget;
205a3bd7f05Smrg        call_data.widget = w;
206a3bd7f05Smrg        XtCallCallbackList(hookobj,
207a3bd7f05Smrg                           ((HookObject) hookobj)->hooks.changehook_callbacks,
208a3bd7f05Smrg                           (XtPointer) &call_data);
209444c061aSmrg    }
210444c061aSmrg    UNLOCK_APP(app);
211444c061aSmrg}
212444c061aSmrg
213444c061aSmrg#undef XtNewString
214a3bd7f05SmrgString
215a3bd7f05SmrgXtNewString(String str)
216444c061aSmrg{
217444c061aSmrg    if (str == NULL)
218a3bd7f05Smrg        return NULL;
2190568f49bSmrg
2200568f49bSmrg    return strdup(str);
221444c061aSmrg}
222