1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
|
/* Masanao Izumo <mo@goice.co.jp>:
*
* There is problem if both -lXm and -lXaw are linked.
* This source code to re-define XAW vendorShell.
* To change motif vendorShell to XAW vendorShell in runtime.
*
* #define vendorShellClassRec xaw_vendorShellClassRec
* #define vendorShellWidgetClass xaw_vendorShellWidgetClass
* #include "xaw_redef.c"
* #undef vendorShellClassRec
* #undef vendorShellWidgetClass
* extern WidgetClass vendorShellWidgetClass;
* extern VendorShellClassRec vendorShellClassRec;
* static void xaw_vendor_setup(void)
* {
* memcpy(&vendorShellClassRec, &xaw_vendorShellClassRec,
* sizeof(VendorShellClassRec));
* vendorShellWidgetClass = (WidgetClass)&xaw_vendorShellWidgetClass;
* }
*/
/* $XConsortium: Vendor.c,v 1.27 94/04/17 20:13:25 kaleb Exp $ */
/***********************************************************
Copyright (c) 1987, 1988, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* This is a copy of Xt/Vendor.c with an additional ClassInitialize
* procedure to register Xmu resource type converters, and all the
* monkey business associated with input methods...
*
*/
/* Make sure all wm properties can make it out of the resource manager */
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/ShellP.h>
#include <X11/VendorP.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/Editres.h>
#ifdef HAVE_XMUREGISTEREXTERNALAGENT
#ifdef HAVE_X11_XMU_EXTAGENT_H
#include <X11/Xmu/ExtAgent.h>
#else
/* There is no ExtAgent.h in openwin package, but XmuRegisterExternalAgent
* is surely defined in libXmu on Solaris 7.
*/
extern void XmuRegisterExternalAgent(
#if NeedFunctionPrototypes
Widget /* w */,
XtPointer /* data */,
XEvent* /* event */,
Boolean* /* cont */
#endif
);
#endif /* HAVE_X11_XMU_EXTAGENT_H */
#endif /* HAVE_XMUREGISTEREXTERNALAGENT */
/* The following two headers are for the input method. */
/* $XConsortium: VendorEP.h,v 1.2 94/04/17 20:13:25 kaleb Exp $ */
/*
* Copyright 1991 by OMRON Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of OMRON not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. OMRON makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Seiji Kuwari OMRON Corporation
* kuwa@omron.co.jp
* kuwa%omron.co.jp@uunet.uu.net
*/
/*
Copyright (c) 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#ifndef _VendorEP_h
#define _VendorEP_h
/* $XConsortium: XawImP.h,v 1.4 95/06/06 20:50:30 kaleb Exp $ */
/*
* Copyright 1991 by OMRON Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of OMRON not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. OMRON makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Seiji Kuwari OMRON Corporation
* kuwa@omron.co.jp
* kuwa%omron.co.jp@uunet.uu.net
*/
/*
Copyright (c) 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#ifndef _XawImP_h
#define _XawImP_h
#define XtNinputMethod "inputMethod"
#define XtCInputMethod "InputMethod"
#define XtNpreeditType "preeditType"
#define XtCPreeditType "PreeditType"
#define XtNopenIm "openIm"
#define XtCOpenIm "OpenIm"
#define XtNsharedIc "sharedIc"
#define XtCSharedIc "SharedIc"
#include <X11/Xaw/Text.h>
#define CIICFocus (1 << 0)
#define CIFontSet (1 << 1)
#define CIFg (1 << 2)
#define CIBg (1 << 3)
#define CIBgPixmap (1 << 4)
#define CICursorP (1 << 5)
#define CILineS (1 << 6)
typedef struct _XawImPart
{
XIM xim;
XrmResourceList resources;
Cardinal num_resources;
Boolean open_im;
Boolean initialized;
Dimension area_height;
String input_method;
String preedit_type;
} XawImPart;
typedef struct _XawIcTablePart
{
Widget widget;
XIC xic;
XIMStyle input_style;
unsigned long flg;
unsigned long prev_flg;
Boolean ic_focused;
XFontSet font_set;
Pixel foreground;
Pixel background;
Pixmap bg_pixmap;
XawTextPosition cursor_position;
unsigned long line_spacing;
Boolean openic_error;
struct _XawIcTablePart *next;
} XawIcTablePart, *XawIcTableList;
typedef struct _XawIcPart
{
XIMStyle input_style;
Boolean shared_ic;
XawIcTableList shared_ic_table;
XawIcTableList current_ic_table;
XawIcTableList ic_table;
} XawIcPart;
typedef struct _contextDataRec
{
Widget parent;
Widget ve;
} contextDataRec;
typedef struct _contextErrDataRec
{
Widget widget;
XIM xim;
} contextErrDataRec;
void _XawImResizeVendorShell(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
Dimension _XawImGetShellHeight(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImRealize(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImInitialize(
#if NeedFunctionPrototypes
Widget, /* w */
Widget /* ext */
#endif
);
void _XawImReconnect(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImRegister(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImUnregister(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImSetValues(
#if NeedFunctionPrototypes
Widget, /* w */
ArgList, /* args */
Cardinal /* num_args */
#endif
);
/* DON'T USE THIS FUNCTION -- it's going away in the next release */
void _XawImVASetValues(
#if NeedVarargsPrototypes
Widget, /* w */
...
#endif
);
void _XawImSetFocusValues(
#if NeedFunctionPrototypes
Widget, /* w */
ArgList, /* args */
Cardinal /* num_args */
#endif
);
/* DON'T USE THIS FUNCTION -- it's going away in the next release */
void _XawImVASetFocusValues(
#if NeedVarargsPrototypes
Widget, /* w */
...
#endif
);
void _XawImUnsetFocus(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
int _XawImWcLookupString(
#if NeedFunctionPrototypes
Widget, /* w */
XKeyPressedEvent*, /* event */
wchar_t*, /* buffer_return */
int, /* bytes_buffer */
KeySym*, /* keysym_return */
Status* /* status return */
#endif
);
int _XawImGetImAreaHeight(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImCallVendorShellExtResize(
#if NeedFunctionPrototypes
Widget /* w */
#endif
);
void _XawImDestroy(
#if NeedFunctionPrototypes
Widget, /* w */
Widget /* ext */
#endif
);
#endif /* _XawImP_h */
typedef struct {
XtPointer extension;
} XawVendorShellExtClassPart;
typedef struct _VendorShellExtClassRec {
ObjectClassPart object_class;
XawVendorShellExtClassPart vendor_shell_ext_class;
} XawVendorShellExtClassRec;
typedef struct {
Widget parent;
XawImPart im;
XawIcPart ic;
} XawVendorShellExtPart;
typedef struct XawVendorShellExtRec {
ObjectPart object;
XawVendorShellExtPart vendor_ext;
} XawVendorShellExtRec, *XawVendorShellExtWidget;
#endif /* _VendorEP_h */
static XtResource resources[] = {
{XtNinput, XtCInput, XtRBool, sizeof(Bool),
XtOffsetOf(VendorShellRec, wm.wm_hints.input),
XtRImmediate, (XtPointer)True}
};
/***************************************************************************
*
* Vendor shell class record
*
***************************************************************************/
static void XawVendorShellClassInitialize();
static void XawVendorShellClassPartInit();
static void XawVendorShellInitialize();
static Boolean XawVendorShellSetValues();
static void Realize(), ChangeManaged();
static XtGeometryResult GeometryManager();
void XawVendorShellExtResize();
static CompositeClassExtensionRec vendorCompositeExt = {
/* next_extension */ NULL,
/* record_type */ NULLQUARK,
/* version */ XtCompositeExtensionVersion,
/* record_size */ sizeof (CompositeClassExtensionRec),
/* accepts_objects */ TRUE,
/* allows_change_managed_set */ FALSE
};
#define SuperClass (&wmShellClassRec)
externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
{
/* superclass */ (WidgetClass)SuperClass,
/* class_name */ "VendorShell",
/* size */ sizeof(VendorShellRec),
/* class_initialize */ XawVendorShellClassInitialize,
/* class_part_init */ XawVendorShellClassPartInit,
/* Class init'ed ? */ FALSE,
/* initialize */ XawVendorShellInitialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ resources,
/* resource_count */ XtNumber(resources),
/* xrm_class */ NULLQUARK,
/* compress_motion */ FALSE,
/* compress_exposure */ TRUE,
/* compress_enterleave*/ FALSE,
/* visible_interest */ FALSE,
/* destroy */ NULL,
/* resize */ XawVendorShellExtResize,
/* expose */ NULL,
/* set_values */ XawVendorShellSetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* intrinsics version */ XtVersion,
/* callback offsets */ NULL,
/* tm_table */ NULL,
/* query_geometry */ NULL,
/* display_accelerator*/ NULL,
/* extension */ NULL
},{
/* geometry_manager */ GeometryManager,
/* change_managed */ ChangeManaged,
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
/* extension */ (XtPointer) &vendorCompositeExt
},{
/* extension */ NULL
},{
/* extension */ NULL
},{
/* extension */ NULL
}
};
externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
(WidgetClass) (&vendorShellClassRec);
/***************************************************************************
*
* The following section is for the Vendor shell Extension class record
*
***************************************************************************/
static XtResource ext_resources[] = {
{XtNinputMethod, XtCInputMethod, XtRString, sizeof(String),
XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.input_method),
XtRString, (XtPointer)NULL},
{XtNpreeditType, XtCPreeditType, XtRString, sizeof(String),
XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.preedit_type),
XtRString, (XtPointer)"OverTheSpot,OffTheSpot,Root"},
{XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean),
XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.open_im),
XtRImmediate, (XtPointer)TRUE},
{XtNsharedIc, XtCSharedIc, XtRBoolean, sizeof(Boolean),
XtOffsetOf(XawVendorShellExtRec, vendor_ext.ic.shared_ic),
XtRImmediate, (XtPointer)FALSE}
};
static void XawVendorShellExtClassInitialize();
static void XawVendorShellExtInitialize();
static void XawVendorShellExtDestroy();
static Boolean XawVendorShellExtSetValues();
externaldef(vendorshellextclassrec) XawVendorShellExtClassRec
xawvendorShellExtClassRec = {
{
/* superclass */ (WidgetClass)&objectClassRec,
/* class_name */ "VendorShellExt",
/* size */ sizeof(XawVendorShellExtRec),
/* class_initialize */ XawVendorShellExtClassInitialize,
/* class_part_initialize*/ NULL,
/* Class init'ed ? */ FALSE,
/* initialize */ XawVendorShellExtInitialize,
/* initialize_hook */ NULL,
/* pad */ NULL,
/* pad */ NULL,
/* pad */ 0,
/* resources */ ext_resources,
/* resource_count */ XtNumber(ext_resources),
/* xrm_class */ NULLQUARK,
/* pad */ FALSE,
/* pad */ FALSE,
/* pad */ FALSE,
/* pad */ FALSE,
/* destroy */ XawVendorShellExtDestroy,
/* pad */ NULL,
/* pad */ NULL,
/* set_values */ XawVendorShellExtSetValues,
/* set_values_hook */ NULL,
/* pad */ NULL,
/* get_values_hook */ NULL,
/* pad */ NULL,
/* version */ XtVersion,
/* callback_offsets */ NULL,
/* pad */ NULL,
/* pad */ NULL,
/* pad */ NULL,
/* extension */ NULL
},{
/* extension */ NULL
}
};
externaldef(xawvendorshellwidgetclass) WidgetClass
xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec);
/*ARGSUSED*/
static Boolean
XawCvtCompoundTextToString(dpy, args, num_args, fromVal, toVal, cvt_data)
Display *dpy;
XrmValuePtr args;
Cardinal *num_args;
XrmValue *fromVal;
XrmValue *toVal;
XtPointer *cvt_data;
{
XTextProperty prop;
char **list;
int count;
static char *mbs = NULL;
int len;
prop.value = (unsigned char *)fromVal->addr;
prop.encoding = XA_COMPOUND_TEXT(dpy);
prop.format = 8;
prop.nitems = fromVal->size;
if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) {
XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
"converter", "XmbTextPropertyToTextList", "XawError",
"conversion from CT to MB failed.", NULL, 0);
return False;
}
len = strlen(*list);
toVal->size = len;
mbs = XtRealloc(mbs, len + 1); /* keep buffer because no one call free :( */
strcpy(mbs, *list);
XFreeStringList(list);
toVal->addr = (XtPointer)mbs;
return True;
}
static void XawVendorShellClassInitialize()
{
static XtConvertArgRec screenConvertArg[] = {
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
sizeof(Screen *)}
};
XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
screenConvertArg, XtNumber(screenConvertArg));
XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
screenConvertArg, XtNumber(screenConvertArg));
XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString,
NULL, 0, XtCacheNone, NULL);
}
static void XawVendorShellClassPartInit(class)
WidgetClass class;
{
CompositeClassExtension ext;
VendorShellWidgetClass vsclass = (VendorShellWidgetClass) class;
if ((ext = (CompositeClassExtension)
XtGetClassExtension (class,
XtOffsetOf(CompositeClassRec,
composite_class.extension),
NULLQUARK, 1L, (Cardinal) 0)) == NULL) {
ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec);
if (ext != NULL) {
ext->next_extension = vsclass->composite_class.extension;
ext->record_type = NULLQUARK;
ext->version = XtCompositeExtensionVersion;
ext->record_size = sizeof (CompositeClassExtensionRec);
ext->accepts_objects = TRUE;
ext->allows_change_managed_set = FALSE;
vsclass->composite_class.extension = (XtPointer) ext;
}
}
}
#ifdef __osf__
/* stupid OSF/1 shared libraries have the wrong semantics */
/* symbols do not get resolved external to the shared library */
void _XawFixupVendorShell()
{
transientShellWidgetClass->core_class.superclass =
(WidgetClass) &vendorShellClassRec;
topLevelShellWidgetClass->core_class.superclass =
(WidgetClass) &vendorShellClassRec;
}
#endif
/* ARGSUSED */
static void XawVendorShellInitialize(req, new, args, num_args)
Widget req, new;
ArgList args;
Cardinal *num_args;
{
XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
#ifdef HAVE_XMUREGISTEREXTERNALAGENT
XtAddEventHandler(new, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL);
#endif /* HAVE_XMUREGISTEREXTERNALAGENT */
XtCreateWidget("shellext", xawvendorShellExtWidgetClass,
new, args, *num_args);
}
/* ARGSUSED */
static Boolean XawVendorShellSetValues(old, ref, new)
Widget old, ref, new;
{
return FALSE;
}
static void Realize(wid, vmask, attr)
Widget wid;
Mask *vmask;
XSetWindowAttributes *attr;
{
WidgetClass super = wmShellWidgetClass;
/* Make my superclass do all the dirty work */
(*super->core_class.realize) (wid, vmask, attr);
_XawImRealize(wid);
}
static void XawVendorShellExtClassInitialize()
{
}
/* ARGSUSED */
static void XawVendorShellExtInitialize(req, new)
Widget req, new;
{
_XawImInitialize(new->core.parent, new);
}
/* ARGSUSED */
static void XawVendorShellExtDestroy( w )
Widget w;
{
_XawImDestroy( w->core.parent, w );
}
/* ARGSUSED */
static Boolean XawVendorShellExtSetValues(old, ref, new)
Widget old, ref, new;
{
return FALSE;
}
void XawVendorShellExtResize( w )
Widget w;
{
ShellWidget sw = (ShellWidget) w;
Widget childwid;
int i;
int core_height;
_XawImResizeVendorShell( w );
core_height = _XawImGetShellHeight( w );
for( i = 0; i < sw->composite.num_children; i++ ) {
if( XtIsManaged( sw->composite.children[ i ] ) ) {
childwid = sw->composite.children[ i ];
XtResizeWidget( childwid, sw->core.width, core_height,
childwid->core.border_width );
}
}
}
/*ARGSUSED*/
static XtGeometryResult GeometryManager( wid, request, reply )
Widget wid;
XtWidgetGeometry *request;
XtWidgetGeometry *reply;
{
ShellWidget shell = (ShellWidget)(wid->core.parent);
XtWidgetGeometry my_request;
if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid))
return(XtGeometryNo);
if (request->request_mode & (CWX | CWY))
return(XtGeometryNo);
/* %%% worry about XtCWQueryOnly */
my_request.request_mode = 0;
if (request->request_mode & CWWidth) {
my_request.width = request->width;
my_request.request_mode |= CWWidth;
}
if (request->request_mode & CWHeight) {
my_request.height = request->height
+ _XawImGetImAreaHeight( wid );
my_request.request_mode |= CWHeight;
}
if (request->request_mode & CWBorderWidth) {
my_request.border_width = request->border_width;
my_request.request_mode |= CWBorderWidth;
}
if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL)
== XtGeometryYes) {
/* assert: if (request->request_mode & CWWidth) then
* shell->core.width == request->width
* assert: if (request->request_mode & CWHeight) then
* shell->core.height == request->height
*
* so, whatever the WM sized us to (if the Shell requested
* only one of the two) is now the correct child size
*/
wid->core.width = shell->core.width;
wid->core.height = shell->core.height;
if (request->request_mode & CWBorderWidth) {
wid->core.x = wid->core.y = -request->border_width;
}
_XawImCallVendorShellExtResize(wid);
return XtGeometryYes;
} else return XtGeometryNo;
}
static void ChangeManaged(wid)
Widget wid;
{
ShellWidget w = (ShellWidget) wid;
Widget* childP;
int i;
(*SuperClass->composite_class.change_managed)(wid);
for (i = w->composite.num_children, childP = w->composite.children;
i; i--, childP++) {
if (XtIsManaged(*childP)) {
XtSetKeyboardFocus(wid, *childP);
break;
}
}
}
|