749N/A/* $XConsortium: XawIm.c,v 1.5 94/04/17 20:13:30 kaleb Exp $ */
749N/A
749N/A/*
749N/A * Copyright 1991 by OMRON Corporation
749N/A *
749N/A * Permission to use, copy, modify, distribute, and sell this software and its
749N/A * documentation for any purpose is hereby granted without fee, provided that
749N/A * the above copyright notice appear in all copies and that both that
749N/A * copyright notice and this permission notice appear in supporting
749N/A * documentation, and that the name of OMRON not be used in advertising or
749N/A * publicity pertaining to distribution of the software without specific,
749N/A * written prior permission. OMRON makes no representations about the
749N/A * suitability of this software for any purpose. It is provided "as is"
749N/A * without express or implied warranty.
749N/A *
749N/A * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
749N/A * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
749N/A * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
749N/A * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
749N/A * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
749N/A * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
749N/A * SOFTWARE.
749N/A *
749N/A * Author: Seiji Kuwari OMRON Corporation
749N/A * kuwa@omron.co.jp
749N/A * kuwa%omron.co.jp@uunet.uu.net
749N/A */
749N/A
749N/A
749N/A/*
749N/A
749N/ACopyright (c) 1994 X Consortium
749N/A
749N/APermission is hereby granted, free of charge, to any person obtaining a copy
749N/Aof this software and associated documentation files (the "Software"), to deal
749N/Ain the Software without restriction, including without limitation the rights
749N/Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell
749N/Acopies of the Software, and to permit persons to whom the Software is
749N/Afurnished to do so, subject to the following conditions:
749N/A
749N/AThe above copyright notice and this permission notice shall be included in
749N/Aall copies or substantial portions of the Software.
749N/A
749N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
749N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
749N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
749N/AX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
749N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
749N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
749N/A
749N/AExcept as contained in this notice, the name of the X Consortium shall not be
749N/Aused in advertising or otherwise to promote the sale, use or other dealings
749N/Ain this Software without prior written authorization from the X Consortium.
749N/A
749N/A*/
749N/A
749N/A#include <X11/IntrinsicP.h>
749N/A#include <X11/StringDefs.h>
749N/A#include <X11/Xos.h>
749N/A#include <X11/Xlocale.h>
749N/A#include <X11/Xfuncs.h>
749N/A#include <X11/ShellP.h>
749N/A#include <X11/Xaw/TextP.h>
749N/A#include <X11/Xaw/MultiSrc.h>
749N/A#include <X11/Xaw/MultiSinkP.h>
749N/A#include "XawImP.h"
749N/A#include <X11/Xaw/VendorEP.h>
749N/A#include <X11/VarargsI.h>
749N/A#include "XawI18n.h"
749N/A#include <ctype.h>
749N/A
749N/A#if NeedVarargsPrototypes
749N/A# include <stdarg.h>
749N/A# define Va_start(a,b) va_start(a,b)
749N/A#else
749N/A# include <varargs.h>
749N/A# define Va_start(a,b) va_start(a)
749N/A#endif
749N/A
749N/A#define maxAscentOfFontSet(fontset) \
749N/A ( - (XExtentsOfFontSet((fontset)))->max_logical_extent.y)
749N/A
749N/A#define maxHeightOfFontSet(fontset) \
749N/A ((XExtentsOfFontSet((fontset)))->max_logical_extent.height)
749N/A
749N/A#define maxDescentOfFontSet(fontset) \
749N/A (maxHeightOfFontSet(fontset) - maxAscentOfFontSet(fontset))
749N/A
749N/A#define Offset(field) (XtOffsetOf(XawIcTablePart, field))
749N/A
749N/A/*****************************************************
749N/A *
749N/A * Forward reference prototypes
749N/A *
749N/A *****************************************************/
749N/A
749N/Astatic XawIcTableList CurrentSharedIcTable(
749N/A#if NeedFunctionPrototypes
749N/A XawVendorShellExtPart* /* ve */
749N/A#endif
749N/A);
749N/A
749N/Astatic void DestroyIC(
749N/A#if NeedFunctionPrototypes
749N/A Widget /* w */,
749N/A XawVendorShellExtPart* /* ve */
749N/A#endif
749N/A);
749N/A
749N/Astatic XtResource resources[] =
749N/A{
749N/A {
749N/A XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
749N/A Offset (font_set), XtRString, XtDefaultFontSet
749N/A },
749N/A {
749N/A XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
749N/A Offset (foreground), XtRString, (XtPointer)"XtDefaultForeground"
749N/A },
749N/A {
749N/A XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
749N/A Offset (background), XtRString, (XtPointer)"XtDefaultBackground"
749N/A },
749N/A {
749N/A XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
749N/A Offset (bg_pixmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap
749N/A },
749N/A {
749N/A XtNinsertPosition, XtCTextPosition, XtRInt, sizeof (XawTextPosition),
749N/A Offset (cursor_position), XtRImmediate, (XtPointer) 0
749N/A }
749N/A};
749N/A#undef Offset
749N/A
749N/A
749N/Astatic void SetVaArg( arg, value )
749N/A XPointer *arg, value;
749N/A{
749N/A *arg = value;
749N/A}
749N/A
749N/Astatic VendorShellWidget SearchVendorShell( w )
749N/A Widget w;
749N/A{
749N/A while(w && !XtIsShell(w)) w = XtParent(w);
749N/A if (w && XtIsVendorShell(w)) return((VendorShellWidget)w);
749N/A return(NULL);
749N/A}
749N/A
749N/Astatic XContext extContext = (XContext)NULL;
749N/A
749N/Astatic XawVendorShellExtPart *SetExtPart( w, vew )
749N/A VendorShellWidget w;
749N/A XawVendorShellExtWidget vew;
749N/A{
749N/A contextDataRec *contextData;
749N/A
749N/A if (extContext == (XContext)NULL) extContext = XUniqueContext();
749N/A
749N/A contextData = XtNew(contextDataRec);
749N/A contextData->parent = (Widget)w;
749N/A contextData->ve = (Widget)vew;
749N/A if (XSaveContext(XtDisplay(w), (Window)w, extContext, (char *)contextData)) {
749N/A return(NULL);
749N/A }
749N/A return(&(vew->vendor_ext));
749N/A}
749N/A
749N/Astatic XawVendorShellExtPart *GetExtPart( w )
749N/A VendorShellWidget w;
749N/A{
749N/A contextDataRec *contextData;
749N/A XawVendorShellExtWidget vew;
749N/A
749N/A if (XFindContext(XtDisplay(w), (Window)w, extContext,
749N/A (XPointer*)&contextData)) {
749N/A return(NULL);
749N/A }
749N/A vew = (XawVendorShellExtWidget)contextData->ve;
749N/A return(&(vew->vendor_ext));
749N/A}
749N/A
749N/Astatic Boolean IsSharedIC( ve )
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A return( ve->ic.shared_ic );
749N/A}
749N/A
749N/Astatic XawIcTableList GetIcTableShared( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A if (p->widget == w) {
749N/A if (IsSharedIC(ve)) {
749N/A return(ve->ic.shared_ic_table);
749N/A } else {
749N/A return(p);
749N/A }
749N/A }
749N/A }
749N/A return(NULL);
749N/A}
749N/A
749N/Astatic XawIcTableList GetIcTable( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A if (p->widget == w) {
749N/A return(p);
749N/A }
749N/A }
749N/A return(NULL);
749N/A}
749N/A
749N/Astatic XIMStyle GetInputStyleOfIC( ve )
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A
749N/A if (!ve) return((XIMStyle)0);
749N/A return(ve->ic.input_style);
749N/A}
749N/A
749N/Astatic XIMStyle GetInputStyleOfIM( p )
749N/A String p;
749N/A{
749N/A if (!p || !*p)
749N/A return((XIMStyle)0);
749N/A if (!strcmp(p, "OverTheSpot")) {
749N/A return((XIMPreeditPosition | XIMStatusArea));
749N/A } else if (!strcmp(p, "OffTheSpot")) {
749N/A return((XIMPreeditArea | XIMStatusArea));
749N/A } else if (!strcmp(p, "Root")) {
749N/A return((XIMPreeditNothing | XIMStatusNothing));
749N/A } else {
749N/A return((XIMStyle)0);
749N/A }
749N/A}
749N/A
749N/Astatic void ConfigureCB( w, closure, event )
749N/A Widget w;
749N/A XtPointer closure;
749N/A XEvent * event;
749N/A{
749N/A XawIcTableList p;
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A XVaNestedList pe_attr;
749N/A XRectangle pe_area;
749N/A XawTextMargin *margin;
749N/A
749N/A if (event->type != ConfigureNotify) return;
749N/A
749N/A if ((vw = SearchVendorShell(w)) == NULL) return;
749N/A
749N/A if (ve = GetExtPart(vw)) {
749N/A if (IsSharedIC(ve)) return;
749N/A if ((ve->im.xim == NULL) ||
749N/A ((p = GetIcTableShared(w, ve)) == NULL) ||
749N/A (p->xic == NULL) || !(p->input_style & XIMPreeditPosition)) return;
749N/A pe_area.x = 0;
749N/A pe_area.y = 0;
749N/A pe_area.width = w->core.width;
749N/A pe_area.height = w->core.height;
749N/A margin = &(((TextWidget)w)->text.margin);
749N/A pe_area.x += margin->left;
749N/A pe_area.y += margin->top;
749N/A pe_area.width -= (margin->left + margin->right - 1);
749N/A pe_area.height -= (margin->top + margin->bottom - 1);
749N/A
749N/A pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
749N/A XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
749N/A XtFree(pe_attr);
749N/A }
749N/A}
749N/A
749N/Astatic XContext errContext = (XContext)NULL;
749N/A
749N/Astatic Widget SetErrCnxt( w, xim )
749N/A Widget w;
749N/A XIM xim;
749N/A{
749N/A contextErrDataRec *contextErrData;
749N/A
749N/A if (errContext == (XContext)NULL) errContext = XUniqueContext();
749N/A
749N/A contextErrData = XtNew(contextErrDataRec);
749N/A contextErrData->widget = w;
749N/A contextErrData->xim = xim;
749N/A if (XSaveContext(XtDisplay(w), (Window)xim, errContext,
749N/A (char *)contextErrData)) {
749N/A return(NULL);
749N/A }
749N/A return(contextErrData->widget);
749N/A}
749N/A
749N/Astatic Widget GetErrCnxt( error_im )
749N/A XIM error_im;
749N/A{
749N/A contextErrDataRec *contextErrData;
749N/A
749N/A if (XFindContext(XDisplayOfIM(error_im), (Window)error_im, errContext,
749N/A (XPointer*)&contextErrData)) {
749N/A return(NULL);
749N/A }
749N/A return(contextErrData->widget);
749N/A}
749N/A
749N/Astatic void CloseIM( ve )
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A if (ve->im.xim)
749N/A XCloseIM(ve->im.xim);
749N/A}
749N/A
749N/Astatic Dimension SetVendorShellHeight( ve, height )
749N/A XawVendorShellExtPart* ve;
749N/A Dimension height;
749N/A{
749N/A Arg args[2];
749N/A Cardinal i = 0;
749N/A
749N/A if (ve->im.area_height < height || height == 0) {
749N/A XtSetArg(args[i], XtNheight,
749N/A (ve->parent->core.height + height - ve->im.area_height));
749N/A ve->im.area_height = height;
749N/A XtSetValues(ve->parent, args, 1);
749N/A }
749N/A return(ve->im.area_height);
749N/A}
749N/A
749N/Astatic void DestroyAllIM( ve )
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p;
749N/A contextErrDataRec *contextErrData;
749N/A
749N/A /*
749N/A * Destory all ICs
749N/A */
749N/A if (IsSharedIC(ve)) {
749N/A if ((p = ve->ic.shared_ic_table) && p->xic) {
749N/A DestroyIC(p->widget, ve);
749N/A p->xic = NULL;
749N/A p->ic_focused = FALSE;
749N/A }
749N/A } else {
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A if (p->xic == NULL) continue;
749N/A DestroyIC(p->widget, ve);
749N/A p->xic = NULL;
749N/A p->ic_focused = FALSE;
749N/A }
749N/A }
749N/A if (!ve->im.xim) return;
749N/A /*
749N/A * Close Input Method
749N/A */
749N/A CloseIM(ve);
749N/A if (!XFindContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext,
749N/A (XPointer*)&contextErrData)) {
749N/A if (contextErrData) XtFree((char *)contextErrData);
749N/A }
749N/A XDeleteContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext);
749N/A ve->im.xim = NULL;
749N/A
749N/A /*
749N/A * resize vendor shell to core size
749N/A */
749N/A (void) SetVendorShellHeight(ve, 0);
749N/A /*
749N/A XawVendorShellExtResize(vw);
749N/A */
749N/A return;
749N/A}
749N/A
749N/Astatic void FreeAllDataOfVendorShell(ve, vw)
749N/A XawVendorShellExtPart * ve;
749N/A VendorShellWidget vw;
749N/A{
749N/A XawIcTableList p, next;
749N/A contextErrDataRec *contextErrData;
749N/A
749N/A if (!XFindContext(XtDisplay(vw), (Window)vw, extContext,
749N/A (XPointer*)&contextErrData)) {
749N/A if (contextErrData) XtFree((char *)contextErrData);
749N/A }
749N/A XDeleteContext(XtDisplay(vw), (Window)vw, extContext);
749N/A if (ve->im.im_list) {
749N/A XtFree((char *)ve->im.im_list[0]);
749N/A XtFree((char *)ve->im.im_list);
749N/A }
749N/A if (ve->ic.ic_list) {
749N/A XtFree((char *)ve->ic.ic_list[0]);
749N/A XtFree((char *)ve->ic.ic_list);
749N/A }
749N/A if (ve->ic.shared_ic_table)
749N/A XtFree((char *)ve->ic.shared_ic_table);
749N/A if (ve->im.resources) XtFree((char *)ve->im.resources);
749N/A for (p = ve->ic.ic_table; p; p = next) {
749N/A next = p->next;
749N/A XtFree((char *)ve->ic.ic_table);
749N/A }
749N/A}
749N/A
749N/Astatic void VendorShellDestroyed( w, cl_data, ca_data )
749N/A Widget w;
749N/A XtPointer cl_data, ca_data;
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A
749N/A if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) == NULL ) return;
749N/A DestroyAllIM( ve );
749N/A FreeAllDataOfVendorShell( ve, (VendorShellWidget) w );
749N/A return;
749N/A}
749N/A
749N/Astatic int IOErrorHandler( error_im )
749N/A XIM error_im;
749N/A{
749N/A VendorShellWidget vw;
749N/A XawVendorShellExtPart * ve;
749N/A
749N/A if ((vw = (VendorShellWidget)GetErrCnxt(error_im)) == NULL
749N/A || (ve = GetExtPart(vw)) == NULL) return(0);
749N/A
749N/A DestroyAllIM(ve);
749N/A return(0);
749N/A}
749N/A
749N/A/*
749N/A * Attempt to open an input method
749N/A */
749N/A
749N/Astatic void OpenIM(ve)
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A char *p, modifiers[32];
749N/A XIM xim = NULL;
749N/A XIMStyles *xim_styles;
749N/A XIMStyle input_style;
749N/A int i, j;
749N/A
749N/A if (ve->im.open_im == False) return;
749N/A ve->im.xim = NULL;
749N/A if (!strcmp(setlocale(LC_ALL, NULL), "C")) return;
749N/A if ((int)ve->im.im_list_num <= 0) {
749N/A if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
749N/A xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
749N/A } else {
749N/A for (i = 0; i < (int)ve->im.im_list_num; i++) {
749N/A strcpy(modifiers, "@im=");
749N/A strcat(modifiers, ve->im.im_list[i]);
749N/A if ((p = XSetLocaleModifiers(modifiers)) != NULL && *p &&
749N/A (xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL)) != NULL)
749N/A break;
749N/A }
749N/A }
749N/A if (xim == NULL) {
749N/A if ((p = XSetLocaleModifiers("")) != NULL && *p) {
749N/A xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
749N/A }
749N/A }
749N/A if (xim == NULL) {
749N/A XtAppWarning(XtWidgetToApplicationContext(ve->parent),
749N/A "we can not open any input method");
749N/A return;
749N/A }
749N/A if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)
749N/A || !xim_styles) {
749N/A XtAppWarning(XtWidgetToApplicationContext(ve->parent),
749N/A "input method doesn't support any style");
749N/A XCloseIM(xim);
749N/A return;
749N/A }
749N/A for (j = 0; j < (int)ve->ic.ic_list_num; j++) {
749N/A input_style = GetInputStyleOfIM(ve->ic.ic_list[j]);
749N/A if (input_style == (XIMStyle)0) continue;
749N/A for (i = 0; (unsigned short)i < xim_styles->count_styles; i++) {
749N/A if (input_style == xim_styles->supported_styles[i]) {
749N/A ve->ic.input_style = input_style;
749N/A SetErrCnxt(ve->parent, xim);
749N/A/* _XipSetIOErrorHandler(IOErrorHandler); */
749N/A ve->im.xim = xim;
749N/A XFree(xim_styles);
749N/A return;
749N/A }
749N/A }
749N/A }
749N/A XCloseIM(xim);
749N/A XtAppWarning(XtWidgetToApplicationContext(ve->parent),
749N/A "input method doesn't support my input style");
749N/A XFree(xim_styles);
749N/A}
749N/A
749N/Astatic Boolean ResizeVendorShell_Core(vw, ve, p)
749N/A VendorShellWidget vw;
749N/A XawVendorShellExtPart * ve;
749N/A XawIcTableList p;
749N/A{
749N/A XVaNestedList pe_attr, st_attr;
749N/A XRectangle pe_area, st_area;
749N/A XRectangle *get_pe_area = NULL, *get_st_area = NULL;
749N/A
749N/A st_area.width = 0;
749N/A if (p->input_style & XIMStatusArea) {
749N/A st_attr = XVaCreateNestedList(0, XNArea, &get_st_area, NULL);
749N/A XGetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
749N/A XFree(st_attr);
749N/A if (p->xic == NULL) {
749N/A return(FALSE);
749N/A }
749N/A st_area.x = 0;
749N/A st_area.y = vw->core.height - ve->im.area_height;
749N/A st_area.width = get_st_area->width;
749N/A st_area.height = get_st_area->height;
749N/A XFree(get_st_area);
749N/A st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
749N/A XSetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
749N/A XFree(st_attr);
749N/A if (p->xic == NULL) {
749N/A return(FALSE);
749N/A }
749N/A }
749N/A if (p->input_style & XIMPreeditArea) {
749N/A pe_attr = XVaCreateNestedList(0, XNArea, &get_pe_area, NULL);
749N/A XGetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
749N/A XFree(pe_attr);
749N/A if (p->xic == NULL) {
749N/A return(FALSE);
749N/A }
749N/A pe_area.x = st_area.width;
749N/A pe_area.y = vw->core.height - ve->im.area_height;
749N/A pe_area.width = vw->core.width;
749N/A pe_area.height = get_pe_area->height;
749N/A if (p->input_style & XIMStatusArea) {
749N/A pe_area.width -= st_area.width;
749N/A }
749N/A XFree(get_pe_area);
749N/A pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
749N/A XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
749N/A XFree(pe_attr);
749N/A }
749N/A return(TRUE);
749N/A}
749N/A
749N/Astatic void ResizeVendorShell(vw, ve)
749N/A VendorShellWidget vw;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A if (IsSharedIC(ve)) {
749N/A p = ve->ic.shared_ic_table;
749N/A if (p->xic == NULL) return;
749N/A ResizeVendorShell_Core(vw, ve, p);
749N/A return;
749N/A }
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A if (p->xic == NULL) continue;
749N/A if (ResizeVendorShell_Core(vw, ve, p) == FALSE) return;
749N/A }
749N/A}
749N/A
749N/Astatic XawIcTableList CreateIcTable( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList table;
749N/A
749N/A table = (XawIcTableList) XtMalloc(sizeof(XawIcTablePart));
749N/A if (table == NULL) return(NULL);
749N/A table->widget = w;
749N/A table->xic = NULL;
749N/A table->flg = table->prev_flg = 0;
749N/A table->font_set = NULL;
749N/A table->foreground = table->background = 0xffffffff;
749N/A table->bg_pixmap = 0;
749N/A table->cursor_position = 0xffff;
749N/A table->line_spacing = 0;
749N/A table->ic_focused = FALSE;
749N/A table->openic_error = FALSE;
749N/A return(table);
749N/A}
749N/A
749N/Astatic Boolean RegisterToVendorShell( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList table;
749N/A
749N/A if ((table = CreateIcTable(w, ve)) == NULL) return(FALSE);
749N/A table->next = ve->ic.ic_table;
749N/A ve->ic.ic_table = table;
749N/A return(TRUE);
749N/A}
749N/A
749N/Astatic void UnregisterFromVendorShell(w, ve)
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList *prev, p;
749N/A
749N/A for (prev = &ve->ic.ic_table; p = *prev; prev = &p->next) {
749N/A if (p->widget == w) {
749N/A *prev = p->next;
749N/A XtFree((char *)p);
749N/A break;
749N/A }
749N/A }
749N/A return;
749N/A}
749N/A
749N/Astatic void SetICValuesShared(w, ve, p, check)
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A XawIcTableList p;
749N/A Boolean check;
749N/A{
749N/A XawIcTableList pp;
749N/A
749N/A if ((pp = GetIcTable(w, ve)) == NULL) return;
749N/A if (check == TRUE && CurrentSharedIcTable(ve) != pp) return;
749N/A
749N/A if (pp->prev_flg & CICursorP && p->cursor_position != pp->cursor_position) {
749N/A p->cursor_position = pp->cursor_position;
749N/A p->flg |= CICursorP;
749N/A }
749N/A if (pp->prev_flg & CIFontSet && p->font_set != pp->font_set) {
749N/A p->font_set = pp->font_set;
749N/A p->flg |= (CIFontSet|CICursorP);
749N/A }
749N/A if (pp->prev_flg & CIFg && p->foreground != pp->foreground) {
749N/A p->foreground = pp->foreground;
749N/A p->flg |= CIFg;
749N/A }
749N/A if (pp->prev_flg & CIBg && p->background != pp->background) {
749N/A p->background = pp->background;
749N/A p->flg |= CIBg;
749N/A }
749N/A if (pp->prev_flg & CIBgPixmap && p->bg_pixmap != pp->bg_pixmap) {
749N/A p->bg_pixmap = pp->bg_pixmap;
749N/A p->flg |= CIBgPixmap;
749N/A }
749N/A if (pp->prev_flg & CILineS && p->line_spacing != pp->line_spacing) {
749N/A p->line_spacing = pp->line_spacing;
749N/A p->flg |= CILineS;
749N/A }
749N/A}
749N/A
749N/Astatic Boolean IsCreatedIC(w, ve)
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A if (ve->im.xim == NULL) return(FALSE);
749N/A if ((p = GetIcTableShared(w, ve)) == NULL) return(FALSE);
749N/A if (p->xic == NULL) return(FALSE);
749N/A return(TRUE);
749N/A}
749N/A
749N/Astatic void SizeNegotiation(p, width, height)
749N/A XawIcTableList p;
749N/A Dimension width, height;
749N/A{
749N/A XRectangle pe_area, st_area;
749N/A XVaNestedList pe_attr = NULL, st_attr = NULL;
749N/A int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
749N/A XRectangle *pe_area_needed = NULL, *st_area_needed = NULL;
749N/A XPointer ic_a[5];
749N/A
749N/A if (p->input_style & XIMPreeditArea) {
749N/A pe_attr = XVaCreateNestedList(0, XNAreaNeeded, &pe_area_needed, NULL);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
749N/A }
749N/A if (p->input_style & XIMStatusArea) {
749N/A st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
749N/A }
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
749N/A
749N/A if (ic_cnt > 0) {
749N/A XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
749N/A if (pe_attr) XFree(pe_attr);
749N/A if (st_attr) XFree(st_attr);
749N/A if (p->xic == NULL) {
749N/A p->openic_error = True;
749N/A return;
749N/A }
749N/A pe_attr = st_attr = NULL;
749N/A ic_cnt = pe_cnt = st_cnt = 0;
749N/A if (p->input_style & XIMStatusArea) {
749N/A st_area.height = st_area_needed->height;
749N/A st_area.x = 0;
749N/A st_area.y = height - st_area.height;
749N/A if (p->input_style & XIMPreeditArea) {
749N/A st_area.width = st_area_needed->width;
749N/A } else {
749N/A st_area.width = width;
749N/A }
749N/A
749N/A XFree(st_area_needed);
749N/A st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
749N/A }
749N/A if (p->input_style & XIMPreeditArea) {
749N/A if (p->input_style & XIMStatusArea) {
749N/A pe_area.x = st_area.width;
749N/A pe_area.width = width - st_area.width;
749N/A } else {
749N/A pe_area.x = 0;
749N/A pe_area.width = width;
749N/A }
749N/A pe_area.height = pe_area_needed->height;
749N/A XFree(pe_area_needed);
749N/A pe_area.y = height - pe_area.height;
749N/A pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
749N/A }
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
749N/A XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
749N/A if (pe_attr) XFree(pe_attr);
749N/A if (st_attr) XFree(st_attr);
749N/A if (p->xic == NULL) {
749N/A p->openic_error = True;
749N/A return;
749N/A }
749N/A }
749N/A}
749N/A
749N/Astatic void CreateIC( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A XawIcTableList p;
749N/A XPoint position;
749N/A XRectangle pe_area, st_area;
749N/A XVaNestedList pe_attr = NULL, st_attr = NULL;
749N/A XPointer ic_a[20], pe_a[20], st_a[20];
749N/A Dimension height = 0;
749N/A int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
749N/A XawTextMargin *margin;
749N/A
749N/A if (!XtIsRealized(w)) return;
749N/A if (((ve->im.xim == NULL) || (p = GetIcTableShared(w, ve)) == NULL) ||
749N/A p->xic || (p->openic_error != FALSE)) return;
749N/A
749N/A p->input_style = GetInputStyleOfIC(ve);
749N/A
749N/A if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, FALSE);
749N/A XFlush(XtDisplay(w));
749N/A
749N/A if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
749N/A if (p->flg & CIFontSet) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
749N/A height = maxAscentOfFontSet(p->font_set)
749N/A + maxDescentOfFontSet(p->font_set);
749N/A height = SetVendorShellHeight(ve, height);
749N/A }
749N/A if (p->flg & CIFg) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++;
749N/A }
749N/A if (p->flg & CIBg) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++;
749N/A }
749N/A if (p->flg & CIBgPixmap) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++;
749N/A }
749N/A if (p->flg & CILineS) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++;
749N/A }
749N/A }
749N/A if (p->input_style & XIMPreeditArea) {
749N/A pe_area.x = 0;
749N/A pe_area.y = ve->parent->core.height - height;
749N/A pe_area.width = ve->parent->core.width;
749N/A pe_area.height = height;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
749N/A }
749N/A if (p->input_style & XIMPreeditPosition) {
749N/A pe_area.x = 0;
749N/A pe_area.y = 0;
749N/A pe_area.width = w->core.width;
749N/A pe_area.height = w->core.height;
749N/A margin = &(((TextWidget)w)->text.margin);
749N/A pe_area.x += margin->left;
749N/A pe_area.y += margin->top;
749N/A pe_area.width -= (margin->left + margin->right - 1);
749N/A pe_area.height -= (margin->top + margin->bottom - 1);
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
749N/A if (p->flg & CICursorP) {
749N/A _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
749N/A } else {
749N/A position.x = position.y = 0;
749N/A }
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++;
749N/A }
749N/A if (p->input_style & XIMStatusArea) {
749N/A st_area.x = 0;
749N/A st_area.y = ve->parent->core.height - height;
749N/A st_area.width = ve->parent->core.width;
749N/A st_area.height = height;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNArea); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) &st_area); st_cnt++;
749N/A }
749N/A
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNInputStyle); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) p->input_style); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNClientWindow); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(ve->parent)); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++;
749N/A
749N/A if (pe_cnt > 0) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) NULL);
749N/A pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
749N/A pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8],
749N/A pe_a[9], pe_a[10], pe_a[11], pe_a[12],
749N/A pe_a[13], pe_a[14], pe_a[15], pe_a[16],
749N/A pe_a[17], pe_a[18], pe_a[19]);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
749N/A }
749N/A
749N/A if (st_cnt > 0) {
749N/A SetVaArg( &st_a[st_cnt], (XPointer) NULL);
749N/A st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
749N/A st_a[4], st_a[5], st_a[6], st_a[7], st_a[8],
749N/A st_a[9], st_a[10], st_a[11], st_a[12],
749N/A st_a[13], st_a[14], st_a[15], st_a[16],
749N/A st_a[17], st_a[18], st_a[19]);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
749N/A }
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
749N/A
749N/A p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3],
749N/A ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9],
749N/A ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14],
749N/A ic_a[15], ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
749N/A if (pe_attr) XtFree(pe_attr);
749N/A if (st_attr) XtFree(st_attr);
749N/A
749N/A if (p->xic == NULL) {
749N/A p->openic_error = True;
749N/A return;
749N/A }
749N/A
749N/A SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height);
749N/A
749N/A p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS);
749N/A
749N/A if (!IsSharedIC(ve)) {
749N/A if (p->input_style & XIMPreeditPosition) {
749N/A XtAddEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
749N/A (XtEventHandler)ConfigureCB, (Opaque)NULL);
749N/A }
749N/A }
749N/A}
749N/A
749N/Astatic void SetICValues( w, ve, focus )
749N/A Widget w;
749N/A XawVendorShellExtPart *ve;
749N/A Boolean focus;
749N/A{
749N/A XawIcTableList p;
749N/A XPoint position;
749N/A XRectangle pe_area, st_area;
749N/A XVaNestedList pe_attr = NULL, st_attr = NULL;
749N/A XPointer ic_a[20], pe_a[20], st_a[20];
749N/A int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
749N/A XawTextMargin *margin;
749N/A int height;
749N/A
749N/A if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
749N/A (p->xic == NULL)) return;
749N/A
749N/A if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, TRUE);
749N/A XFlush(XtDisplay(w));
749N/A if (focus == FALSE &&
749N/A !(p->flg & (CIFontSet | CIFg | CIBg |
749N/A CIBgPixmap | CICursorP | CILineS))) return;
749N/A#ifdef SPOT
749N/A if ((p->input_style & XIMPreeditPosition)
749N/A && ((!IsSharedIC(ve) && ((p->flg & ~CIICFocus) == CICursorP))
749N/A || (IsSharedIC(ve) && p->flg == CICursorP))) {
749N/A _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
749N/A _XipChangeSpot(p->xic, position.x, position.y);
749N/A p->flg &= ~CICursorP;
749N/A return;
749N/A }
749N/A#endif
749N/A
749N/A if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
749N/A if (p->flg & CIFontSet) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
749N/A height = maxAscentOfFontSet(p->font_set)
749N/A + maxDescentOfFontSet(p->font_set);
749N/A height = SetVendorShellHeight(ve, height);
749N/A }
749N/A if (p->flg & CIFg) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++;
749N/A }
749N/A if (p->flg & CIBg) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++;
749N/A }
749N/A if (p->flg & CIBgPixmap) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++;
749N/A }
749N/A if (p->flg & CILineS) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++;
749N/A SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++;
749N/A }
749N/A }
749N/A if (p->input_style & XIMPreeditPosition) {
749N/A if (p->flg & CICursorP) {
749N/A _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++;
749N/A }
749N/A }
749N/A if (IsSharedIC(ve)) {
749N/A if (p->input_style & XIMPreeditPosition) {
749N/A pe_area.x = 0;
749N/A pe_area.y = 0;
749N/A pe_area.width = w->core.width;
749N/A pe_area.height = w->core.height;
749N/A margin = &(((TextWidget)w)->text.margin);
749N/A pe_area.x += margin->left;
749N/A pe_area.y += margin->top;
749N/A pe_area.width -= (margin->left + margin->right - 1);
749N/A pe_area.height -= (margin->top + margin->bottom - 1);
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
749N/A }
749N/A }
749N/A
749N/A if (pe_cnt > 0) {
749N/A SetVaArg( &pe_a[pe_cnt], (XPointer) NULL);
749N/A pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
749N/A pe_a[4], pe_a[5], pe_a[6], pe_a[7],
749N/A pe_a[8], pe_a[9], pe_a[10], pe_a[11],
749N/A pe_a[12], pe_a[13], pe_a[14], pe_a[15],
749N/A pe_a[16], pe_a[17], pe_a[18], pe_a[19]);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
749N/A }
749N/A if (st_cnt > 0) {
749N/A SetVaArg( &st_a[st_cnt], (XPointer) NULL);
749N/A st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
749N/A st_a[4], st_a[5], st_a[6], st_a[7],
749N/A st_a[8], st_a[9], st_a[10], st_a[11],
749N/A st_a[12], st_a[13], st_a[14], st_a[15],
749N/A st_a[16], st_a[17], st_a[18], st_a[19]);
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
749N/A }
749N/A if (focus == TRUE) {
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++;
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++;
749N/A }
749N/A if (ic_cnt > 0) {
749N/A SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
749N/A XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4],
749N/A ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10],
749N/A ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15],
749N/A ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
749N/A if (pe_attr) XtFree(pe_attr);
749N/A if (st_attr) XtFree(st_attr);
749N/A }
749N/A
749N/A if (IsSharedIC(ve) && p->flg & CIFontSet)
749N/A SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height);
749N/A
749N/A p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS);
749N/A}
749N/A
749N/Astatic void SharedICChangeFocusWindow(w, ve, p)
749N/A Widget w;
749N/A XawVendorShellExtPart *ve;
749N/A XawIcTableList p;
749N/A{
749N/A XawIcTableList pp;
749N/A
749N/A if (w == NULL) {
749N/A ve->ic.current_ic_table = NULL;
749N/A return;
749N/A }
749N/A if ((pp = GetIcTable(w, ve)) == NULL) return;
749N/A ve->ic.current_ic_table = pp;
749N/A SetICValues(w, ve, TRUE);
749N/A}
749N/A
749N/Astatic XawIcTableList CurrentSharedIcTable( ve )
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A return(ve->ic.current_ic_table);
749N/A}
749N/A
749N/Astatic void SetICFocus(w, ve)
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p, pp;
749N/A
749N/A if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
749N/A (p->xic == NULL)) return;
749N/A
749N/A if (IsSharedIC(ve)) {
749N/A pp = CurrentSharedIcTable(ve);
749N/A if (pp == NULL || pp->widget != w) {
749N/A SharedICChangeFocusWindow(w, ve, p);
749N/A }
749N/A }
749N/A if (p->flg & CIICFocus && p->ic_focused == FALSE) {
749N/A p->ic_focused = TRUE;
749N/A XSetICFocus(p->xic);
749N/A }
749N/A p->flg &= ~CIICFocus;
749N/A}
749N/A
749N/Astatic void UnsetICFocus(w, ve)
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A{
749N/A XawIcTableList p, pp;
749N/A
749N/A if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
749N/A (p->xic == NULL)) return;
749N/A
749N/A if (IsSharedIC(ve) && (pp = CurrentSharedIcTable(ve))) {
749N/A if (pp->widget != w) {
749N/A return;
749N/A }
749N/A SharedICChangeFocusWindow(NULL, ve, p);
749N/A }
749N/A if (p->ic_focused == TRUE) {
749N/A XUnsetICFocus(p->xic);
749N/A p->ic_focused = FALSE;
749N/A }
749N/A}
749N/A
749N/Astatic void SetValues( w, ve, args, num_args )
749N/A Widget w;
749N/A XawVendorShellExtPart * ve;
749N/A ArgList args;
749N/A Cardinal num_args;
749N/A{
749N/A ArgList arg;
749N/A
749N/A XrmName argName;
749N/A XrmResourceList xrmres;
749N/A int i;
749N/A XawIcTablePart *p, save_tbl;
749N/A extern void _XtCopyFromArg(XtArgVal src, char* dst, unsigned int size);
749N/A
749N/A if ((p = GetIcTable(w, ve)) == NULL) return;
749N/A
749N/A memcpy(&save_tbl, p, sizeof(XawIcTablePart));
749N/A
749N/A for (arg = args ; num_args != 0; num_args--, arg++) {
749N/A argName = XrmStringToName(arg->name);
749N/A for (xrmres = (XrmResourceList)ve->im.resources, i = 0;
749N/A i < (int)ve->im.num_resources; i++, xrmres++) {
749N/A if ((long)argName == xrmres->xrm_name) {
749N/A _XtCopyFromArg(arg->value,
749N/A (char *)p - xrmres->xrm_offset - 1,
749N/A xrmres->xrm_size);
749N/A break;
749N/A }
749N/A }
749N/A }
749N/A if (p->font_set != save_tbl.font_set) {
749N/A p->flg |= CIFontSet;
749N/A }
749N/A if (p->foreground != save_tbl.foreground) {
749N/A p->flg |= CIFg;
749N/A }
749N/A if (p->background !=save_tbl.background) {
749N/A p->flg |= CIBg;
749N/A }
749N/A if (p->bg_pixmap != save_tbl.bg_pixmap) {
749N/A p->flg |= CIBgPixmap;
749N/A }
749N/A if (p->cursor_position != save_tbl.cursor_position) {
749N/A p->flg |= CICursorP;
749N/A }
749N/A if (p->line_spacing != save_tbl.line_spacing) {
749N/A p->flg |= CILineS;
749N/A }
749N/A p->prev_flg |= p->flg;
749N/A}
749N/A
749N/Astatic void SetFocus( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart *ve;
749N/A{
749N/A XawIcTableList p;
749N/A if ((p = GetIcTableShared(w, ve)) == NULL) return;
749N/A
749N/A if ( p->ic_focused == FALSE || IsSharedIC(ve)) {
749N/A p->flg |= CIICFocus;
749N/A }
749N/A p->prev_flg |= p->flg;
749N/A}
749N/A
749N/Astatic void DestroyIC(w, ve)
749N/A Widget w;
749N/A XawVendorShellExtPart *ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
749N/A (p->xic == NULL)) return;
749N/A if (IsSharedIC(ve)) {
749N/A if (GetIcTable(w, ve) == ve->ic.current_ic_table) {
749N/A UnsetICFocus(w, ve);
749N/A }
749N/A return;
749N/A }
749N/A XDestroyIC(p->xic);
749N/A if (!IsSharedIC(ve)) {
749N/A if (p->input_style & XIMPreeditPosition) {
749N/A XtRemoveEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
749N/A (XtEventHandler)ConfigureCB, (Opaque)NULL);
749N/A }
749N/A }
749N/A}
749N/A
749N/Astatic void SetFocusValues( inwidg, args, num_args, focus )
749N/A Widget inwidg;
749N/A ArgList args;
749N/A Cardinal num_args;
749N/A Boolean focus;
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) == NULL) return;
749N/A if (ve = GetExtPart(vw)) {
749N/A if (num_args > 0) SetValues(inwidg, ve, args, num_args);
749N/A if (focus) SetFocus(inwidg, ve);
749N/A if (XtIsRealized((Widget)vw) && ve->im.xim) {
749N/A if (IsCreatedIC(inwidg, ve)) {
749N/A SetICValues(inwidg, ve, FALSE);
749N/A if (focus) SetICFocus(inwidg, ve);
749N/A } else {
749N/A CreateIC(inwidg, ve);
749N/A SetICFocus(inwidg, ve);
749N/A }
749N/A }
749N/A }
749N/A}
749N/A
749N/Astatic void UnsetFocus( inwidg )
749N/A Widget inwidg;
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A XawIcTableList p;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) == NULL) return;
749N/A if (ve = GetExtPart(vw)) {
749N/A if ((p = GetIcTableShared(inwidg, ve)) == NULL) return;
749N/A if (p->flg & CIICFocus) {
749N/A p->flg &= ~CIICFocus;
749N/A }
749N/A p->prev_flg &= ~CIICFocus;
749N/A if (ve->im.xim && XtIsRealized((Widget)vw) && p->xic) {
749N/A UnsetICFocus(inwidg, ve);
749N/A }
749N/A }
749N/A}
749N/A
749N/Astatic Boolean IsRegistered( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A for (p = ve->ic.ic_table; p; p = p->next)
749N/A {
749N/A if (p->widget == w) return(TRUE);
749N/A }
749N/A return(FALSE);
749N/A}
749N/A
749N/Astatic void Register(inwidg, ve)
749N/A Widget inwidg;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A if (ve->im.xim == NULL)
749N/A {
749N/A OpenIM(ve);
749N/A }
749N/A
749N/A if (IsRegistered(inwidg, ve)) return;
749N/A
749N/A if (RegisterToVendorShell(inwidg, ve) == FALSE) return;
749N/A
749N/A if (ve->im.xim == NULL) return;
749N/A
749N/A if (XtIsRealized(ve->parent))
749N/A {
749N/A CreateIC(inwidg, ve);
749N/A SetICFocus(inwidg, ve);
749N/A }
749N/A}
749N/A
749N/Astatic Boolean NoRegistered(ve)
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A if (ve->ic.ic_table == NULL) return(TRUE);
749N/A return(FALSE);
749N/A}
749N/A
749N/Astatic void Unregister(inwidg, ve)
749N/A Widget inwidg;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A if (!IsRegistered(inwidg, ve)) return;
749N/A
749N/A DestroyIC(inwidg, ve);
749N/A
749N/A UnregisterFromVendorShell(inwidg, ve);
749N/A
749N/A if (NoRegistered(ve))
749N/A {
749N/A CloseIM(ve);
749N/A ve->im.xim = NULL;
749N/A /*
749N/A * resize vendor shell to core size
749N/A */
749N/A (void) SetVendorShellHeight(ve, 0);
749N/A }
749N/A}
749N/A
749N/Astatic void AllCreateIC( ve )
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A if (ve->im.xim == NULL) return;
749N/A if (IsSharedIC(ve) && ve->ic.ic_table[0].widget) {
749N/A p = ve->ic.shared_ic_table;
749N/A if (p->xic == NULL)
749N/A CreateIC(ve->ic.ic_table[0].widget, ve);
749N/A SetICFocus(ve->ic.ic_table[0].widget, ve);
749N/A return;
749N/A }
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A if (p->xic == NULL)
749N/A CreateIC(p->widget, ve);
749N/A }
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A SetICFocus(p->widget, ve);
749N/A }
749N/A}
749N/A
749N/A
749N/Astatic void Reconnect(ve)
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A XawIcTableList p;
749N/A
749N/A ve->im.open_im = True;
749N/A if (ve->im.xim == NULL) {
749N/A OpenIM(ve);
749N/A }
749N/A if (ve->im.xim == NULL) return;
749N/A
749N/A if (IsSharedIC(ve)) {
749N/A p = ve->ic.shared_ic_table;
749N/A p->flg = p->prev_flg;
749N/A p->openic_error = FALSE;
749N/A } else {
749N/A for (p = ve->ic.ic_table; p; p = p->next) {
749N/A p->flg = p->prev_flg;
749N/A p->openic_error = FALSE;
749N/A }
749N/A }
749N/A AllCreateIC(ve);
749N/A}
749N/A
749N/A
749N/Astatic void CompileResourceList( res, num_res )
749N/A XtResourceList res;
749N/A unsigned int num_res;
749N/A{
749N/A unsigned int count;
749N/A
749N/A#define xrmres ((XrmResourceList) res)
749N/A for (count = 0; count < num_res; res++, count++) {
749N/A xrmres->xrm_name = XrmPermStringToQuark(res->resource_name);
749N/A xrmres->xrm_class = XrmPermStringToQuark(res->resource_class);
749N/A xrmres->xrm_type = XrmPermStringToQuark(res->resource_type);
749N/A xrmres->xrm_offset = -res->resource_offset - 1;
749N/A xrmres->xrm_default_type = XrmPermStringToQuark(res->default_type);
749N/A }
749N/A#undef xrmres
749N/A}
749N/A
749N/A
749N/Astatic char** ParseIMNameList(p, num)
749N/A char* p;
749N/A int* num;
749N/A{
749N/A char *s, *save_s, *ss, *list[32], **lp, *end;
749N/A int i = 0;
749N/A
749N/A *num = 0;
749N/A if (!p || !*p) return ((char **)NULL);
749N/A while (*p && isspace(*p)) p++;
749N/A if (!*p) return ((char **)NULL);
749N/A if ((s = XtMalloc(strlen(p) + 1)) == NULL) return((char **)NULL);
749N/A strcpy(s, p);
749N/A save_s = s;
749N/A
749N/A while(1) {
749N/A list[i] = s;
749N/A ss = index(s, ',');
749N/A if (!ss) {
749N/A end = s + strlen(s);
749N/A } else {
749N/A end = ss;
749N/A }
749N/A while (isspace(*end)) end--;
749N/A *end = '\0';
749N/A i++;
749N/A if (!ss) break;
749N/A s = ss + 1;
749N/A while (*s && isspace(*s)) p++;
749N/A if (!*s) break;
749N/A }
749N/A if ((lp = (char **)XtMalloc(sizeof(char *) * (i + 1))) == NULL) {
749N/A XtFree(save_s);
749N/A return((char **)NULL);
749N/A }
749N/A memcpy((char *)lp, (char *)list, sizeof(char *) * i);
749N/A *(lp + i) = NULL;
749N/A *num = i;
749N/A return(lp);
749N/A}
749N/A
749N/Astatic Boolean Initialize( vw, ve )
749N/A VendorShellWidget vw;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A int i;
749N/A
749N/A if (!XtIsVendorShell((Widget)vw)) return(FALSE);
749N/A ve->parent = (Widget)vw;
749N/A ve->im.xim = NULL;
749N/A ve->im.area_height = 0;
749N/A ve->im.resources = (XrmResourceList)XtMalloc(sizeof(resources));
749N/A if (ve->im.resources == NULL) return(FALSE);
749N/A memcpy((char *)ve->im.resources, (char *)resources, sizeof(resources));
749N/A ve->im.num_resources = XtNumber(resources);
749N/A CompileResourceList( (XtResourceList) ve->im.resources,
749N/A ve->im.num_resources );
749N/A if ((ve->ic.shared_ic_table = CreateIcTable( (Widget)vw, ve)) == NULL)
749N/A return(FALSE);
749N/A ve->ic.current_ic_table = NULL;
749N/A ve->ic.ic_table = NULL;
749N/A ve->im.im_list = ParseIMNameList(ve->im.input_method, &i);
749N/A ve->im.im_list_num = i;
749N/A ve->ic.ic_list = ParseIMNameList(ve->im.preedit_type, &i);
749N/A ve->ic.ic_list_num = i;
749N/A return(TRUE);
749N/A}
749N/A
749N/A
749N/A/* Destroy()
749N/A *
749N/A * This frees all (most?) of the resources malloced by XawIm.
749N/A * It is called by _XawImDestroy, which is called by Vendor.c's
749N/A * VendorExt's Destroy method. Sheeran, Omron KK, 93/08/05 */
749N/A
749N/Astatic void Destroy( w, ve )
749N/A Widget w;
749N/A XawVendorShellExtPart* ve;
749N/A{
749N/A contextDataRec *contextData;
749N/A contextErrDataRec *contextErrData;
749N/A
749N/A if (!XtIsVendorShell( w ) )
749N/A return;
749N/A XtFree( (char*) ve->im.resources );
749N/A
749N/A if (extContext != (XContext)NULL &&
749N/A !XFindContext (XtDisplay (w), (Window)w,
749N/A extContext, (XPointer*)&contextData))
749N/A XtFree( (char*) contextData );
749N/A
749N/A if (errContext != (XContext)NULL &&
749N/A !XFindContext (XDisplayOfIM( ve->im.xim ), (Window) ve->im.xim,
749N/A errContext, (XPointer*) &contextErrData))
749N/A XtFree( (char*) contextErrData );
749N/A}
749N/A
749N/A/*********************************************
749N/A *
749N/A * SEMI-PRIVATE FUNCTIONS
749N/A * For use by other Xaw modules
749N/A *
749N/A ********************************************/
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImResizeVendorShell(
749N/A Widget w )
749N/A#else
749N/A_XawImResizeVendorShell( w )
749N/A Widget w;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A
749N/A if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) && ve->im.xim ) {
749N/A ResizeVendorShell( (VendorShellWidget) w, ve );
749N/A }
749N/A}
749N/A
749N/A
749N/ADimension
749N/A#if NeedFunctionPrototypes
749N/A_XawImGetShellHeight(
749N/A Widget w )
749N/A#else
749N/A_XawImGetShellHeight( w )
749N/A Widget w;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A
749N/A if (!XtIsVendorShell( w ) ) return( w->core.height );
749N/A if ( ve = GetExtPart( (VendorShellWidget) w ) ) {
749N/A return( w->core.height - ve->im.area_height );
749N/A }
749N/A return( w->core.height );
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImRealize(
749N/A Widget w )
749N/A#else
749N/A_XawImRealize( w )
749N/A Widget w;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A extern void XawVendorShellExtResize();
749N/A
749N/A if ( !XtIsRealized( w ) || !XtIsVendorShell( w ) ) return;
749N/A if ( ve = GetExtPart( (VendorShellWidget) w ) ) {
749N/A XtAddEventHandler( w, (EventMask)StructureNotifyMask, FALSE,
749N/A XawVendorShellExtResize, (XtPointer)NULL );
749N/A AllCreateIC(ve);
749N/A }
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImInitialize(
749N/A Widget w,
749N/A Widget ext )
749N/A#else
749N/A_XawImInitialize( w, ext )
749N/A Widget w, ext;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A
749N/A if ( !XtIsVendorShell( w ) ) return;
749N/A if ( ve = SetExtPart( (VendorShellWidget) w, (XawVendorShellExtWidget)ext ) ) {
749N/A if ( Initialize( (VendorShellWidget) w, ve ) == FALSE ) return;
749N/A XtAddCallback( w, XtNdestroyCallback, VendorShellDestroyed,
749N/A (XtPointer) NULL );
749N/A }
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImReconnect(
749N/A Widget inwidg )
749N/A#else
749N/A_XawImReconnect( inwidg )
749N/A Widget inwidg;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) == NULL) return;
749N/A if (ve = GetExtPart(vw)) {
749N/A Reconnect(ve);
749N/A }
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImRegister(
749N/A Widget inwidg)
749N/A#else
749N/A_XawImRegister(inwidg)
749N/A Widget inwidg;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) == NULL) return;
749N/A if (ve = GetExtPart(vw)) {
749N/A Register(inwidg, ve);
749N/A }
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImUnregister(
749N/A Widget inwidg)
749N/A#else
749N/A_XawImUnregister(inwidg)
749N/A Widget inwidg;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) == NULL) return;
749N/A if (ve = GetExtPart(vw)) {
749N/A Unregister(inwidg, ve);
749N/A }
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImSetValues(
749N/A Widget inwidg,
749N/A ArgList args,
749N/A Cardinal num_args )
749N/A#else
749N/A_XawImSetValues( inwidg, args, num_args )
749N/A Widget inwidg;
749N/A ArgList args;
749N/A Cardinal num_args;
749N/A#endif
749N/A{
749N/A SetFocusValues( inwidg, args, num_args, FALSE );
749N/A}
749N/A
749N/Avoid
749N/A#if NeedVarargsPrototypes
749N/A_XawImVASetValues( Widget inwidg, ... )
749N/A#else
749N/A_XawImVASetValues( inwidg, va_alist )
749N/A Widget inwidg;
749N/A va_dcl
749N/A#endif
749N/A{
749N/A va_list var;
749N/A ArgList args = NULL;
749N/A Cardinal num_args;
749N/A int total_count, typed_count;
749N/A
749N/A Va_start( var, inwidg );
749N/A _XtCountVaList( var, &total_count, &typed_count );
749N/A va_end( var );
749N/A
749N/A Va_start( var, inwidg );
749N/A
749N/A _XtVaToArgList( inwidg, var, total_count, &args, &num_args );
749N/A _XawImSetValues( inwidg, args, num_args );
749N/A if ( args != NULL ) {
749N/A XtFree( (XtPointer) args );
749N/A }
749N/A va_end( var );
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImSetFocusValues(
749N/A Widget inwidg,
749N/A ArgList args,
749N/A Cardinal num_args)
749N/A#else
749N/A_XawImSetFocusValues(inwidg, args, num_args)
749N/A Widget inwidg;
749N/A ArgList args;
749N/A Cardinal num_args;
749N/A#endif
749N/A{
749N/A SetFocusValues(inwidg, args, num_args, TRUE);
749N/A}
749N/A
749N/Avoid
749N/A#if NeedVarargsPrototypes
749N/A_XawImVASetFocusValues(Widget inwidg, ...)
749N/A#else
749N/A_XawImVASetFocusValues(inwidg, va_alist)
749N/A Widget inwidg;
749N/A va_dcl
749N/A#endif
749N/A{
749N/A va_list var;
749N/A ArgList args = NULL;
749N/A Cardinal num_args;
749N/A int total_count, typed_count;
749N/A
749N/A Va_start(var, inwidg);
749N/A _XtCountVaList(var, &total_count, &typed_count);
749N/A va_end(var);
749N/A
749N/A Va_start(var,inwidg);
749N/A
749N/A _XtVaToArgList(inwidg, var, total_count, &args, &num_args);
749N/A _XawImSetFocusValues(inwidg, args, num_args);
749N/A if (args != NULL) {
749N/A XtFree((XtPointer)args);
749N/A }
749N/A va_end(var);
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImUnsetFocus(
749N/A Widget inwidg)
749N/A#else
749N/A_XawImUnsetFocus(inwidg)
749N/A Widget inwidg;
749N/A#endif
749N/A{
749N/A UnsetFocus(inwidg);
749N/A}
749N/A
749N/Aint
749N/A#if NeedFunctionPrototypes
749N/A_XawImWcLookupString(
749N/A Widget inwidg,
749N/A XKeyPressedEvent *event,
749N/A wchar_t* buffer_return,
749N/A int bytes_buffer,
749N/A KeySym *keysym_return,
749N/A Status *status_return)
749N/A#else
749N/A_XawImWcLookupString( inwidg, event, buffer_return, bytes_buffer,
749N/A keysym_return, status_return)
749N/A Widget inwidg;
749N/A XKeyPressedEvent* event;
749N/A wchar_t* buffer_return;
749N/A int bytes_buffer;
749N/A KeySym* keysym_return;
749N/A Status* status_return;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart* ve;
749N/A VendorShellWidget vw;
749N/A XawIcTableList p;
749N/A int i, ret;
749N/A char tmp_buf[64], *tmp_p;
749N/A wchar_t* buf_p;
749N/A
749N/A if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) &&
749N/A ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) {
749N/A return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer,
749N/A keysym_return, status_return));
749N/A }
749N/A ret = XLookupString( event, tmp_buf, 64, keysym_return,
749N/A (XComposeStatus*) status_return );
749N/A for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) {
749N/A *buf_p++ = _Xaw_atowc(*tmp_p++);
749N/A }
749N/A return( ret );
749N/A}
749N/A
749N/Aint
749N/A#if NeedFunctionPrototypes
749N/A_XawImGetImAreaHeight(
749N/A Widget w)
749N/A#else
749N/A_XawImGetImAreaHeight( w )
749N/A Widget w;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A
749N/A if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
749N/A return(ve->im.area_height);
749N/A }
749N/A return(0);
749N/A}
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImCallVendorShellExtResize(
749N/A Widget w)
749N/A#else
749N/A_XawImCallVendorShellExtResize( w )
749N/A Widget w;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A VendorShellWidget vw;
749N/A extern void XawVendorShellExtResize();
749N/A
749N/A if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
749N/A XawVendorShellExtResize(vw);
749N/A }
749N/A}
749N/A
749N/A
749N/A/* _XawImDestroy()
749N/A *
749N/A * This should be called by the VendorExt from its
749N/A * core Destroy method. Sheeran, Omron KK 93/08/05 */
749N/A
749N/Avoid
749N/A#if NeedFunctionPrototypes
749N/A_XawImDestroy(
749N/A Widget w,
749N/A Widget ext )
749N/A#else
749N/A_XawImDestroy( w, ext )
749N/A Widget w;
749N/A Widget ext;
749N/A#endif
749N/A{
749N/A XawVendorShellExtPart *ve;
749N/A
749N/A if ( !XtIsVendorShell( w ) ) return;
749N/A if ( ve = GetExtPart( (VendorShellWidget) w ) )
749N/A Destroy( w, ve );
749N/A}