1/* 2 3Copyright (c) 1993, Oracle and/or its affiliates. 4 5Permission is hereby granted, free of charge, to any person obtaining a 6copy of this software and associated documentation files (the "Software"), 7to deal in the Software without restriction, including without limitation 8the rights to use, copy, modify, merge, publish, distribute, sublicense, 9and/or sell copies of the Software, and to permit persons to whom the 10Software is furnished to do so, subject to the following conditions: 11 12The above copyright notice and this permission notice (including the next 13paragraph) shall be included in all copies or substantial portions of the 14Software. 15 16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22DEALINGS IN THE SOFTWARE. 23 24*/ 25 26/* 27 28Copyright 1985, 1986, 1987, 1988, 1989, 1994, 1998 The Open Group 29 30Permission to use, copy, modify, distribute, and sell this software and its 31documentation for any purpose is hereby granted without fee, provided that 32the above copyright notice appear in all copies and that both that 33copyright notice and this permission notice appear in supporting 34documentation. 35 36The above copyright notice and this permission notice shall be included in 37all copies or substantial portions of the Software. 38 39THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 41FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 42OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 43AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 44CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 45 46Except as contained in this notice, the name of The Open Group shall not be 47used in advertising or otherwise to promote the sale, use or other dealings 48in this Software without prior written authorization from The Open Group. 49 50*/ 51 52#ifdef HAVE_CONFIG_H 53#include <config.h> 54#endif 55#include "IntrinsicI.h" 56#include <X11/Shell.h> 57#include <X11/Vendor.h> 58 59/* 60 * This file defines functional equivalents to all macros defined 61 * in Intrinsic.h 62 * 63 */ 64 65#undef XtIsRectObj 66Boolean 67XtIsRectObj(Widget object) 68{ 69 return _XtCheckSubclassFlag(object, 0x02); 70} 71 72#undef XtIsWidget 73Boolean 74XtIsWidget(Widget object) 75{ 76 return _XtCheckSubclassFlag(object, 0x04); 77} 78 79#undef XtIsComposite 80Boolean 81XtIsComposite(Widget object) 82{ 83 return _XtCheckSubclassFlag(object, 0x08); 84} 85 86#undef XtIsConstraint 87Boolean 88XtIsConstraint(Widget object) 89{ 90 return _XtCheckSubclassFlag(object, 0x10); 91} 92 93#undef XtIsShell 94Boolean 95XtIsShell(Widget object) 96{ 97 return _XtCheckSubclassFlag(object, 0x20); 98} 99 100#undef XtIsOverrideShell 101Boolean 102XtIsOverrideShell(Widget object) 103{ 104 return _XtIsSubclassOf(object, (WidgetClass) overrideShellWidgetClass, 105 (WidgetClass) shellWidgetClass, 0x20); 106} 107 108#undef XtIsWMShell 109Boolean 110XtIsWMShell(Widget object) 111{ 112 return _XtCheckSubclassFlag(object, 0x40); 113} 114 115#undef XtIsVendorShell 116Boolean 117XtIsVendorShell(Widget object) 118{ 119 Boolean retval; 120 121 LOCK_PROCESS; 122 retval = _XtIsSubclassOf(object, 123#ifdef notdef 124/* 125 * We don't refer to vendorShell directly, because some shared libraries 126 * bind local references tightly. 127 */ 128 (WidgetClass) vendorShellWidgetClass, 129#endif 130 transientShellWidgetClass->core_class.superclass, 131 (WidgetClass) wmShellWidgetClass, 0x40); 132 UNLOCK_PROCESS; 133 return retval; 134} 135 136#undef XtIsTransientShell 137Boolean 138XtIsTransientShell(Widget object) 139{ 140 return _XtIsSubclassOf(object, (WidgetClass) transientShellWidgetClass, 141 (WidgetClass) wmShellWidgetClass, 0x40); 142} 143 144#undef XtIsTopLevelShell 145Boolean 146XtIsTopLevelShell(Widget object) 147{ 148 return _XtCheckSubclassFlag(object, 0x80); 149} 150 151#undef XtIsApplicationShell 152Boolean 153XtIsApplicationShell(Widget object) 154{ 155 return _XtIsSubclassOf(object, (WidgetClass) applicationShellWidgetClass, 156 (WidgetClass) topLevelShellWidgetClass, 0x80); 157} 158 159#undef XtIsSessionShell 160Boolean 161XtIsSessionShell(Widget object) 162{ 163 return _XtIsSubclassOf(object, (WidgetClass) sessionShellWidgetClass, 164 (WidgetClass) topLevelShellWidgetClass, 0x80); 165} 166 167#undef XtMapWidget 168void 169XtMapWidget(Widget w) 170{ 171 Widget hookobj; 172 173 WIDGET_TO_APPCON(w); 174 175 LOCK_APP(app); 176 XMapWindow(XtDisplay(w), XtWindow(w)); 177 hookobj = XtHooksOfDisplay(XtDisplay(w)); 178 if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { 179 XtChangeHookDataRec call_data; 180 181 call_data.type = XtHmapWidget; 182 call_data.widget = w; 183 XtCallCallbackList(hookobj, 184 ((HookObject) hookobj)->hooks.changehook_callbacks, 185 (XtPointer) &call_data); 186 } 187 UNLOCK_APP(app); 188} 189 190#undef XtUnmapWidget 191void 192XtUnmapWidget(Widget w) 193{ 194 Widget hookobj; 195 196 WIDGET_TO_APPCON(w); 197 198 LOCK_APP(app); 199 XUnmapWindow(XtDisplay(w), XtWindow(w)); 200 hookobj = XtHooksOfDisplay(XtDisplay(w)); 201 if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { 202 XtChangeHookDataRec call_data; 203 204 call_data.type = XtHunmapWidget; 205 call_data.widget = w; 206 XtCallCallbackList(hookobj, 207 ((HookObject) hookobj)->hooks.changehook_callbacks, 208 (XtPointer) &call_data); 209 } 210 UNLOCK_APP(app); 211} 212 213#undef XtNewString 214String 215XtNewString(String str) 216{ 217 if (str == NULL) 218 return NULL; 219 220 return strdup(str); 221} 222