17a84e134Smrg/*********************************************************** 27a84e134Smrg 37a84e134SmrgCopyright 1987, 1988, 1994, 1998 The Open Group 47a84e134Smrg 57a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its 67a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that 77a84e134Smrgthe above copyright notice appear in all copies and that both that 87a84e134Smrgcopyright notice and this permission notice appear in supporting 97a84e134Smrgdocumentation. 107a84e134Smrg 117a84e134SmrgThe above copyright notice and this permission notice shall be included in 127a84e134Smrgall copies or substantial portions of the Software. 137a84e134Smrg 147a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 177a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 187a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 197a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 207a84e134Smrg 217a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be 227a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings 237a84e134Smrgin this Software without prior written authorization from The Open Group. 247a84e134Smrg 257a84e134Smrg 267a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 277a84e134Smrg 287a84e134Smrg All Rights Reserved 297a84e134Smrg 30421c997bSmrgPermission to use, copy, modify, and distribute this software and its 31421c997bSmrgdocumentation for any purpose and without fee is hereby granted, 327a84e134Smrgprovided that the above copyright notice appear in all copies and that 33421c997bSmrgboth that copyright notice and this permission notice appear in 347a84e134Smrgsupporting documentation, and that the name of Digital not be 357a84e134Smrgused in advertising or publicity pertaining to distribution of the 36421c997bSmrgsoftware without specific, written prior permission. 377a84e134Smrg 387a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 397a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 407a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 417a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 427a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 437a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 447a84e134SmrgSOFTWARE. 457a84e134Smrg 467a84e134Smrg******************************************************************/ 477a84e134Smrg 487a84e134Smrg/* 497a84e134Smrg * This is a copy of Xt/Vendor.c with an additional ClassInitialize 507a84e134Smrg * procedure to register Xmu resource type converters, and all the 517a84e134Smrg * monkey business associated with input methods... 527a84e134Smrg * 537a84e134Smrg */ 547a84e134Smrg 557a84e134Smrg/* Make sure all wm properties can make it out of the resource manager */ 567a84e134Smrg 577a84e134Smrg#ifdef HAVE_CONFIG_H 587a84e134Smrg#include <config.h> 597a84e134Smrg#endif 607a84e134Smrg#include <stdio.h> 617a84e134Smrg#include <X11/IntrinsicP.h> 627a84e134Smrg#include <X11/StringDefs.h> 637a84e134Smrg#include <X11/ShellP.h> 647a84e134Smrg#include <X11/VendorP.h> 657a84e134Smrg#include <X11/Xmu/Converters.h> 667a84e134Smrg#include <X11/Xmu/Atoms.h> 677a84e134Smrg#include <X11/Xmu/Editres.h> 687a84e134Smrg#include <X11/Xmu/ExtAgent.h> 697a84e134Smrg 707a84e134Smrg/* The following two headers are for the input method. */ 717a84e134Smrg 727a84e134Smrg#include <X11/Xaw/VendorEP.h> 737a84e134Smrg#include <X11/Xaw/XawImP.h> 747a84e134Smrg 757a84e134Smrg/* 767a84e134Smrg * Class Methods 777a84e134Smrg */ 787a84e134Smrgstatic void XawVendorShellChangeManaged(Widget); 797a84e134Smrgstatic Boolean XawCvtCompoundTextToString(Display*, XrmValuePtr, Cardinal*, 807a84e134Smrg XrmValue*, XrmValue*, XtPointer*); 817a84e134Smrgstatic void XawVendorShellClassInitialize(void); 827a84e134Smrgstatic XtGeometryResult XawVendorShellGeometryManager(Widget, 837a84e134Smrg XtWidgetGeometry*, 847a84e134Smrg XtWidgetGeometry*); 857a84e134Smrgstatic void XawVendorShellExtClassInitialize(void); 867a84e134Smrgstatic void XawVendorShellExtDestroy(Widget); 877a84e134Smrgstatic void XawVendorShellExtInitialize(Widget, Widget, ArgList, Cardinal*); 887a84e134Smrgvoid XawVendorShellExtResize(Widget); 897a84e134Smrgstatic Boolean XawVendorShellExtSetValues(Widget, Widget, Widget, 907a84e134Smrg ArgList, Cardinal*); 917a84e134Smrgstatic void XawVendorShellClassPartInit(WidgetClass); 927a84e134Smrgstatic void XawVendorShellInitialize(Widget, Widget, ArgList, Cardinal*); 937a84e134Smrgstatic void XawVendorShellRealize(Widget, Mask*, XSetWindowAttributes*); 947a84e134Smrgstatic Boolean XawVendorShellSetValues(Widget, Widget, Widget, 957a84e134Smrg ArgList, Cardinal*); 967a84e134Smrg 977a84e134Smrg/* 987a84e134Smrg * External 997a84e134Smrg */ 1007a84e134Smrgvoid XawVendorStructureNotifyHandler(Widget, XtPointer, XEvent*, Boolean*); 1017a84e134Smrg 1027a84e134Smrgstatic XtResource resources[] = { 1037a84e134Smrg {XtNinput, XtCInput, XtRBool, sizeof(Bool), 1047a84e134Smrg XtOffsetOf(VendorShellRec, wm.wm_hints.input), 1057a84e134Smrg XtRImmediate, (XtPointer)True} 1067a84e134Smrg}; 1077a84e134Smrg 1087a84e134Smrg/*************************************************************************** 1097a84e134Smrg * 1107a84e134Smrg * Vendor shell class record 1117a84e134Smrg * 1127a84e134Smrg ***************************************************************************/ 1137a84e134Smrg 1145ec34c4cSmrg#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) 1157a84e134Smrg/* to fix the EditRes problem because of wrong linker semantics */ 1167a84e134Smrgextern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */ 1177a84e134Smrgextern VendorShellClassRec _XawVendorShellClassRec; 1187a84e134Smrgextern void _XawFixupVendorShell(); 1197a84e134Smrg 1205ec34c4cSmrg#if defined(__APPLE__) 1215ec34c4cSmrg__attribute__((constructor)) 1225ec34c4cSmrgstatic void __VendorShellHack(void) 1235ec34c4cSmrg{ 1245ec34c4cSmrg vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec); 1255ec34c4cSmrg _XawFixupVendorShell(); 1265ec34c4cSmrg} 1275ec34c4cSmrg#else 1287a84e134Smrgint __stdcall 1297a84e134SmrgDllMain(unsigned long mod_handle, unsigned long flag, void *routine) 1307a84e134Smrg{ 1317a84e134Smrg switch (flag) 1327a84e134Smrg { 1337a84e134Smrg case 1: /* DLL_PROCESS_ATTACH - process attach */ 1347a84e134Smrg vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec); 1357a84e134Smrg _XawFixupVendorShell(); 1367a84e134Smrg break; 1377a84e134Smrg case 0: /* DLL_PROCESS_DETACH - process detach */ 1387a84e134Smrg break; 1397a84e134Smrg } 1407a84e134Smrg return 1; 1417a84e134Smrg} 1425ec34c4cSmrg#endif 1437a84e134Smrg 1447a84e134Smrg#define vendorShellClassRec _XawVendorShellClassRec 1457a84e134Smrg 1467a84e134Smrg#endif 1477a84e134Smrg 1487a84e134Smrgstatic CompositeClassExtensionRec vendorCompositeExt = { 1497a84e134Smrg /* next_extension */ NULL, 1507a84e134Smrg /* record_type */ NULLQUARK, 1517a84e134Smrg /* version */ XtCompositeExtensionVersion, 1527a84e134Smrg /* record_size */ sizeof (CompositeClassExtensionRec), 1537a84e134Smrg /* accepts_objects */ TRUE, 1547a84e134Smrg /* allows_change_managed_set */ FALSE 1557a84e134Smrg}; 1567a84e134Smrg 1577a84e134Smrg#define SuperClass (&wmShellClassRec) 1587a84e134Smrgexternaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { 1597a84e134Smrg { 1607a84e134Smrg /* superclass */ (WidgetClass)SuperClass, 1617a84e134Smrg /* class_name */ "VendorShell", 1627a84e134Smrg /* size */ sizeof(VendorShellRec), 1637a84e134Smrg /* class_initialize */ XawVendorShellClassInitialize, 1647a84e134Smrg /* class_part_init */ XawVendorShellClassPartInit, 1657a84e134Smrg /* Class init'ed ? */ FALSE, 1667a84e134Smrg /* initialize */ XawVendorShellInitialize, 167421c997bSmrg /* initialize_hook */ NULL, 1687a84e134Smrg /* realize */ XawVendorShellRealize, 1697a84e134Smrg /* actions */ NULL, 1707a84e134Smrg /* num_actions */ 0, 1717a84e134Smrg /* resources */ resources, 1727a84e134Smrg /* resource_count */ XtNumber(resources), 1737a84e134Smrg /* xrm_class */ NULLQUARK, 1747a84e134Smrg /* compress_motion */ FALSE, 1757a84e134Smrg /* compress_exposure */ TRUE, 1767a84e134Smrg /* compress_enterleave*/ FALSE, 1777a84e134Smrg /* visible_interest */ FALSE, 1787a84e134Smrg /* destroy */ NULL, 1797a84e134Smrg /* resize */ XawVendorShellExtResize, 1807a84e134Smrg /* expose */ NULL, 1817a84e134Smrg /* set_values */ XawVendorShellSetValues, 182421c997bSmrg /* set_values_hook */ NULL, 183421c997bSmrg /* set_values_almost */ XtInheritSetValuesAlmost, 1847a84e134Smrg /* get_values_hook */ NULL, 1857a84e134Smrg /* accept_focus */ NULL, 1867a84e134Smrg /* intrinsics version */ XtVersion, 1877a84e134Smrg /* callback offsets */ NULL, 1887a84e134Smrg /* tm_table */ NULL, 1897a84e134Smrg /* query_geometry */ NULL, 1907a84e134Smrg /* display_accelerator*/ NULL, 1917a84e134Smrg /* extension */ NULL 1927a84e134Smrg },{ 1937a84e134Smrg /* geometry_manager */ XawVendorShellGeometryManager, 1947a84e134Smrg /* change_managed */ XawVendorShellChangeManaged, 1957a84e134Smrg /* insert_child */ XtInheritInsertChild, 1967a84e134Smrg /* delete_child */ XtInheritDeleteChild, 1977a84e134Smrg /* extension */ (XtPointer) &vendorCompositeExt 1987a84e134Smrg },{ 1997a84e134Smrg /* extension */ NULL 2007a84e134Smrg },{ 2017a84e134Smrg /* extension */ NULL 2027a84e134Smrg },{ 2037a84e134Smrg /* extension */ NULL 2047a84e134Smrg } 2057a84e134Smrg}; 2067a84e134Smrg 207efbcb2bfSmrg#if !defined(__APPLE__) 2087a84e134Smrgexternaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = 2097a84e134Smrg (WidgetClass) (&vendorShellClassRec); 2107a84e134Smrg#endif 2117a84e134Smrg 2127a84e134Smrg/*************************************************************************** 2137a84e134Smrg * 2147a84e134Smrg * The following section is for the Vendor shell Extension class record 2157a84e134Smrg * 2167a84e134Smrg ***************************************************************************/ 2177a84e134Smrg 2187a84e134Smrgstatic XtResource ext_resources[] = { 2197a84e134Smrg {XtNinputMethod, XtCInputMethod, XtRString, sizeof(String), 2207a84e134Smrg XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.input_method), 2217a84e134Smrg XtRString, (XtPointer)NULL}, 2227a84e134Smrg {XtNpreeditType, XtCPreeditType, XtRString, sizeof(String), 2237a84e134Smrg XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.preedit_type), 2247a84e134Smrg XtRString, (XtPointer)"OverTheSpot,OffTheSpot,Root"}, 2257a84e134Smrg {XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean), 2267a84e134Smrg XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.open_im), 2277a84e134Smrg XtRImmediate, (XtPointer)TRUE}, 2287a84e134Smrg {XtNsharedIc, XtCSharedIc, XtRBoolean, sizeof(Boolean), 2297a84e134Smrg XtOffsetOf(XawVendorShellExtRec, vendor_ext.ic.shared_ic), 2307a84e134Smrg XtRImmediate, (XtPointer)FALSE} 2317a84e134Smrg}; 2327a84e134Smrg 2337a84e134Smrgexternaldef(vendorshellextclassrec) XawVendorShellExtClassRec 2347a84e134Smrg xawvendorShellExtClassRec = { 2357a84e134Smrg { 2367a84e134Smrg /* superclass */ (WidgetClass)&objectClassRec, 2377a84e134Smrg /* class_name */ "VendorShellExt", 2387a84e134Smrg /* size */ sizeof(XawVendorShellExtRec), 2397a84e134Smrg /* class_initialize */ XawVendorShellExtClassInitialize, 2407a84e134Smrg /* class_part_initialize*/ NULL, 2417a84e134Smrg /* Class init'ed ? */ FALSE, 2427a84e134Smrg /* initialize */ XawVendorShellExtInitialize, 243421c997bSmrg /* initialize_hook */ NULL, 2447a84e134Smrg /* pad */ NULL, 2457a84e134Smrg /* pad */ NULL, 2467a84e134Smrg /* pad */ 0, 2477a84e134Smrg /* resources */ ext_resources, 2487a84e134Smrg /* resource_count */ XtNumber(ext_resources), 2497a84e134Smrg /* xrm_class */ NULLQUARK, 2507a84e134Smrg /* pad */ FALSE, 2517a84e134Smrg /* pad */ FALSE, 2527a84e134Smrg /* pad */ FALSE, 2537a84e134Smrg /* pad */ FALSE, 2547a84e134Smrg /* destroy */ XawVendorShellExtDestroy, 2557a84e134Smrg /* pad */ NULL, 2567a84e134Smrg /* pad */ NULL, 2577a84e134Smrg /* set_values */ XawVendorShellExtSetValues, 258421c997bSmrg /* set_values_hook */ NULL, 259421c997bSmrg /* pad */ NULL, 2607a84e134Smrg /* get_values_hook */ NULL, 2617a84e134Smrg /* pad */ NULL, 2627a84e134Smrg /* version */ XtVersion, 2637a84e134Smrg /* callback_offsets */ NULL, 2647a84e134Smrg /* pad */ NULL, 2657a84e134Smrg /* pad */ NULL, 2667a84e134Smrg /* pad */ NULL, 2677a84e134Smrg /* extension */ NULL 2687a84e134Smrg },{ 2697a84e134Smrg /* extension */ NULL 2707a84e134Smrg } 2717a84e134Smrg}; 2727a84e134Smrg 2737a84e134Smrgexternaldef(xawvendorshellwidgetclass) WidgetClass 2747a84e134Smrg xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec); 2757a84e134Smrg 2767a84e134Smrg 2777a84e134Smrg/*ARGSUSED*/ 2787a84e134Smrgstatic Boolean 2795ec34c4cSmrgXawCvtCompoundTextToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, 2807a84e134Smrg XrmValue *fromVal, XrmValue *toVal, 2815ec34c4cSmrg XtPointer *cvt_data _X_UNUSED) 2827a84e134Smrg{ 2837a84e134Smrg char **list; 2847a84e134Smrg int count; 2857a84e134Smrg static char *mbs = NULL; 2867a84e134Smrg int len; 287efbcb2bfSmrg XTextProperty prop = { 288efbcb2bfSmrg .value = (unsigned char *)fromVal->addr, 289efbcb2bfSmrg .encoding = XA_COMPOUND_TEXT(dpy), 290efbcb2bfSmrg .format = 8, 291efbcb2bfSmrg .nitems = fromVal->size 292efbcb2bfSmrg }; 2937a84e134Smrg 2947a84e134Smrg if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) { 2957a84e134Smrg XtAppWarningMsg(XtDisplayToApplicationContext(dpy), 2967a84e134Smrg "converter", "XmbTextPropertyToTextList", "XawError", 297775e7de9Smrg "conversion from CT to MB failed.", NULL, NULL); 2987a84e134Smrg return False; 2997a84e134Smrg } 3005ec34c4cSmrg len = (int)strlen(*list); 3015ec34c4cSmrg toVal->size = (unsigned)len; 3025ec34c4cSmrg mbs = XtRealloc(mbs, (Cardinal)(len + 1)); /* keep buffer because no one call free :( */ 3037a84e134Smrg strcpy(mbs, *list); 3047a84e134Smrg XFreeStringList(list); 3057a84e134Smrg toVal->addr = (XtPointer)mbs; 3067a84e134Smrg return True; 3077a84e134Smrg} 3087a84e134Smrg 3097a84e134Smrgstatic void 3107a84e134SmrgXawVendorShellClassInitialize(void) 3117a84e134Smrg{ 3127a84e134Smrg static XtConvertArgRec screenConvertArg[] = { 3137a84e134Smrg {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), 3147a84e134Smrg sizeof(Screen *)} 3157a84e134Smrg }; 3167a84e134Smrg 317421c997bSmrg XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor, 3187a84e134Smrg screenConvertArg, XtNumber(screenConvertArg)); 3197a84e134Smrg 3207a84e134Smrg XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, 3217a84e134Smrg screenConvertArg, XtNumber(screenConvertArg)); 3227a84e134Smrg 3237a84e134Smrg XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString, 3247a84e134Smrg NULL, 0, XtCacheNone, NULL); 3257a84e134Smrg} 3267a84e134Smrg 3277a84e134Smrgstatic void 3287a84e134SmrgXawVendorShellClassPartInit(WidgetClass cclass) 3297a84e134Smrg{ 3307a84e134Smrg CompositeClassExtension ext; 3317a84e134Smrg VendorShellWidgetClass vsclass = (VendorShellWidgetClass)cclass; 3327a84e134Smrg 333efbcb2bfSmrg if (((CompositeClassExtension) 334efbcb2bfSmrg XtGetClassExtension (cclass, 335efbcb2bfSmrg XtOffsetOf(CompositeClassRec, 336efbcb2bfSmrg composite_class.extension), 337efbcb2bfSmrg NULLQUARK, 1L, (Cardinal) 0)) == NULL) { 3387a84e134Smrg ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec); 3397a84e134Smrg if (ext != NULL) { 3407a84e134Smrg ext->next_extension = vsclass->composite_class.extension; 3417a84e134Smrg ext->record_type = NULLQUARK; 3427a84e134Smrg ext->version = XtCompositeExtensionVersion; 3437a84e134Smrg ext->record_size = sizeof (CompositeClassExtensionRec); 3447a84e134Smrg ext->accepts_objects = TRUE; 3457a84e134Smrg ext->allows_change_managed_set = FALSE; 3467a84e134Smrg vsclass->composite_class.extension = (XtPointer) ext; 3477a84e134Smrg } 3487a84e134Smrg } 3497a84e134Smrg} 3507a84e134Smrg 351efbcb2bfSmrg#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) 352efbcb2bfSmrg/* shared libraries on these platforms have the wrong semantics */ 3537a84e134Smrg/* symbols do not get resolved external to the shared library */ 3547a84e134Smrgvoid _XawFixupVendorShell() 3557a84e134Smrg{ 3567a84e134Smrg transientShellWidgetClass->core_class.superclass = 3577a84e134Smrg (WidgetClass) &vendorShellClassRec; 3587a84e134Smrg topLevelShellWidgetClass->core_class.superclass = 3597a84e134Smrg (WidgetClass) &vendorShellClassRec; 3607a84e134Smrg} 3617a84e134Smrg#endif 3627a84e134Smrg 3637a84e134Smrg/* ARGSUSED */ 3647a84e134Smrgstatic void 3655ec34c4cSmrgXawVendorShellInitialize(Widget req _X_UNUSED, Widget cnew, 3667a84e134Smrg ArgList args, Cardinal *num_args) 3677a84e134Smrg{ 3687a84e134Smrg XtAddEventHandler(cnew, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); 3697a84e134Smrg XtAddEventHandler(cnew, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL); 3707a84e134Smrg XtCreateWidget("shellext", xawvendorShellExtWidgetClass, 3717a84e134Smrg cnew, args, *num_args); 3727a84e134Smrg} 3737a84e134Smrg 3747a84e134Smrg/* ARGSUSED */ 3757a84e134Smrgstatic Boolean 3765ec34c4cSmrgXawVendorShellSetValues(Widget old _X_UNUSED, Widget ref _X_UNUSED, Widget cnew _X_UNUSED, 3775ec34c4cSmrg ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) 3787a84e134Smrg{ 3797a84e134Smrg return FALSE; 3807a84e134Smrg} 3817a84e134Smrg 3827a84e134Smrgstatic void 3837a84e134SmrgXawVendorShellRealize(Widget wid, Mask *vmask, XSetWindowAttributes *attr) 3847a84e134Smrg{ 3857a84e134Smrg WidgetClass super = wmShellWidgetClass; 3867a84e134Smrg 3877a84e134Smrg /* Make my superclass do all the dirty work */ 3887a84e134Smrg 3897a84e134Smrg (*super->core_class.realize) (wid, vmask, attr); 3907a84e134Smrg _XawImRealize(wid); 3917a84e134Smrg} 3927a84e134Smrg 3937a84e134Smrg 3947a84e134Smrgstatic void 3957a84e134SmrgXawVendorShellExtClassInitialize(void) 3967a84e134Smrg{ 3977a84e134Smrg} 3987a84e134Smrg 3997a84e134Smrg/* ARGSUSED */ 4007a84e134Smrgstatic void 4015ec34c4cSmrgXawVendorShellExtInitialize(Widget req _X_UNUSED, Widget cnew, 4025ec34c4cSmrg ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) 4037a84e134Smrg{ 4047a84e134Smrg _XawImInitialize(cnew->core.parent, cnew); 4057a84e134Smrg} 4067a84e134Smrg 4077a84e134Smrg/* ARGSUSED */ 4087a84e134Smrgstatic void 4097a84e134SmrgXawVendorShellExtDestroy(Widget w) 4107a84e134Smrg{ 4117a84e134Smrg _XawImDestroy( w->core.parent, w ); 4127a84e134Smrg} 4137a84e134Smrg 4147a84e134Smrg/* ARGSUSED */ 4157a84e134Smrgstatic Boolean 4165ec34c4cSmrgXawVendorShellExtSetValues(Widget old _X_UNUSED, Widget ref _X_UNUSED, Widget cnew _X_UNUSED, 4175ec34c4cSmrg ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) 4187a84e134Smrg{ 4197a84e134Smrg return FALSE; 4207a84e134Smrg} 4217a84e134Smrg 4227a84e134Smrgvoid 4237a84e134SmrgXawVendorShellExtResize(Widget w) 4247a84e134Smrg{ 4257a84e134Smrg ShellWidget sw = (ShellWidget) w; 4267a84e134Smrg Widget childwid; 4277a84e134Smrg Cardinal i; 4287a84e134Smrg int core_height; 4297a84e134Smrg 4307a84e134Smrg _XawImResizeVendorShell( w ); 4317a84e134Smrg core_height = _XawImGetShellHeight( w ); 4327a84e134Smrg for( i = 0; i < sw->composite.num_children; i++ ) { 4337a84e134Smrg if( XtIsManaged( sw->composite.children[ i ] ) ) { 4347a84e134Smrg childwid = sw->composite.children[ i ]; 4355ec34c4cSmrg XtResizeWidget( childwid, 4365ec34c4cSmrg (Dimension)sw->core.width, 4375ec34c4cSmrg (Dimension)core_height, 4387a84e134Smrg childwid->core.border_width ); 4397a84e134Smrg } 4407a84e134Smrg } 4417a84e134Smrg} 4427a84e134Smrg 4437a84e134Smrg/*ARGSUSED*/ 4447a84e134Smrgvoid 4455ec34c4cSmrgXawVendorStructureNotifyHandler(Widget w, XtPointer closure _X_UNUSED, XEvent *event _X_UNUSED, 4465ec34c4cSmrg Boolean *continue_to_dispatch _X_UNUSED) 4477a84e134Smrg{ 4487a84e134Smrg XawVendorShellExtResize(w); 4497a84e134Smrg} 4507a84e134Smrg 4517a84e134Smrg/*ARGSUSED*/ 4527a84e134Smrgstatic XtGeometryResult 4537a84e134SmrgXawVendorShellGeometryManager(Widget wid, XtWidgetGeometry *request, 4545ec34c4cSmrg XtWidgetGeometry *reply _X_UNUSED) 4557a84e134Smrg{ 4567a84e134Smrg ShellWidget shell = (ShellWidget)(wid->core.parent); 4577a84e134Smrg XtWidgetGeometry my_request; 4587a84e134Smrg 4597a84e134Smrg if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid)) 4607a84e134Smrg return(XtGeometryNo); 4617a84e134Smrg 4627a84e134Smrg if (request->request_mode & (CWX | CWY)) 4637a84e134Smrg return(XtGeometryNo); 4647a84e134Smrg 4657a84e134Smrg /* %%% worry about XtCWQueryOnly */ 4667a84e134Smrg my_request.request_mode = 0; 4677a84e134Smrg if (request->request_mode & CWWidth) { 4687a84e134Smrg my_request.width = request->width; 4697a84e134Smrg my_request.request_mode |= CWWidth; 4707a84e134Smrg } 4717a84e134Smrg if (request->request_mode & CWHeight) { 4725ec34c4cSmrg my_request.height = (Dimension)(request->height 4735ec34c4cSmrg + _XawImGetImAreaHeight( wid )); 4747a84e134Smrg my_request.request_mode |= CWHeight; 4757a84e134Smrg } 4767a84e134Smrg if (request->request_mode & CWBorderWidth) { 4777a84e134Smrg my_request.border_width = request->border_width; 4787a84e134Smrg my_request.request_mode |= CWBorderWidth; 4797a84e134Smrg } 4807a84e134Smrg if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL) 4817a84e134Smrg == XtGeometryYes) { 4827a84e134Smrg /* assert: if (request->request_mode & CWWidth) then 4837a84e134Smrg * shell->core.width == request->width 4847a84e134Smrg * assert: if (request->request_mode & CWHeight) then 4857a84e134Smrg * shell->core.height == request->height 4867a84e134Smrg * 4877a84e134Smrg * so, whatever the WM sized us to (if the Shell requested 4887a84e134Smrg * only one of the two) is now the correct child size 4897a84e134Smrg */ 490421c997bSmrg 4917a84e134Smrg wid->core.width = shell->core.width; 4927a84e134Smrg wid->core.height = shell->core.height; 4937a84e134Smrg if (request->request_mode & CWBorderWidth) { 4945ec34c4cSmrg wid->core.x = wid->core.y = (Position)(-request->border_width); 4957a84e134Smrg } 4967a84e134Smrg _XawImCallVendorShellExtResize(wid); 4977a84e134Smrg return XtGeometryYes; 4987a84e134Smrg } else return XtGeometryNo; 4997a84e134Smrg} 5007a84e134Smrg 5017a84e134Smrgstatic void 5027a84e134SmrgXawVendorShellChangeManaged(Widget wid) 5037a84e134Smrg{ 5047a84e134Smrg ShellWidget w = (ShellWidget) wid; 5057a84e134Smrg Widget* childP; 5067a84e134Smrg int i; 5077a84e134Smrg 5087a84e134Smrg (*SuperClass->composite_class.change_managed)(wid); 5095ec34c4cSmrg for (i = (int)w->composite.num_children, childP = w->composite.children; 5107a84e134Smrg i; i--, childP++) { 5117a84e134Smrg if (XtIsManaged(*childP)) { 5127a84e134Smrg XtSetKeyboardFocus(wid, *childP); 5137a84e134Smrg break; 5147a84e134Smrg } 5157a84e134Smrg } 5167a84e134Smrg} 517