Functions.c revision 249c3046
11.7Smrg/* 21.1Sfvdl 31.1SfvdlCopyright (c) 1993, Oracle and/or its affiliates. All rights reserved. 41.1Sfvdl 51.1SfvdlPermission is hereby granted, free of charge, to any person obtaining a 61.1Sfvdlcopy of this software and associated documentation files (the "Software"), 71.1Sfvdlto deal in the Software without restriction, including without limitation 81.1Sfvdlthe rights to use, copy, modify, merge, publish, distribute, sublicense, 91.1Sfvdland/or sell copies of the Software, and to permit persons to whom the 101.1SfvdlSoftware is furnished to do so, subject to the following conditions: 111.1Sfvdl 121.1SfvdlThe above copyright notice and this permission notice (including the next 131.1Sfvdlparagraph) shall be included in all copies or substantial portions of the 141.1SfvdlSoftware. 151.1Sfvdl 161.1SfvdlTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 171.1SfvdlIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 181.1SfvdlFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 191.1SfvdlTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 201.1SfvdlLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 211.1SfvdlFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 221.1SfvdlDEALINGS IN THE SOFTWARE. 231.1Sfvdl 241.1Sfvdl*/ 251.1Sfvdl 261.1Sfvdl/* 271.1Sfvdl 281.1SfvdlCopyright 1985, 1986, 1987, 1988, 1989, 1994, 1998 The Open Group 291.1Sfvdl 301.1SfvdlPermission to use, copy, modify, distribute, and sell this software and its 311.1Sfvdldocumentation for any purpose is hereby granted without fee, provided that 321.1Sfvdlthe above copyright notice appear in all copies and that both that 331.7Smrgcopyright notice and this permission notice appear in supporting 341.7Smrgdocumentation. 351.7Smrg 361.7SmrgThe above copyright notice and this permission notice shall be included in 371.1Sfvdlall copies or substantial portions of the Software. 381.1Sfvdl 391.1SfvdlTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 401.1SfvdlIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 411.1SfvdlFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 421.1SfvdlOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 431.1SfvdlAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 441.1SfvdlCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 451.1Sfvdl 461.1SfvdlExcept as contained in this notice, the name of The Open Group shall not be 471.1Sfvdlused in advertising or otherwise to promote the sale, use or other dealings 481.1Sfvdlin this Software without prior written authorization from The Open Group. 491.5Sdyoung 501.5Sdyoung*/ 511.5Sdyoung 521.4Slukem#ifdef HAVE_CONFIG_H 531.5Sdyoung#include <config.h> 541.1Sfvdl#endif 551.1Sfvdl#include "IntrinsicI.h" 561.5Sdyoung#include <X11/Shell.h> 571.5Sdyoung#include <X11/Vendor.h> 581.5Sdyoung 591.1Sfvdl/* 601.5Sdyoung * This file defines functional equivalents to all macros defined 611.1Sfvdl * in Intrinsic.h 621.1Sfvdl * 631.1Sfvdl */ 641.1Sfvdl 651.1Sfvdl#undef XtIsRectObj 661.7SmrgBoolean XtIsRectObj(Widget object) 671.7Smrg{ 681.7Smrg return _XtCheckSubclassFlag(object, 0x02); 691.7Smrg} 701.7Smrg 711.7Smrg 721.7Smrg#undef XtIsWidget 73Boolean XtIsWidget(Widget object) 74{ 75 return _XtCheckSubclassFlag(object, 0x04); 76} 77 78 79#undef XtIsComposite 80Boolean XtIsComposite(Widget object) 81{ 82 return _XtCheckSubclassFlag(object, 0x08); 83} 84 85 86#undef XtIsConstraint 87Boolean XtIsConstraint(Widget object) 88{ 89 return _XtCheckSubclassFlag(object, 0x10); 90} 91 92 93#undef XtIsShell 94Boolean XtIsShell(Widget object) 95{ 96 return _XtCheckSubclassFlag(object, 0x20); 97} 98 99 100#undef XtIsOverrideShell 101Boolean XtIsOverrideShell(Widget object) 102{ 103 return _XtIsSubclassOf(object, (WidgetClass)overrideShellWidgetClass, 104 (WidgetClass)shellWidgetClass, 0x20); 105} 106 107 108#undef XtIsWMShell 109Boolean XtIsWMShell(Widget object) 110{ 111 return _XtCheckSubclassFlag(object, 0x40); 112} 113 114 115#undef XtIsVendorShell 116Boolean XtIsVendorShell(Widget object) 117{ 118 Boolean retval; 119 120 LOCK_PROCESS; 121 retval = _XtIsSubclassOf(object, 122#ifdef notdef 123/* 124 * We don't refer to vendorShell directly, because some shared libraries 125 * bind local references tightly. 126 */ 127 (WidgetClass)vendorShellWidgetClass, 128#endif 129 transientShellWidgetClass->core_class.superclass, 130 (WidgetClass)wmShellWidgetClass, 0x40); 131 UNLOCK_PROCESS; 132 return retval; 133} 134 135 136#undef XtIsTransientShell 137Boolean XtIsTransientShell(Widget object) 138{ 139 return _XtIsSubclassOf(object, (WidgetClass)transientShellWidgetClass, 140 (WidgetClass)wmShellWidgetClass, 0x40); 141} 142 143 144#undef XtIsTopLevelShell 145Boolean XtIsTopLevelShell(Widget object) 146{ 147 return _XtCheckSubclassFlag(object, 0x80); 148} 149 150 151#undef XtIsApplicationShell 152Boolean XtIsApplicationShell(Widget object) 153{ 154 return _XtIsSubclassOf(object, (WidgetClass)applicationShellWidgetClass, 155 (WidgetClass)topLevelShellWidgetClass, 0x80); 156} 157 158#undef XtIsSessionShell 159Boolean XtIsSessionShell(Widget object) 160{ 161 return _XtIsSubclassOf(object, (WidgetClass)sessionShellWidgetClass, 162 (WidgetClass)topLevelShellWidgetClass, 0x80); 163} 164 165#undef XtMapWidget 166void XtMapWidget(Widget w) 167{ 168 Widget hookobj; 169 WIDGET_TO_APPCON(w); 170 171 LOCK_APP(app); 172 XMapWindow(XtDisplay(w), XtWindow(w)); 173 hookobj = XtHooksOfDisplay(XtDisplay(w)); 174 if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { 175 XtChangeHookDataRec call_data; 176 177 call_data.type = XtHmapWidget; 178 call_data.widget = w; 179 XtCallCallbackList(hookobj, 180 ((HookObject)hookobj)->hooks.changehook_callbacks, 181 (XtPointer)&call_data); 182 } 183 UNLOCK_APP(app); 184} 185 186 187#undef XtUnmapWidget 188void XtUnmapWidget(Widget w) 189{ 190 Widget hookobj; 191 WIDGET_TO_APPCON(w); 192 193 LOCK_APP(app); 194 XUnmapWindow(XtDisplay(w), XtWindow(w)); 195 hookobj = XtHooksOfDisplay(XtDisplay(w)); 196 if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { 197 XtChangeHookDataRec call_data; 198 199 call_data.type = XtHunmapWidget; 200 call_data.widget = w; 201 XtCallCallbackList(hookobj, 202 ((HookObject)hookobj)->hooks.changehook_callbacks, 203 (XtPointer)&call_data); 204 } 205 UNLOCK_APP(app); 206} 207 208 209#undef XtNewString 210String XtNewString(String str) 211{ 212 if (str == NULL) 213 return NULL; 214 else 215 return strcpy(__XtMalloc((unsigned)strlen(str) + 1), str); 216} 217