init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
174
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nAttr.c
vendored
Normal file
174
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nAttr.c
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
/******************************************************************
|
||||
|
||||
Copyright 1994, 1995 by Sun Microsystems, Inc.
|
||||
Copyright 1993, 1994 by Hewlett-Packard Company
|
||||
|
||||
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 Sun Microsystems, Inc.
|
||||
and Hewlett-Packard not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior permission.
|
||||
Sun Microsystems, Inc. and Hewlett-Packard make no representations about
|
||||
the suitability of this software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
|
||||
SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
|
||||
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY 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.
|
||||
|
||||
Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
|
||||
|
||||
This version tidied and debugged by Steve Underwood May 1999
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xresource.h>
|
||||
#include "Xi18n.h"
|
||||
#include "XimFunc.h"
|
||||
#include "nimf-xim.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
CARD16 type;
|
||||
} IMListOfAttr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
CARD8 major_opcode;
|
||||
CARD8 minor_opcode;
|
||||
} IMExtList;
|
||||
|
||||
IMListOfAttr Default_IMattr[] =
|
||||
{
|
||||
{XNQueryInputStyle, XimType_XIMStyles},
|
||||
{(char *) NULL, (CARD16) 0}
|
||||
};
|
||||
|
||||
IMListOfAttr Default_ICattr[] =
|
||||
{
|
||||
{XNInputStyle, XimType_CARD32},
|
||||
{XNClientWindow, XimType_Window},
|
||||
{XNFocusWindow, XimType_Window},
|
||||
{XNFilterEvents, XimType_CARD32},
|
||||
{XNPreeditAttributes, XimType_NEST},
|
||||
{XNStatusAttributes, XimType_NEST},
|
||||
{XNFontSet, XimType_XFontSet},
|
||||
{XNArea, XimType_XRectangle},
|
||||
{XNAreaNeeded, XimType_XRectangle},
|
||||
{XNColormap, XimType_CARD32},
|
||||
{XNStdColormap, XimType_CARD32},
|
||||
{XNForeground, XimType_CARD32},
|
||||
{XNBackground, XimType_CARD32},
|
||||
{XNBackgroundPixmap, XimType_CARD32},
|
||||
{XNSpotLocation, XimType_XPoint},
|
||||
{XNLineSpace, XimType_CARD32},
|
||||
{XNPreeditState, XimType_CARD32},
|
||||
{XNSeparatorofNestedList, XimType_SeparatorOfNestedList},
|
||||
{(char *) NULL, 0}
|
||||
};
|
||||
|
||||
IMExtList Default_Extension[] =
|
||||
{
|
||||
{"XIM_EXT_MOVE", XIM_EXTENSION, XIM_EXT_MOVE},
|
||||
{"XIM_EXT_SET_EVENT_MASK", XIM_EXTENSION, XIM_EXT_SET_EVENT_MASK},
|
||||
{"XIM_EXT_FORWARD_KEYEVENT", XIM_EXTENSION, XIM_EXT_FORWARD_KEYEVENT},
|
||||
{(char *) NULL, 0, 0}
|
||||
};
|
||||
|
||||
static void CountAttrList(IMListOfAttr *attr, int *total_count)
|
||||
{
|
||||
*total_count = 0;
|
||||
|
||||
while (attr->name != NULL)
|
||||
{
|
||||
attr++;
|
||||
++(*total_count);
|
||||
}
|
||||
}
|
||||
|
||||
static XIMAttr *CreateAttrList (NimfXim *xim,
|
||||
IMListOfAttr *attr,
|
||||
int *total_count)
|
||||
{
|
||||
XIMAttr *args, *p;
|
||||
unsigned int buf_size;
|
||||
|
||||
CountAttrList(attr, total_count);
|
||||
|
||||
buf_size = (unsigned) (*total_count + 1)*sizeof (XIMAttr);
|
||||
args = (XIMAttr *) malloc (buf_size);
|
||||
if (!args)
|
||||
return (XIMAttr *) NULL;
|
||||
/*endif*/
|
||||
memset (args, 0, buf_size);
|
||||
|
||||
for (p = args; attr->name != NULL; attr++, p++)
|
||||
{
|
||||
p->name = attr->name;
|
||||
p->length = strlen (attr->name);
|
||||
p->type = (CARD16) attr->type;
|
||||
p->attribute_id = XrmStringToQuark (p->name);
|
||||
if (strcmp (p->name, XNPreeditAttributes) == 0)
|
||||
xim->address.preeditAttr_id = p->attribute_id;
|
||||
else if (strcmp (p->name, XNStatusAttributes) == 0)
|
||||
xim->address.statusAttr_id = p->attribute_id;
|
||||
else if (strcmp (p->name, XNSeparatorofNestedList) == 0)
|
||||
xim->address.separatorAttr_id = p->attribute_id;
|
||||
/*endif*/
|
||||
}
|
||||
/*endfor*/
|
||||
p->name = (char *) NULL;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
void _Xi18nInitAttrList (NimfXim *xim)
|
||||
{
|
||||
XIMAttr *args;
|
||||
int total_count;
|
||||
|
||||
/* init IMAttr list */
|
||||
if (xim->address.xim_attr)
|
||||
XFree ((char *) xim->address.xim_attr);
|
||||
/*endif*/
|
||||
args = CreateAttrList (xim, Default_IMattr, &total_count);
|
||||
|
||||
xim->address.im_attr_num = total_count;
|
||||
xim->address.xim_attr = (XIMAttr *)args;
|
||||
|
||||
/* init ICAttr list */
|
||||
if (xim->address.xic_attr)
|
||||
XFree ((char *) xim->address.xic_attr);
|
||||
/*endif*/
|
||||
args = CreateAttrList (xim, Default_ICattr, &total_count);
|
||||
|
||||
xim->address.ic_attr_num = total_count;
|
||||
xim->address.xic_attr = (XICAttr *) args;
|
||||
}
|
||||
|
||||
void _Xi18nInitExtension(NimfXim *xim)
|
||||
{
|
||||
register int i;
|
||||
IMExtList *extensions = (IMExtList *) Default_Extension;
|
||||
XIMExt *ext_list = (XIMExt *) xim->address.extension;
|
||||
|
||||
for (i = 0; extensions->name; i++, ext_list++, extensions++)
|
||||
{
|
||||
ext_list->major_opcode = extensions->major_opcode;
|
||||
ext_list->minor_opcode = extensions->minor_opcode;
|
||||
ext_list->name = extensions->name;
|
||||
ext_list->length = strlen(ext_list->name);
|
||||
}
|
||||
|
||||
xim->address.ext_num = i;
|
||||
}
|
||||
Reference in New Issue
Block a user