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:
2466
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/FrameMgr.c
vendored
Normal file
2466
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/FrameMgr.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
131
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/FrameMgr.h
vendored
Normal file
131
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/FrameMgr.h
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
/******************************************************************
|
||||
Copyright 1993, 1994 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 names of Digital or MIT 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.
|
||||
|
||||
Author: Hiroyuki Miyamoto Digital Equipment Corporation
|
||||
miyamoto@jrd.dec.com
|
||||
|
||||
This version tidied and debugged by Steve Underwood May 1999
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef FRAMEMGR_H
|
||||
#define FRAMEMGR_H
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(VAXC) && !defined(__DECC)
|
||||
#define xim_externalref globalref
|
||||
#define xim_externaldef globaldef
|
||||
#else
|
||||
#define xim_externalref extern
|
||||
#define xim_externaldef
|
||||
#endif
|
||||
|
||||
/* Definitions for FrameMgr */
|
||||
|
||||
#define COUNTER_MASK 0x10
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BIT8 = 0x1, /* {CARD8* | INT8*} */
|
||||
BIT16 = 0x2, /* {CARD16* | INT16*} */
|
||||
BIT32 = 0x3, /* {CARD32* | INT32*} */
|
||||
BIT64 = 0x4, /* {CARD64* | INT64*} */
|
||||
BARRAY = 0x5, /* int*, void* */
|
||||
ITER = 0x6, /* int* */
|
||||
POINTER = 0x7, /* specifies next item is a PTR_ITEM */
|
||||
PTR_ITEM = 0x8, /* specifies the item has a pointer */
|
||||
/* BOGUS - POINTER and PTR_ITEM
|
||||
* In the current implementation, PTR_ITEM should be lead by
|
||||
* POINTER. But actually, it's just redundant logically. Someone
|
||||
* may remove this redundancy and POINTER from the enum member but he
|
||||
* should also modify the logic in FrameMgr program.
|
||||
*/
|
||||
PADDING = 0x9, /* specifies that a padding is needed.
|
||||
* This requires extra data in data field.
|
||||
*/
|
||||
EOL = 0xA, /* specifies the end of list */
|
||||
|
||||
COUNTER_BIT8 = COUNTER_MASK | 0x1,
|
||||
COUNTER_BIT16 = COUNTER_MASK | 0x2,
|
||||
COUNTER_BIT32 = COUNTER_MASK | 0x3,
|
||||
COUNTER_BIT64 = COUNTER_MASK | 0x4
|
||||
} XimFrameType;
|
||||
|
||||
/* Convenient macro */
|
||||
#define _FRAME(a) {a, NULL}
|
||||
#define _PTR(p) {PTR_ITEM, (void *)p}
|
||||
/* PADDING's usage of data field
|
||||
* B15-B8 : Shows the number of effective items.
|
||||
* B7-B0 : Shows padding unit. ex) 04 shows 4 unit padding.
|
||||
*/
|
||||
#define _PAD2(n) {PADDING, (void*)((n)<<8|2)}
|
||||
#define _PAD4(n) {PADDING, (void*)((n)<<8|4)}
|
||||
|
||||
#define FmCounterByte 0
|
||||
#define FmCounterNumber 1
|
||||
|
||||
#define _BYTE_COUNTER(type, offset) \
|
||||
{(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterByte)}
|
||||
|
||||
#define _NUMBER_COUNTER(type, offset) \
|
||||
{(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterNumber)}
|
||||
|
||||
typedef struct _XimFrame
|
||||
{
|
||||
XimFrameType type;
|
||||
void* data; /* For PTR_ITEM and PADDING */
|
||||
} XimFrameRec, *XimFrame;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FmSuccess,
|
||||
FmEOD,
|
||||
FmInvalidCall,
|
||||
FmBufExist,
|
||||
FmCannotCalc,
|
||||
FmNoMoreData
|
||||
} FmStatus;
|
||||
|
||||
typedef struct _FrameMgr *FrameMgr;
|
||||
|
||||
FrameMgr FrameMgrInit(XimFrame frame, char* area, Bool byte_swap);
|
||||
void FrameMgrInitWithData(FrameMgr fm, XimFrame frame, void* area,
|
||||
Bool byte_swap);
|
||||
void FrameMgrFree(FrameMgr fm);
|
||||
FmStatus FrameMgrSetBuffer(FrameMgr, void*);
|
||||
FmStatus _FrameMgrPutToken(FrameMgr, void*, int);
|
||||
FmStatus _FrameMgrGetToken(FrameMgr, void*, int);
|
||||
FmStatus FrameMgrSetSize(FrameMgr, int);
|
||||
FmStatus FrameMgrSetIterCount(FrameMgr, int);
|
||||
FmStatus FrameMgrSetTotalSize(FrameMgr, int);
|
||||
int FrameMgrGetTotalSize(FrameMgr);
|
||||
int FrameMgrGetSize(FrameMgr);
|
||||
FmStatus FrameMgrSkipToken(FrameMgr, int);
|
||||
void FrameMgrReset(FrameMgr);
|
||||
Bool FrameMgrIsIterLoopEnd(FrameMgr, FmStatus*);
|
||||
|
||||
#define FrameMgrPutToken(fm, obj) _FrameMgrPutToken((fm), &(obj), sizeof(obj))
|
||||
#define FrameMgrGetToken(fm, obj) _FrameMgrGetToken((fm), &(obj), sizeof(obj))
|
||||
|
||||
#endif /* FRAMEMGR_H */
|
||||
474
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/Xi18n.h
vendored
Normal file
474
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/Xi18n.h
vendored
Normal file
@@ -0,0 +1,474 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/******************************************************************
|
||||
|
||||
Copyright (C) 1994-1995 Sun Microsystems, Inc.
|
||||
Copyright (C) 1993-1994 Hewlett-Packard Company
|
||||
Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
|
||||
Copyright (C) 2014 Red Hat, Inc.
|
||||
|
||||
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
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef _Xi18n_h
|
||||
#define _Xi18n_h
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xfuncs.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "XimProto.h"
|
||||
|
||||
/*
|
||||
* Minor Protocol Number for Extension Protocol
|
||||
*/
|
||||
#define XIM_EXTENSION 128
|
||||
#define XIM_EXT_SET_EVENT_MASK (0x30)
|
||||
#define XIM_EXT_FORWARD_KEYEVENT (0x32)
|
||||
#define XIM_EXT_MOVE (0x33)
|
||||
#define COMMON_EXTENSIONS_NUM 3
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* XI18N Valid Attribute Name Definition */
|
||||
#define ExtForwardKeyEvent "extForwardKeyEvent"
|
||||
#define ExtMove "extMove"
|
||||
#define ExtSetEventMask "extSetEventMask"
|
||||
|
||||
/*
|
||||
* Padding macro
|
||||
*/
|
||||
#define IMPAD(length) ((4 - ((length)%4))%4)
|
||||
|
||||
/*
|
||||
* Target Atom for Transport Connection
|
||||
*/
|
||||
#define LOCALES "LOCALES"
|
||||
#define TRANSPORT "TRANSPORT"
|
||||
|
||||
typedef struct _NimfXim NimfXim;
|
||||
|
||||
typedef struct _XIMPending
|
||||
{
|
||||
unsigned char *p;
|
||||
struct _XIMPending *next;
|
||||
} XIMPending;
|
||||
|
||||
typedef struct _XimProtoHdr
|
||||
{
|
||||
CARD8 major_opcode;
|
||||
CARD8 minor_opcode;
|
||||
CARD16 length;
|
||||
} XimProtoHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD16 attribute_id;
|
||||
CARD16 type;
|
||||
CARD16 length;
|
||||
char *name;
|
||||
} XIMAttr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD16 attribute_id;
|
||||
CARD16 type;
|
||||
CARD16 length;
|
||||
char *name;
|
||||
} XICAttr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int attribute_id;
|
||||
CARD16 name_length;
|
||||
char *name;
|
||||
int value_length;
|
||||
void *value;
|
||||
int type;
|
||||
} XIMAttribute;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int attribute_id;
|
||||
CARD16 name_length;
|
||||
char *name;
|
||||
int value_length;
|
||||
void *value;
|
||||
int type;
|
||||
} XICAttribute;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int length;
|
||||
char *name;
|
||||
} XIMStr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD16 major_opcode;
|
||||
CARD16 minor_opcode;
|
||||
CARD16 length;
|
||||
char *name;
|
||||
} XIMExt;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Atom key;
|
||||
unsigned long offset;
|
||||
} Xi18nAtomOffsetPair;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t capacity;
|
||||
size_t size;
|
||||
Xi18nAtomOffsetPair *data;
|
||||
} Xi18nOffsetCache;
|
||||
|
||||
typedef struct _Xi18nClient
|
||||
{
|
||||
int connect_id;
|
||||
CARD8 byte_order;
|
||||
/*
|
||||
'?': initial value
|
||||
'B': for Big-Endian
|
||||
'l': for little-endian
|
||||
*/
|
||||
int sync;
|
||||
XIMPending *pending;
|
||||
Xi18nOffsetCache offset_cache;
|
||||
void *trans_rec; /* contains transport specific data */
|
||||
struct _Xi18nClient *next;
|
||||
} Xi18nClient;
|
||||
|
||||
/*
|
||||
* Callback Struct for XIM Protocol
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
} IMAnyStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD8 byte_order;
|
||||
CARD16 major_version;
|
||||
CARD16 minor_version;
|
||||
} IMConnectStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
} IMDisConnectStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
XIMStr lang;
|
||||
} IMOpenStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
} IMCloseStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 number;
|
||||
XIMStr *extension;
|
||||
} IMQueryExtensionStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 number;
|
||||
char **im_attr_list;
|
||||
} IMGetIMValuesStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD16 preedit_attr_num;
|
||||
CARD16 status_attr_num;
|
||||
CARD16 ic_attr_num;
|
||||
XICAttribute *preedit_attr;
|
||||
XICAttribute *status_attr;
|
||||
XICAttribute *ic_attr;
|
||||
} IMChangeICStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
} IMDestroyICStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD16 length;
|
||||
char *commit_string;
|
||||
} IMResetICStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
} IMChangeFocusStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
BITMASK16 sync_bit;
|
||||
CARD16 serial_number;
|
||||
XEvent event;
|
||||
} IMForwardEventStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD16 flag;
|
||||
KeySym keysym;
|
||||
char *commit_string;
|
||||
} IMCommitStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD32 flag;
|
||||
CARD32 key_index;
|
||||
CARD32 event_mask;
|
||||
} IMTriggerNotifyStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 encoding_number;
|
||||
XIMStr *encoding; /* name information */
|
||||
CARD16 encoding_info_number;
|
||||
XIMStr *encodinginfo; /* detailed information */
|
||||
CARD16 category; /* #0 for name, #1 for detail */
|
||||
INT16 enc_index; /* index of the encoding determined */
|
||||
} IMEncodingNegotiationStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD32 flag;
|
||||
CARD32 forward_event_mask;
|
||||
CARD32 sync_event_mask;
|
||||
} IMSetEventMaskStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD32 filter_event_mask;
|
||||
CARD32 intercept_event_mask;
|
||||
CARD32 select_event_mask;
|
||||
CARD32 forward_event_mask;
|
||||
CARD32 sync_event_mask;
|
||||
} IMExtSetEventMaskStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
CARD16 x;
|
||||
CARD16 y;
|
||||
} IMMoveStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
BITMASK16 flag;
|
||||
CARD16 error_code;
|
||||
CARD16 str_length;
|
||||
CARD16 error_type;
|
||||
char *error_detail;
|
||||
} IMErrorStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
} IMPreeditStateStruct;
|
||||
|
||||
/* Callbacks */
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
} IMGeometryCBStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
union
|
||||
{
|
||||
int return_value; /* PreeditStart */
|
||||
XIMPreeditDrawCallbackStruct draw; /* PreeditDraw */
|
||||
XIMPreeditCaretCallbackStruct caret; /* PreeditCaret */
|
||||
} todo;
|
||||
} IMPreeditCBStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
union
|
||||
{
|
||||
XIMStatusDrawCallbackStruct draw; /* StatusDraw */
|
||||
} todo;
|
||||
} IMStatusCBStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
XIMStringConversionCallbackStruct strconv;
|
||||
} IMStrConvCBStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int major_code;
|
||||
int minor_code;
|
||||
CARD16 connect_id;
|
||||
CARD16 icid;
|
||||
} IMSyncXlibStruct;
|
||||
|
||||
typedef union _IMProtocol
|
||||
{
|
||||
int major_code;
|
||||
IMAnyStruct any;
|
||||
IMConnectStruct imconnect;
|
||||
IMDisConnectStruct imdisconnect;
|
||||
IMOpenStruct imopen;
|
||||
IMCloseStruct imclose;
|
||||
IMQueryExtensionStruct queryext;
|
||||
IMGetIMValuesStruct getim;
|
||||
IMEncodingNegotiationStruct encodingnego;
|
||||
IMExtSetEventMaskStruct extsetevent;
|
||||
IMMoveStruct extmove;
|
||||
IMSetEventMaskStruct setevent;
|
||||
IMChangeICStruct changeic;
|
||||
IMDestroyICStruct destroyic;
|
||||
IMResetICStruct resetic;
|
||||
IMChangeFocusStruct changefocus;
|
||||
IMCommitStruct commitstring;
|
||||
IMForwardEventStruct forwardevent;
|
||||
IMTriggerNotifyStruct triggernotify;
|
||||
IMPreeditStateStruct preedit_state;
|
||||
IMErrorStruct imerror;
|
||||
IMGeometryCBStruct geometry_callback;
|
||||
IMPreeditCBStruct preedit_callback;
|
||||
IMStatusCBStruct status_callback;
|
||||
IMStrConvCBStruct strconv_callback;
|
||||
IMSyncXlibStruct sync_xlib;
|
||||
long pad[32];
|
||||
} IMProtocol;
|
||||
|
||||
typedef int (*IMProtoHandler) (NimfXim *, IMProtocol*, void*);
|
||||
|
||||
/* Xi18nAddressRec structure */
|
||||
typedef struct _Xi18nAddressRec
|
||||
{
|
||||
/* XIM_SERVERS target Atoms */
|
||||
Atom selection;
|
||||
Atom Localename;
|
||||
Atom Transportname;
|
||||
/* XIM/XIC Attr */
|
||||
int im_attr_num;
|
||||
XIMAttr *xim_attr;
|
||||
int ic_attr_num;
|
||||
XICAttr *xic_attr;
|
||||
CARD16 preeditAttr_id;
|
||||
CARD16 statusAttr_id;
|
||||
CARD16 separatorAttr_id;
|
||||
/* XIMExtension List */
|
||||
int ext_num;
|
||||
XIMExt extension[COMMON_EXTENSIONS_NUM];
|
||||
/* clients table */
|
||||
Xi18nClient *clients;
|
||||
Xi18nClient *free_clients;
|
||||
} Xi18nAddressRec;
|
||||
|
||||
#endif
|
||||
|
||||
65
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/XimFunc.h
vendored
Normal file
65
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/XimFunc.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/******************************************************************
|
||||
|
||||
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
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef _XimFunc_h
|
||||
#define _XimFunc_h
|
||||
|
||||
/* i18nAttr.c */
|
||||
void _Xi18nInitAttrList (NimfXim *xim);
|
||||
void _Xi18nInitExtension(NimfXim *xim);
|
||||
|
||||
/* i18nClbk.c */
|
||||
int _Xi18nGeometryCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nPreeditStartCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nPreeditDrawCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nPreeditCaretCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nPreeditDoneCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nStatusStartCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nStatusDrawCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nStatusDoneCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
int _Xi18nStringConversionCallback (NimfXim *xim, IMProtocol *call_data);
|
||||
|
||||
/* i18nIc.c */
|
||||
void _Xi18nChangeIC (NimfXim *xim, IMProtocol *call_data, unsigned char *p,
|
||||
int create_flag);
|
||||
void _Xi18nGetIC (NimfXim *xim, IMProtocol *call_data, unsigned char *p);
|
||||
|
||||
/* i18nUtil.c */
|
||||
int _Xi18nNeedSwap (NimfXim *xim, CARD16 connect_id);
|
||||
Xi18nClient *_Xi18nNewClient(NimfXim *xim);
|
||||
Xi18nClient *_Xi18nFindClient (NimfXim *xim, CARD16 connect_id);
|
||||
void _Xi18nDeleteClient (NimfXim *xim, CARD16 connect_id);
|
||||
void _Xi18nSendMessage (NimfXim *xim, CARD16 connect_id, CARD8 major_opcode,
|
||||
CARD8 minor_opcode, unsigned char *data, long length);
|
||||
void _Xi18nSetEventMask (NimfXim *xim, CARD16 connect_id, CARD16 im_id,
|
||||
CARD16 ic_id, CARD32 forward_mask, CARD32 sync_mask);
|
||||
|
||||
#endif
|
||||
211
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/XimProto.h
vendored
Normal file
211
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/XimProto.h
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* $XConsortium: XimProto.h,v 1.2 94/01/20 18:02:24 rws Exp $ */
|
||||
/******************************************************************
|
||||
|
||||
Copyright 1992, 1993, 1994 by FUJITSU LIMITED
|
||||
|
||||
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 FUJITSU LIMITED
|
||||
not be used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission.
|
||||
FUJITSU LIMITED makes no representations about the suitability of
|
||||
this software for any purpose.
|
||||
It is provided "as is" without express or implied warranty.
|
||||
|
||||
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
EVENT SHALL FUJITSU LIMITED 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: Takashi Fujiwara FUJITSU LIMITED
|
||||
fujiwara@a80.tech.yk.fujitsu.co.jp
|
||||
|
||||
This version tidied and debugged by Steve Underwood May 1999
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef _XIMPROTO_H
|
||||
#define _XIMPROTO_H
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
/*
|
||||
* Default Preconnection selection target
|
||||
*/
|
||||
#define XIM_SERVERS "XIM_SERVERS"
|
||||
#define XIM_LOCALES "LOCALES"
|
||||
#define XIM_TRANSPORT "TRANSPORT"
|
||||
|
||||
/*
|
||||
* Xim implementation revision
|
||||
*/
|
||||
#define PROTOCOLMAJORVERSION 0
|
||||
#define PROTOCOLMINORVERSION 0
|
||||
|
||||
/*
|
||||
* Major Protocol number
|
||||
*/
|
||||
#define XIM_CONNECT 1
|
||||
#define XIM_CONNECT_REPLY 2
|
||||
#define XIM_DISCONNECT 3
|
||||
#define XIM_DISCONNECT_REPLY 4
|
||||
|
||||
#define XIM_AUTH_REQUIRED 10
|
||||
#define XIM_AUTH_REPLY 11
|
||||
#define XIM_AUTH_NEXT 12
|
||||
#define XIM_AUTH_SETUP 13
|
||||
#define XIM_AUTH_NG 14
|
||||
|
||||
#define XIM_ERROR 20
|
||||
|
||||
#define XIM_OPEN 30
|
||||
#define XIM_OPEN_REPLY 31
|
||||
#define XIM_CLOSE 32
|
||||
#define XIM_CLOSE_REPLY 33
|
||||
#define XIM_SET_EVENT_MASK 37
|
||||
#define XIM_ENCODING_NEGOTIATION 38
|
||||
#define XIM_ENCODING_NEGOTIATION_REPLY 39
|
||||
#define XIM_QUERY_EXTENSION 40
|
||||
#define XIM_QUERY_EXTENSION_REPLY 41
|
||||
#define XIM_SET_IM_VALUES 42
|
||||
#define XIM_SET_IM_VALUES_REPLY 43
|
||||
#define XIM_GET_IM_VALUES 44
|
||||
#define XIM_GET_IM_VALUES_REPLY 45
|
||||
|
||||
#define XIM_CREATE_IC 50
|
||||
#define XIM_CREATE_IC_REPLY 51
|
||||
#define XIM_DESTROY_IC 52
|
||||
#define XIM_DESTROY_IC_REPLY 53
|
||||
#define XIM_SET_IC_VALUES 54
|
||||
#define XIM_SET_IC_VALUES_REPLY 55
|
||||
#define XIM_GET_IC_VALUES 56
|
||||
#define XIM_GET_IC_VALUES_REPLY 57
|
||||
#define XIM_SET_IC_FOCUS 58
|
||||
#define XIM_UNSET_IC_FOCUS 59
|
||||
#define XIM_FORWARD_EVENT 60
|
||||
#define XIM_SYNC 61
|
||||
#define XIM_SYNC_REPLY 62
|
||||
#define XIM_COMMIT 63
|
||||
#define XIM_RESET_IC 64
|
||||
#define XIM_RESET_IC_REPLY 65
|
||||
|
||||
#define XIM_GEOMETRY 70
|
||||
#define XIM_STR_CONVERSION 71
|
||||
#define XIM_STR_CONVERSION_REPLY 72
|
||||
#define XIM_PREEDIT_START 73
|
||||
#define XIM_PREEDIT_START_REPLY 74
|
||||
#define XIM_PREEDIT_DRAW 75
|
||||
#define XIM_PREEDIT_CARET 76
|
||||
#define XIM_PREEDIT_CARET_REPLY 77
|
||||
#define XIM_PREEDIT_DONE 78
|
||||
#define XIM_STATUS_START 79
|
||||
#define XIM_STATUS_DRAW 80
|
||||
#define XIM_STATUS_DONE 81
|
||||
|
||||
/*
|
||||
* values for the flag of XIM_ERROR
|
||||
*/
|
||||
#define XIM_IMID_VALID 0x0001
|
||||
#define XIM_ICID_VALID 0x0002
|
||||
|
||||
/*
|
||||
* XIM Error Code
|
||||
*/
|
||||
#define XIM_BadAlloc 1
|
||||
#define XIM_BadStyle 2
|
||||
#define XIM_BadClientWindow 3
|
||||
#define XIM_BadFocusWindow 4
|
||||
#define XIM_BadArea 5
|
||||
#define XIM_BadSpotLocation 6
|
||||
#define XIM_BadColormap 7
|
||||
#define XIM_BadAtom 8
|
||||
#define XIM_BadPixel 9
|
||||
#define XIM_BadPixmap 10
|
||||
#define XIM_BadName 11
|
||||
#define XIM_BadCursor 12
|
||||
#define XIM_BadProtocol 13
|
||||
#define XIM_BadForeground 14
|
||||
#define XIM_BadBackground 15
|
||||
#define XIM_LocaleNotSupported 16
|
||||
#define XIM_BadSomething 999
|
||||
|
||||
/*
|
||||
* values for the type of XIMATTR & XICATTR
|
||||
*/
|
||||
#define XimType_SeparatorOfNestedList 0
|
||||
#define XimType_CARD8 1
|
||||
#define XimType_CARD16 2
|
||||
#define XimType_CARD32 3
|
||||
#define XimType_STRING8 4
|
||||
#define XimType_Window 5
|
||||
#define XimType_XIMStyles 10
|
||||
#define XimType_XRectangle 11
|
||||
#define XimType_XPoint 12
|
||||
#define XimType_XFontSet 13
|
||||
#define XimType_XIMOptions 14
|
||||
#define XimType_XIMHotKeyState 16
|
||||
#define XimType_XIMStringConversion 17
|
||||
#define XimType_XIMValuesList 18
|
||||
#define XimType_NEST 0x7FFF
|
||||
|
||||
/*
|
||||
* values for the category of XIM_ENCODING_NEGOTIATON_REPLY
|
||||
*/
|
||||
#define XIM_Encoding_NameCategory 0
|
||||
#define XIM_Encoding_DetailCategory 1
|
||||
|
||||
/*
|
||||
* value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT
|
||||
*/
|
||||
#define XimSYNCHRONUS 0x0001
|
||||
#define XimLookupChars 0x0002
|
||||
#define XimLookupKeySym 0x0004
|
||||
#define XimLookupBoth 0x0006
|
||||
|
||||
/*
|
||||
* request packet header size
|
||||
*/
|
||||
#define XIM_HEADER_SIZE \
|
||||
sizeof(CARD8) /* sizeof mejor-opcode */ \
|
||||
+ sizeof(CARD8) /* sizeof minor-opcode */ \
|
||||
+ sizeof(INT16) /* sizeof length */
|
||||
|
||||
/*
|
||||
* Client Message data size
|
||||
*/
|
||||
#define XIM_CM_DATA_SIZE 20
|
||||
|
||||
/*
|
||||
* XIM data structure
|
||||
*/
|
||||
typedef CARD16 BITMASK16;
|
||||
typedef CARD32 BITMASK32;
|
||||
typedef CARD32 EVENTMASK;
|
||||
|
||||
typedef CARD16 XIMID; /* Input Method ID */
|
||||
typedef CARD16 XICID; /* Input Context ID */
|
||||
|
||||
/*
|
||||
* Padding macro
|
||||
*/
|
||||
#define XIM_PAD(length) ((4 - ((length) % 4)) % 4)
|
||||
|
||||
#define XIM_SET_PAD(ptr, length) \
|
||||
{ \
|
||||
register int Counter = XIM_PAD((int)length); \
|
||||
if (Counter) { \
|
||||
register char *Ptr = (char *)(ptr) + (length); \
|
||||
length += Counter; \
|
||||
for (; Counter; --Counter, ++Ptr) \
|
||||
*Ptr = '\0'; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
501
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nClbk.c
vendored
Normal file
501
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nClbk.c
vendored
Normal file
@@ -0,0 +1,501 @@
|
||||
/******************************************************************
|
||||
|
||||
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 "Xi18n.h"
|
||||
#include "FrameMgr.h"
|
||||
#include "XimFunc.h"
|
||||
#include "nimf-xim.h"
|
||||
#include "i18nX.h"
|
||||
|
||||
int _Xi18nGeometryCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec geometry_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMGeometryCBStruct *geometry_CB =
|
||||
(IMGeometryCBStruct *) &call_data->geometry_callback;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (geometry_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, geometry_CB->icid);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_GEOMETRY,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_GEOMETRY is an asyncronous protocol,
|
||||
so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nPreeditStartCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec preedit_start_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMPreeditCBStruct *preedit_CB =
|
||||
(IMPreeditCBStruct*) &call_data->preedit_callback;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (preedit_start_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage(xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, preedit_CB->icid);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_PREEDIT_START,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nPreeditDrawCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec preedit_draw_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMPreeditCBStruct *preedit_CB =
|
||||
(IMPreeditCBStruct *) &call_data->preedit_callback;
|
||||
XIMPreeditDrawCallbackStruct *draw =
|
||||
(XIMPreeditDrawCallbackStruct *) &preedit_CB->todo.draw;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
register int feedback_count;
|
||||
register int i;
|
||||
BITMASK32 status = 0x0;
|
||||
|
||||
if (draw->text->length == 0)
|
||||
status = 0x00000001;
|
||||
else if (draw->text->feedback[0] == 0)
|
||||
status = 0x00000002;
|
||||
/*endif*/
|
||||
|
||||
fm = FrameMgrInit (preedit_draw_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
/* set length of preedit string */
|
||||
FrameMgrSetSize (fm, draw->text->length);
|
||||
|
||||
/* set iteration count for list of feedback */
|
||||
for (i = 0; draw->text->feedback[i] != 0; i++)
|
||||
;
|
||||
/*endfor*/
|
||||
feedback_count = i;
|
||||
FrameMgrSetIterCount (fm, feedback_count);
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, preedit_CB->icid);
|
||||
FrameMgrPutToken (fm, draw->caret);
|
||||
FrameMgrPutToken (fm, draw->chg_first);
|
||||
FrameMgrPutToken (fm, draw->chg_length);
|
||||
FrameMgrPutToken (fm, status);
|
||||
FrameMgrPutToken (fm, draw->text->length);
|
||||
FrameMgrPutToken (fm, draw->text->string);
|
||||
for (i = 0; i < feedback_count; i++)
|
||||
FrameMgrPutToken (fm, draw->text->feedback[i]);
|
||||
/*endfor*/
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_PREEDIT_DRAW,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_PREEDIT_DRAW is an asyncronous protocol, so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nPreeditCaretCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec preedit_caret_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMPreeditCBStruct *preedit_CB =
|
||||
(IMPreeditCBStruct*) &call_data->preedit_callback;
|
||||
XIMPreeditCaretCallbackStruct *caret =
|
||||
(XIMPreeditCaretCallbackStruct *) &preedit_CB->todo.caret;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (preedit_caret_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, preedit_CB->icid);
|
||||
FrameMgrPutToken (fm, caret->position);
|
||||
FrameMgrPutToken (fm, caret->direction);
|
||||
FrameMgrPutToken (fm, caret->style);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_PREEDIT_CARET,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nPreeditDoneCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec preedit_done_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMPreeditCBStruct *preedit_CB =
|
||||
(IMPreeditCBStruct *) &call_data->preedit_callback;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (preedit_done_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, preedit_CB->icid);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_PREEDIT_DONE,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_PREEDIT_DONE is an asyncronous protocol, so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nStatusStartCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec status_start_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMStatusCBStruct *status_CB =
|
||||
(IMStatusCBStruct*) &call_data->status_callback;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (status_start_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, status_CB->icid);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_STATUS_START,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_STATUS_START is an asyncronous protocol, so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nStatusDrawCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm = (FrameMgr)0;
|
||||
extern XimFrameRec status_draw_text_fr[];
|
||||
extern XimFrameRec status_draw_bitmap_fr[];
|
||||
register int total_size = 0;
|
||||
unsigned char *reply = NULL;
|
||||
IMStatusCBStruct *status_CB =
|
||||
(IMStatusCBStruct *) &call_data->status_callback;
|
||||
XIMStatusDrawCallbackStruct *draw =
|
||||
(XIMStatusDrawCallbackStruct *) &status_CB->todo.draw;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
register int feedback_count;
|
||||
register int i;
|
||||
BITMASK32 status = 0x0;
|
||||
|
||||
switch (draw->type)
|
||||
{
|
||||
case XIMTextType:
|
||||
fm = FrameMgrInit (status_draw_text_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
if (draw->data.text->length == 0)
|
||||
status = 0x00000001;
|
||||
else if (draw->data.text->feedback[0] == 0)
|
||||
status = 0x00000002;
|
||||
/*endif*/
|
||||
|
||||
/* set length of status string */
|
||||
FrameMgrSetSize(fm, draw->data.text->length);
|
||||
/* set iteration count for list of feedback */
|
||||
for (i = 0; draw->data.text->feedback[i] != 0; i++)
|
||||
;
|
||||
/*endfor*/
|
||||
feedback_count = i;
|
||||
FrameMgrSetIterCount (fm, feedback_count);
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, status_CB->icid);
|
||||
FrameMgrPutToken (fm, draw->type);
|
||||
FrameMgrPutToken (fm, status);
|
||||
FrameMgrPutToken (fm, draw->data.text->length);
|
||||
FrameMgrPutToken (fm, draw->data.text->string);
|
||||
for (i = 0; i < feedback_count; i++)
|
||||
FrameMgrPutToken (fm, draw->data.text->feedback[i]);
|
||||
/*endfor*/
|
||||
break;
|
||||
|
||||
case XIMBitmapType:
|
||||
fm = FrameMgrInit (status_draw_bitmap_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, status_CB->icid);
|
||||
FrameMgrPutToken (fm, draw->data.bitmap);
|
||||
break;
|
||||
}
|
||||
/*endswitch*/
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_STATUS_DRAW,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_STATUS_DRAW is an asyncronous protocol, so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nStatusDoneCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec status_done_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMStatusCBStruct *status_CB =
|
||||
(IMStatusCBStruct *) &call_data->status_callback;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (status_done_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, status_CB->icid);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_STATUS_DONE,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_STATUS_DONE is an asyncronous protocol, so return immediately. */
|
||||
return True;
|
||||
}
|
||||
|
||||
int _Xi18nStringConversionCallback (NimfXim *xim, IMProtocol *call_data)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec str_conversion_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
IMStrConvCBStruct *call_back =
|
||||
(IMStrConvCBStruct *) &call_data->strconv_callback;
|
||||
XIMStringConversionCallbackStruct *strconv =
|
||||
(XIMStringConversionCallbackStruct *) &call_back->strconv;
|
||||
CARD16 connect_id = call_data->any.connect_id;
|
||||
|
||||
fm = FrameMgrInit (str_conversion_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, connect_id);
|
||||
FrameMgrPutToken (fm, call_back->icid);
|
||||
FrameMgrPutToken (fm, strconv->position);
|
||||
FrameMgrPutToken (fm, strconv->direction);
|
||||
FrameMgrPutToken (fm, strconv->operation);
|
||||
|
||||
_Xi18nSendMessage (xim, connect_id,
|
||||
XIM_STR_CONVERSION,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
/* XIM_STR_CONVERSION is a syncronous protocol,
|
||||
so should wait here for XIM_STR_CONVERSION_REPLY. */
|
||||
if (Xi18nXWait (xim, connect_id, XIM_STR_CONVERSION_REPLY, 0) == False)
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
773
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nIMProto.c
vendored
Normal file
773
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nIMProto.c
vendored
Normal file
@@ -0,0 +1,773 @@
|
||||
/******************************************************************
|
||||
Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
Copyright 1993, 1994 by Hewlett-Packard Company
|
||||
|
||||
Copyright 1994, 1995 by Sun Microsystems, Inc.
|
||||
|
||||
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 names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL WARRANTIES WITH REGARD
|
||||
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL DIGITAL 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: Hiroyuki Miyamoto Digital Equipment Corporation
|
||||
miyamoto@jrd.dec.com
|
||||
Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
|
||||
|
||||
This version tidied and debugged by Steve Underwood May 1999
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/* Protocol Packet frames */
|
||||
|
||||
#include "FrameMgr.h"
|
||||
|
||||
/* Data type definitions */
|
||||
|
||||
static XimFrameRec ximattr_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* attribute ID */
|
||||
_FRAME(BIT16), /* type of the value */
|
||||
_FRAME(BIT16), /* length of im-attribute */
|
||||
_FRAME(BARRAY), /* im-attribute */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec xicattr_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* attribute ID */
|
||||
_FRAME(BIT16), /* type of the value */
|
||||
_FRAME(BIT16), /* length of ic-attribute */
|
||||
_FRAME(BARRAY), /* ic-attribute */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec ximattribute_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* attribute ID */
|
||||
_FRAME(BIT16), /* value length */
|
||||
_FRAME(BARRAY), /* value */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec xicattribute_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* attribute ID */
|
||||
_FRAME(BIT16), /* value length */
|
||||
_FRAME(BARRAY), /* value */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec ximtriggerkey_fr[] =
|
||||
{
|
||||
_FRAME(BIT32), /* keysym */
|
||||
_FRAME(BIT32), /* modifier */
|
||||
_FRAME(BIT32), /* modifier mask */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec encodinginfo_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* length of encoding info */
|
||||
_FRAME(BARRAY), /* encoding info */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec str_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* number of byte */
|
||||
_FRAME(BARRAY), /* string */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec xpcs_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* length of string in bytes */
|
||||
_FRAME(BARRAY), /* string */
|
||||
_PAD4(2),
|
||||
};
|
||||
|
||||
static XimFrameRec ext_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* extension major-opcode */
|
||||
_FRAME(BIT8), /* extension minor-opcode */
|
||||
_FRAME(BIT16), /* length of extension name */
|
||||
_FRAME(BARRAY), /* extension name */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
static XimFrameRec inputstyle_fr[] =
|
||||
{
|
||||
_FRAME(BIT32), /* inputstyle */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
/* Protocol definitions */
|
||||
|
||||
xim_externaldef XimFrameRec attr_head_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* attribute id */
|
||||
_FRAME(BIT16), /* attribute length */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec short_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* value */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec long_fr[] =
|
||||
{
|
||||
_FRAME(BIT32), /* value */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec xrectangle_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* x */
|
||||
_FRAME(BIT16), /* y */
|
||||
_FRAME(BIT16), /* width */
|
||||
_FRAME(BIT16), /* height */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec xpoint_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* x */
|
||||
_FRAME(BIT16), /* y */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec fontset_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* length of base font name */
|
||||
_FRAME(BARRAY), /* base font name list */
|
||||
_PAD4(2), /* unused */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec input_styles_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* number of list */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(ITER), /* XIMStyle list */
|
||||
_FRAME(POINTER),
|
||||
_PTR(inputstyle_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec packet_header_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* major-opcode */
|
||||
_FRAME(BIT8), /* minor-opcode */
|
||||
_FRAME(BIT16), /* length */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec error_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_FRAME(BIT16), /* Error Code */
|
||||
_FRAME(BIT16), /* length of error detail */
|
||||
_FRAME(BIT16), /* type of error detail */
|
||||
_FRAME(BARRAY), /* error detail */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec connect_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* byte order */
|
||||
_PAD2(1), /* unused */
|
||||
_FRAME(BIT16), /* client-major-protocol-version */
|
||||
_FRAME(BIT16), /* client-minor-protocol-version */
|
||||
_BYTE_COUNTER(BIT16, 1), /* length of client-auth-protocol-names */
|
||||
_FRAME(ITER), /* client-auth-protocol-names */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xpcs_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec connect_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* server-major-protocol-version */
|
||||
_FRAME(BIT16), /* server-minor-protocol-version */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec auth_required_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* auth-protocol-index */
|
||||
_FRAME(BIT8), /* auth-data1 */
|
||||
_FRAME(BARRAY), /* auth-data2 */
|
||||
_PAD4(3),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
|
||||
xim_externaldef XimFrameRec auth_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT8),
|
||||
_FRAME(BARRAY),
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec auth_next_fr[] =
|
||||
{
|
||||
_FRAME(BIT8), /* auth-data1 */
|
||||
_FRAME(BARRAY), /* auth-data2 */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec auth_setup_fr[] =
|
||||
{
|
||||
_BYTE_COUNTER(BIT16, 2), /* number of client-auth-protocol-names */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(ITER), /* server-auth-protocol-names */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xpcs_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec auth_ng_fr[] =
|
||||
{
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec disconnect_fr[] =
|
||||
{
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec disconnect_reply_fr[] =
|
||||
{
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec open_fr[] =
|
||||
{
|
||||
_FRAME(POINTER), /* locale name */
|
||||
_PTR(str_fr),
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec open_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of IM attributes supported */
|
||||
_FRAME(ITER), /* IM attribute supported */
|
||||
_FRAME(POINTER),
|
||||
_PTR(ximattr_fr),
|
||||
_BYTE_COUNTER(BIT16, 2), /* number of IC attribute supported */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(ITER), /* IC attribute supported */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xicattr_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec close_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec close_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec register_triggerkeys_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_PAD4(1), /* unused */
|
||||
_BYTE_COUNTER(BIT32, 1), /* byte length of on-keys */
|
||||
_FRAME(ITER), /* on-keys list */
|
||||
_FRAME(POINTER),
|
||||
_PTR(ximtriggerkey_fr),
|
||||
_BYTE_COUNTER(BIT32, 1), /* byte length of off-keys */
|
||||
_FRAME(ITER), /* off-keys list */
|
||||
_FRAME(POINTER),
|
||||
_PTR(ximtriggerkey_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec trigger_notify_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-mehotd-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* flag */
|
||||
_FRAME(BIT32), /* index of keys list */
|
||||
_FRAME(BIT32), /* client-select-event-mask */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec trigger_notify_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec set_event_mask_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* forward-event-mask */
|
||||
_FRAME(BIT32), /* synchronous-event-mask */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec encoding_negotiation_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of encodings listed by name */
|
||||
_FRAME(ITER), /* supported list of encoding in IM library */
|
||||
_FRAME(POINTER),
|
||||
_PTR(str_fr),
|
||||
_PAD4(1),
|
||||
_BYTE_COUNTER(BIT16, 2), /* byte length of encodings listed by
|
||||
detailed data */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* list of encodings supported in the
|
||||
IM library */
|
||||
_FRAME(POINTER),
|
||||
_PTR(encodinginfo_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec encoding_negotiation_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* category of the encoding determined */
|
||||
_FRAME(BIT16), /* index of the encoding dterminated */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec query_extension_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of extensions supported
|
||||
by the IM library */
|
||||
_FRAME(ITER), /* extensions supported by the IM library */
|
||||
_FRAME(POINTER),
|
||||
_PTR(str_fr),
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec query_extension_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of extensions supported
|
||||
by the IM server */
|
||||
_FRAME(ITER), /* list of extensions supported by the
|
||||
IM server */
|
||||
_FRAME(POINTER),
|
||||
_PTR(ext_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec get_im_values_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of im-attribute-id */
|
||||
_FRAME(ITER), /* im-attribute-id */
|
||||
_FRAME(BIT16),
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec get_im_values_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of im-attribute returned */
|
||||
_FRAME(ITER), /* im-attribute returned */
|
||||
_FRAME(POINTER),
|
||||
_PTR(ximattribute_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec create_ic_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of ic-attributes */
|
||||
_FRAME(ITER), /* ic-attributes */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xicattribute_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec create_ic_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec destroy_ic_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec destroy_ic_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec set_ic_values_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_BYTE_COUNTER(BIT16, 2), /* byte length of ic-attributes */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* ic-attribute */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xicattribute_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec set_ic_values_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec get_ic_values_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of ic-attribute-id */
|
||||
_FRAME(ITER), /* ic-attribute */
|
||||
_FRAME(BIT16),
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec get_ic_values_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_BYTE_COUNTER(BIT16, 2), /* byte length of ic-attribute */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* ic-attribute */
|
||||
_FRAME(POINTER),
|
||||
_PTR(xicattribute_fr),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec set_ic_focus_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec unset_ic_focus_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec forward_event_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_FRAME(BIT16), /* sequence number */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec wire_keyevent_fr[] = {
|
||||
_FRAME(BIT8), /* type */
|
||||
_FRAME(BIT8), /* detail */
|
||||
_FRAME(BIT16), /* serial number */
|
||||
_FRAME(BIT32), /* time */
|
||||
_FRAME(BIT32), /* root */
|
||||
_FRAME(BIT32), /* window */
|
||||
_FRAME(BIT32), /* subwindow */
|
||||
_FRAME(BIT16), /* rootX */
|
||||
_FRAME(BIT16), /* rootY */
|
||||
_FRAME(BIT16), /* X */
|
||||
_FRAME(BIT16), /* Y */
|
||||
_FRAME(BIT16), /* state */
|
||||
_FRAME(BIT8), /* sameScreen */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec sync_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec sync_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
#if 0
|
||||
xim_externaldef XimFrameRec commit_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_FRAME(BIT16), /* byte length of committed string */
|
||||
_FRAME(BARRAY), /* committed string */
|
||||
_PAD4(1),
|
||||
_BYTE_COUNTER(BIT16, 1), /* byte length of keysym */
|
||||
_FRAME(ITER), /* keysym */
|
||||
_FRAME(BIT32),
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
#endif
|
||||
|
||||
xim_externaldef XimFrameRec commit_chars_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_FRAME(BIT16), /* byte length of committed string */
|
||||
_FRAME(BARRAY), /* committed string */
|
||||
_PAD4(1),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec commit_both_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_PAD4(1), /* unused */
|
||||
_FRAME(BIT32), /* keysym */
|
||||
_FRAME(BIT16), /* byte length of committed string */
|
||||
_FRAME(BARRAY), /* committed string */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec reset_ic_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec reset_ic_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* byte length of committed string */
|
||||
_FRAME(BARRAY), /* committed string */
|
||||
_PAD4(2),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec geometry_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec str_conversion_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* XIMStringConversionPosition */
|
||||
_FRAME(BIT32), /* XIMStringConversionType */
|
||||
_FRAME(BIT32), /* XIMStringConversionOperation */
|
||||
_FRAME(BIT16), /* length to multiply the
|
||||
XIMStringConversionType */
|
||||
_FRAME(BIT16), /* length of the string to be
|
||||
substituted */
|
||||
#if 0
|
||||
_FRAME(BARRAY), /* string */
|
||||
_PAD4(1),
|
||||
#endif
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec str_conversion_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* XIMStringConversionFeedback */
|
||||
_FRAME(BIT16), /* length of the retrieved string */
|
||||
_FRAME(BARRAY), /* retrieved string */
|
||||
_PAD4(2),
|
||||
_BYTE_COUNTER(BIT16, 2), /* number of feedback array */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* feedback array */
|
||||
_FRAME(BIT32),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_start_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_start_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* return value */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_draw_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* caret */
|
||||
_FRAME(BIT32), /* chg_first */
|
||||
_FRAME(BIT32), /* chg_length */
|
||||
_FRAME(BIT32), /* status */
|
||||
_FRAME(BIT16), /* length of preedit string */
|
||||
_FRAME(BARRAY), /* preedit string */
|
||||
_PAD4(2),
|
||||
_BYTE_COUNTER(BIT16, 2), /* number of feedback array */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* feedback array */
|
||||
_FRAME(BIT32),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_caret_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* position */
|
||||
_FRAME(BIT32), /* direction */
|
||||
_FRAME(BIT32), /* style */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_caret_reply_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* position */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec preedit_done_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec status_start_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec status_draw_text_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* type */
|
||||
_FRAME(BIT32), /* status */
|
||||
_FRAME(BIT16), /* length of status string */
|
||||
_FRAME(BARRAY), /* status string */
|
||||
_PAD4(2),
|
||||
_BYTE_COUNTER(BIT16, 2), /* number of feedback array */
|
||||
_PAD4(1),
|
||||
_FRAME(ITER), /* feedback array */
|
||||
_FRAME(BIT32),
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec status_draw_bitmap_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* type */
|
||||
_FRAME(BIT32), /* pixmap data */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec status_done_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec ext_set_event_mask_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT32), /* filter-event-mask */
|
||||
_FRAME(BIT32), /* intercept-event-mask */
|
||||
_FRAME(BIT32), /* select-event-mask */
|
||||
_FRAME(BIT32), /* forward-event-mask */
|
||||
_FRAME(BIT32), /* synchronous-event-mask */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec ext_forward_keyevent_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* flag */
|
||||
_FRAME(BIT16), /* sequence number */
|
||||
_FRAME(BIT8), /* xEvent.u.u.type */
|
||||
_FRAME(BIT8), /* keycode */
|
||||
_FRAME(BIT16), /* state */
|
||||
_FRAME(BIT32), /* time */
|
||||
_FRAME(BIT32), /* window */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
|
||||
xim_externaldef XimFrameRec ext_move_fr[] =
|
||||
{
|
||||
_FRAME(BIT16), /* input-method-ID */
|
||||
_FRAME(BIT16), /* input-context-ID */
|
||||
_FRAME(BIT16), /* X */
|
||||
_FRAME(BIT16), /* Y */
|
||||
_FRAME(EOL),
|
||||
};
|
||||
1051
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nIc.c
vendored
Normal file
1051
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nIc.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
537
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nMethod.c
vendored
Normal file
537
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nMethod.c
vendored
Normal file
@@ -0,0 +1,537 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/******************************************************************
|
||||
|
||||
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 "i18nMethod.h"
|
||||
#include "FrameMgr.h"
|
||||
#include "Xi18n.h"
|
||||
#include "XimFunc.h"
|
||||
#include <glib.h>
|
||||
|
||||
/* How to generate SUPPORTED_LOCALES
|
||||
#!/usr/bin/ruby
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
require 'set'
|
||||
|
||||
set = Set.new
|
||||
|
||||
File.open("/usr/share/i18n/SUPPORTED", "r").each do |line|
|
||||
set << line.split(/_| /)[0]
|
||||
end
|
||||
|
||||
puts set.to_a.join(",")
|
||||
*/
|
||||
#define SUPPORTED_LOCALES \
|
||||
"aa,af,agr,ak,am,an,anp,ar,ayc,az,as,ast,be,bem,ber,bg,bhb,bho,bi,bn,bo," \
|
||||
"br,brx,bs,byn,ca,ce,chr,cmn,crh,cs,csb,cv,cy,da,de,doi,dsb,dv,dz,el,en," \
|
||||
"eo,es,et,eu,fa,ff,fi,fil,fo,fr,fur,fy,ga,gd,gez,gl,gu,gv,ha,hak,he,hi," \
|
||||
"hif,hne,hr,hsb,ht,hu,hy,ia,id,ig,ik,is,it,iu,ja,ka,kab,kk,kl,km,kn,ko," \
|
||||
"kok,ks,ku,kw,ky,lb,lg,li,lij,ln,lo,lt,lv,lzh,mag,mai,mfe,mg,mhr,mi,miq," \
|
||||
"mjw,mk,ml,mn,mni,mr,ms,mt,my,nan,nb,nds,ne,nhn,niu,nl,nn,nr,nso,oc,om,or," \
|
||||
"os,pa,pap,pl,ps,pt,quz,raj,ro,ru,rw,sa,sah,sat,sc,sd,se,sgs,shn,shs,si," \
|
||||
"sid,sk,sl,sm,so,sq,sr,ss,st,sv,sw,szl,ta,tcy,te,tg,th,the,ti,tig,tk,tl," \
|
||||
"tn,to,tpi,tr,ts,tt,ug,uk,unm,ur,uz,ve,vi,wa,wae,wal,wo,xh,yi,yo,yue,yuw," \
|
||||
"zh,zu"
|
||||
|
||||
extern Xi18nClient *_Xi18nFindClient (NimfXim *, CARD16);
|
||||
|
||||
#ifndef XIM_SERVERS
|
||||
#define XIM_SERVERS "XIM_SERVERS"
|
||||
#endif
|
||||
static Atom XIM_Servers = None;
|
||||
|
||||
static int SetXi18nSelectionOwner (NimfXim *xim, Window im_window)
|
||||
{
|
||||
Window root = RootWindow (xim->display, DefaultScreen (xim->display));
|
||||
Atom realtype;
|
||||
int realformat;
|
||||
unsigned long bytesafter;
|
||||
long *data=NULL;
|
||||
unsigned long length;
|
||||
Atom atom;
|
||||
int i;
|
||||
int found;
|
||||
int forse = False;
|
||||
|
||||
if ((atom = XInternAtom (xim->display, "@server=nimf", False)) == 0)
|
||||
return False;
|
||||
|
||||
xim->address.selection = atom;
|
||||
|
||||
if (XIM_Servers == None)
|
||||
XIM_Servers = XInternAtom (xim->display, XIM_SERVERS, False);
|
||||
/*endif*/
|
||||
XGetWindowProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
0L,
|
||||
1000000L,
|
||||
False,
|
||||
XA_ATOM,
|
||||
&realtype,
|
||||
&realformat,
|
||||
&length,
|
||||
&bytesafter,
|
||||
(unsigned char **) (&data));
|
||||
if (realtype != None && (realtype != XA_ATOM || realformat != 32)) {
|
||||
if (data != NULL)
|
||||
XFree ((char *) data);
|
||||
return False;
|
||||
}
|
||||
|
||||
found = False;
|
||||
for (i = 0; i < length; i++) {
|
||||
if (data[i] == atom) {
|
||||
Window owner;
|
||||
found = True;
|
||||
if ((owner = XGetSelectionOwner (xim->display, atom)) != im_window) {
|
||||
if (owner == None || forse == True)
|
||||
XSetSelectionOwner (xim->display, atom, im_window, CurrentTime);
|
||||
else
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found == False) {
|
||||
XSetSelectionOwner (xim->display, atom, im_window, CurrentTime);
|
||||
XChangeProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModePrepend,
|
||||
(unsigned char *) &atom,
|
||||
1);
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* We always need to generate the PropertyNotify to the Root Window
|
||||
*/
|
||||
XChangeProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModePrepend,
|
||||
(unsigned char *) data,
|
||||
0);
|
||||
}
|
||||
if (data != NULL)
|
||||
XFree ((char *) data);
|
||||
|
||||
/* Intern "LOCALES" and "TRANSOPORT" Target Atoms */
|
||||
xim->address.Localename = XInternAtom (xim->display, LOCALES, False);
|
||||
xim->address.Transportname = XInternAtom (xim->display, TRANSPORT, False);
|
||||
return (XGetSelectionOwner (xim->display, atom) == im_window);
|
||||
}
|
||||
|
||||
static int DeleteXi18nAtom (NimfXim *xim)
|
||||
{
|
||||
Window root = RootWindow (xim->display, DefaultScreen (xim->display));
|
||||
Atom realtype;
|
||||
int realformat;
|
||||
unsigned long bytesafter;
|
||||
long *data=NULL;
|
||||
unsigned long length;
|
||||
Atom atom;
|
||||
int i, ret;
|
||||
int found;
|
||||
|
||||
if ((atom = XInternAtom (xim->display, "@server=nimf", False)) == 0)
|
||||
return False;
|
||||
|
||||
xim->address.selection = atom;
|
||||
|
||||
if (XIM_Servers == None)
|
||||
XIM_Servers = XInternAtom (xim->display, XIM_SERVERS, False);
|
||||
XGetWindowProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
0L,
|
||||
1000000L,
|
||||
False,
|
||||
XA_ATOM,
|
||||
&realtype,
|
||||
&realformat,
|
||||
&length,
|
||||
&bytesafter,
|
||||
(unsigned char **) (&data));
|
||||
if (realtype != XA_ATOM || realformat != 32) {
|
||||
if (data != NULL)
|
||||
XFree ((char *) data);
|
||||
return False;
|
||||
}
|
||||
|
||||
found = False;
|
||||
for (i = 0; i < length; i++) {
|
||||
if (data[i] == atom) {
|
||||
found = True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found == True) {
|
||||
for (i=i+1; i<length; i++)
|
||||
data[i-1] = data[i];
|
||||
XChangeProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)data,
|
||||
length-1);
|
||||
ret = True;
|
||||
}
|
||||
else {
|
||||
XChangeProperty (xim->display,
|
||||
root,
|
||||
XIM_Servers,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModePrepend,
|
||||
(unsigned char *)data,
|
||||
0);
|
||||
ret = False;
|
||||
}
|
||||
if (data != NULL)
|
||||
XFree ((char *) data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ReturnSelectionNotify (NimfXim *xim, XSelectionRequestEvent *ev)
|
||||
{
|
||||
XEvent event;
|
||||
const char *data = NULL;
|
||||
|
||||
event.type = SelectionNotify;
|
||||
event.xselection.requestor = ev->requestor;
|
||||
event.xselection.selection = ev->selection;
|
||||
event.xselection.target = ev->target;
|
||||
event.xselection.time = ev->time;
|
||||
event.xselection.property = ev->property;
|
||||
|
||||
if (ev->target == xim->address.Localename)
|
||||
data = "@locale=C" SUPPORTED_LOCALES;
|
||||
else if (ev->target == xim->address.Transportname)
|
||||
data = "@transport=X/";
|
||||
|
||||
XChangeProperty (xim->display,
|
||||
event.xselection.requestor,
|
||||
ev->target,
|
||||
ev->target,
|
||||
8,
|
||||
PropModeReplace,
|
||||
(unsigned char *) data,
|
||||
strlen (data));
|
||||
XSendEvent (xim->display, event.xselection.requestor, False, NoEventMask, &event);
|
||||
XFlush (xim->display);
|
||||
}
|
||||
|
||||
Bool
|
||||
WaitXSelectionRequest (NimfXim *xim,
|
||||
XEvent *ev)
|
||||
{
|
||||
if (((XSelectionRequestEvent *) ev)->selection == xim->address.selection)
|
||||
{
|
||||
ReturnSelectionNotify (xim, (XSelectionRequestEvent *) ev);
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
Status
|
||||
xi18n_openIM (NimfXim *xim, Window im_window)
|
||||
{
|
||||
if (!SetXi18nSelectionOwner (xim, im_window))
|
||||
return False;
|
||||
|
||||
xim->_protocol = XInternAtom (xim->display, "_XIM_PROTOCOL", False);
|
||||
xim->_xconnect = XInternAtom (xim->display, "_XIM_XCONNECT", False);
|
||||
|
||||
XFlush (xim->display);
|
||||
return True;
|
||||
}
|
||||
|
||||
Status xi18n_closeIM (NimfXim *xim)
|
||||
{
|
||||
DeleteXi18nAtom (xim);
|
||||
return True;
|
||||
}
|
||||
|
||||
static void EventToWireEvent (XEvent *ev, xEvent *event,
|
||||
CARD16 *serial, Bool byte_swap)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec wire_keyevent_fr[];
|
||||
extern XimFrameRec short_fr[];
|
||||
BYTE b;
|
||||
CARD16 c16;
|
||||
CARD32 c32;
|
||||
|
||||
*serial = (CARD16)(ev->xany.serial >> 16);
|
||||
switch (ev->type) {
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
{
|
||||
XKeyEvent *kev = (XKeyEvent*)ev;
|
||||
/* create FrameMgr */
|
||||
fm = FrameMgrInit(wire_keyevent_fr, (char *)(&(event->u)), byte_swap);
|
||||
|
||||
/* set values */
|
||||
b = (BYTE)kev->type; FrameMgrPutToken(fm, b);
|
||||
b = (BYTE)kev->keycode; FrameMgrPutToken(fm, b);
|
||||
c16 = (CARD16)(kev->serial & (unsigned long)0xffff);
|
||||
FrameMgrPutToken(fm, c16);
|
||||
c32 = (CARD32)kev->time; FrameMgrPutToken(fm, c32);
|
||||
c32 = (CARD32)kev->root; FrameMgrPutToken(fm, c32);
|
||||
c32 = (CARD32)kev->window; FrameMgrPutToken(fm, c32);
|
||||
c32 = (CARD32)kev->subwindow; FrameMgrPutToken(fm, c32);
|
||||
c16 = (CARD16)kev->x_root; FrameMgrPutToken(fm, c16);
|
||||
c16 = (CARD16)kev->y_root; FrameMgrPutToken(fm, c16);
|
||||
c16 = (CARD16)kev->x; FrameMgrPutToken(fm, c16);
|
||||
c16 = (CARD16)kev->y; FrameMgrPutToken(fm, c16);
|
||||
c16 = (CARD16)kev->state; FrameMgrPutToken(fm, c16);
|
||||
b = (BYTE)kev->same_screen; FrameMgrPutToken(fm, b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* create FrameMgr */
|
||||
fm = FrameMgrInit(short_fr, (char *)(&(event->u.u.sequenceNumber)),
|
||||
byte_swap);
|
||||
c16 = (CARD16)(ev->xany.serial & (unsigned long)0xffff);
|
||||
FrameMgrPutToken(fm, c16);
|
||||
break;
|
||||
}
|
||||
/* free FrameMgr */
|
||||
FrameMgrFree(fm);
|
||||
}
|
||||
|
||||
Status xi18n_forwardEvent (NimfXim *xim, XPointer xp)
|
||||
{
|
||||
IMForwardEventStruct *call_data = (IMForwardEventStruct *)xp;
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec forward_event_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
unsigned char *replyp;
|
||||
CARD16 serial;
|
||||
int event_size;
|
||||
Xi18nClient *client;
|
||||
|
||||
client = (Xi18nClient *) _Xi18nFindClient (xim, call_data->connect_id);
|
||||
|
||||
/* create FrameMgr */
|
||||
fm = FrameMgrInit (forward_event_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, call_data->connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
event_size = sizeof (xEvent);
|
||||
reply = (unsigned char *) malloc (total_size + event_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim,
|
||||
call_data->connect_id,
|
||||
XIM_ERROR,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size + event_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
replyp = reply;
|
||||
|
||||
call_data->sync_bit = 1; /* always sync */
|
||||
client->sync = True;
|
||||
|
||||
FrameMgrPutToken (fm, call_data->connect_id);
|
||||
FrameMgrPutToken (fm, call_data->icid);
|
||||
FrameMgrPutToken (fm, call_data->sync_bit);
|
||||
|
||||
replyp += total_size;
|
||||
EventToWireEvent (&(call_data->event),
|
||||
(xEvent *) replyp,
|
||||
&serial,
|
||||
_Xi18nNeedSwap (xim, call_data->connect_id));
|
||||
|
||||
FrameMgrPutToken (fm, serial);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
call_data->connect_id,
|
||||
XIM_FORWARD_EVENT,
|
||||
0,
|
||||
reply,
|
||||
total_size + event_size);
|
||||
|
||||
XFree (reply);
|
||||
FrameMgrFree (fm);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
Status xi18n_commit (NimfXim *xim, XPointer xp)
|
||||
{
|
||||
IMCommitStruct *call_data = (IMCommitStruct *)xp;
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec commit_chars_fr[];
|
||||
extern XimFrameRec commit_both_fr[];
|
||||
register int total_size;
|
||||
unsigned char *reply = NULL;
|
||||
CARD16 str_length;
|
||||
|
||||
call_data->flag |= XimSYNCHRONUS; /* always sync */
|
||||
|
||||
if (!(call_data->flag & XimLookupKeySym)
|
||||
&&
|
||||
(call_data->flag & XimLookupChars))
|
||||
{
|
||||
fm = FrameMgrInit (commit_chars_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, call_data->connect_id));
|
||||
|
||||
/* set length of STRING8 */
|
||||
str_length = strlen (call_data->commit_string);
|
||||
FrameMgrSetSize (fm, str_length);
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim,
|
||||
call_data->connect_id,
|
||||
XIM_ERROR,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
str_length = FrameMgrGetSize (fm);
|
||||
FrameMgrPutToken (fm, call_data->connect_id);
|
||||
FrameMgrPutToken (fm, call_data->icid);
|
||||
FrameMgrPutToken (fm, call_data->flag);
|
||||
FrameMgrPutToken (fm, str_length);
|
||||
FrameMgrPutToken (fm, call_data->commit_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
fm = FrameMgrInit (commit_both_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, call_data->connect_id));
|
||||
/* set length of STRING8 */
|
||||
str_length = strlen (call_data->commit_string);
|
||||
if (str_length > 0)
|
||||
FrameMgrSetSize (fm, str_length);
|
||||
/*endif*/
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
{
|
||||
_Xi18nSendMessage (xim,
|
||||
call_data->connect_id,
|
||||
XIM_ERROR,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
FrameMgrPutToken (fm, call_data->connect_id);
|
||||
FrameMgrPutToken (fm, call_data->icid);
|
||||
FrameMgrPutToken (fm, call_data->flag);
|
||||
FrameMgrPutToken (fm, call_data->keysym);
|
||||
if (str_length > 0)
|
||||
{
|
||||
str_length = FrameMgrGetSize (fm);
|
||||
FrameMgrPutToken (fm, str_length);
|
||||
FrameMgrPutToken (fm, call_data->commit_string);
|
||||
}
|
||||
/*endif*/
|
||||
}
|
||||
/*endif*/
|
||||
_Xi18nSendMessage (xim,
|
||||
call_data->connect_id,
|
||||
XIM_COMMIT,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
FrameMgrFree (fm);
|
||||
XFree (reply);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
int nimf_xim_call_callback (NimfXim *xim, XPointer xp)
|
||||
{
|
||||
IMProtocol *call_data = (IMProtocol *)xp;
|
||||
switch (call_data->major_code)
|
||||
{
|
||||
case XIM_GEOMETRY:
|
||||
return _Xi18nGeometryCallback (xim, call_data);
|
||||
|
||||
case XIM_PREEDIT_START:
|
||||
return _Xi18nPreeditStartCallback (xim, call_data);
|
||||
|
||||
case XIM_PREEDIT_DRAW:
|
||||
return _Xi18nPreeditDrawCallback (xim, call_data);
|
||||
|
||||
case XIM_PREEDIT_CARET:
|
||||
return _Xi18nPreeditCaretCallback (xim, call_data);
|
||||
|
||||
case XIM_PREEDIT_DONE:
|
||||
return _Xi18nPreeditDoneCallback (xim, call_data);
|
||||
|
||||
case XIM_STATUS_START:
|
||||
return _Xi18nStatusStartCallback (xim, call_data);
|
||||
|
||||
case XIM_STATUS_DRAW:
|
||||
return _Xi18nStatusDrawCallback (xim, call_data);
|
||||
|
||||
case XIM_STATUS_DONE:
|
||||
return _Xi18nStatusDoneCallback (xim, call_data);
|
||||
|
||||
case XIM_STR_CONVERSION:
|
||||
return _Xi18nStringConversionCallback (xim, call_data);
|
||||
}
|
||||
/*endswitch*/
|
||||
return False;
|
||||
}
|
||||
54
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nMethod.h
vendored
Normal file
54
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nMethod.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/******************************************************************
|
||||
|
||||
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
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef I18N_METHOD_H
|
||||
#define I18N_METHOD_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#ifndef NEED_EVENTS
|
||||
#define NEED_EVENTS
|
||||
#endif
|
||||
#include <X11/Xproto.h>
|
||||
#undef NEED_EVENTS
|
||||
|
||||
#include "nimf-xim.h"
|
||||
|
||||
Bool WaitXSelectionRequest (NimfXim *xim, XEvent *ev);
|
||||
int nimf_xim_call_callback (NimfXim *, XPointer);
|
||||
|
||||
Status xi18n_openIM (NimfXim *, Window);
|
||||
Status xi18n_closeIM (NimfXim *);
|
||||
Status xi18n_forwardEvent (NimfXim *, XPointer);
|
||||
Status xi18n_commit (NimfXim *, XPointer);
|
||||
int xi18n_syncXlib (NimfXim *, XPointer);
|
||||
|
||||
#endif /* I18N_METHOD_H */
|
||||
97
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nOffsetCache.c
vendored
Normal file
97
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nOffsetCache.c
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/*
|
||||
* Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* 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
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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: Klemens Baum <klemensbaum@gmail.com>
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <stddef.h>
|
||||
#include "Xi18n.h"
|
||||
|
||||
/*
|
||||
* The XIM specification does not limit the number of window properties
|
||||
* that can be used to transfer data, but Xlib uses the atom strings
|
||||
* _client0 through _client20.
|
||||
*
|
||||
* So use that as a sensible initial size for the offset cache.
|
||||
*/
|
||||
#define INITIAL_OFFSET_CACHE_CAPACITY 21
|
||||
#define OFFSET_CACHE_GROWTH_FACTOR 2
|
||||
|
||||
void _Xi18nInitOffsetCache (Xi18nOffsetCache *offset_cache)
|
||||
{
|
||||
offset_cache->size = 0;
|
||||
offset_cache->capacity = INITIAL_OFFSET_CACHE_CAPACITY;
|
||||
offset_cache->data = (Xi18nAtomOffsetPair *) malloc (
|
||||
INITIAL_OFFSET_CACHE_CAPACITY * sizeof (Xi18nAtomOffsetPair));
|
||||
}
|
||||
|
||||
unsigned long _Xi18nLookupPropertyOffset (Xi18nOffsetCache *offset_cache,
|
||||
Atom key)
|
||||
{
|
||||
Xi18nAtomOffsetPair *data;
|
||||
size_t i;
|
||||
|
||||
data = offset_cache->data;
|
||||
for (i = 0; i < offset_cache->size; ++i) {
|
||||
if (data[i].key == key) {
|
||||
return data[i].offset;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _Xi18nSetPropertyOffset (Xi18nOffsetCache *offset_cache, Atom key,
|
||||
unsigned long offset)
|
||||
{
|
||||
Xi18nAtomOffsetPair *data = offset_cache->data;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < offset_cache->size; ++i) {
|
||||
if (data[i].key == key) {
|
||||
data[i].offset = offset;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (++offset_cache->size > offset_cache->capacity) {
|
||||
offset_cache->capacity *= OFFSET_CACHE_GROWTH_FACTOR;
|
||||
offset_cache->data = (Xi18nAtomOffsetPair *) realloc (data,
|
||||
offset_cache->capacity * sizeof (Xi18nAtomOffsetPair));
|
||||
if (offset_cache->data == NULL) {
|
||||
offset_cache->data = data;
|
||||
--offset_cache->size;
|
||||
}
|
||||
data = offset_cache->data;
|
||||
}
|
||||
|
||||
if (offset_cache->size > 0) {
|
||||
data[i].key = key;
|
||||
data[i].offset = offset;
|
||||
}
|
||||
}
|
||||
|
||||
1519
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nPtHdr.c
vendored
Normal file
1519
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nPtHdr.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
215
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nUtil.c
vendored
Normal file
215
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nUtil.c
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/******************************************************************
|
||||
|
||||
Copyright (C) 1994-1995 Sun Microsystems, Inc.
|
||||
Copyright (C) 1993-1994 Hewlett-Packard Company
|
||||
Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
|
||||
Copyright (C) 2014 Red Hat, Inc.
|
||||
|
||||
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 "Xi18n.h"
|
||||
#include "FrameMgr.h"
|
||||
#include "XimFunc.h"
|
||||
#include "nimf-xim.h"
|
||||
#include "i18nX.h"
|
||||
|
||||
Xi18nClient *_Xi18nFindClient (NimfXim *, CARD16);
|
||||
void _Xi18nInitOffsetCache (Xi18nOffsetCache *);
|
||||
|
||||
int
|
||||
_Xi18nNeedSwap (NimfXim *xim, CARD16 connect_id)
|
||||
{
|
||||
Xi18nClient *client = _Xi18nFindClient (xim, connect_id);
|
||||
|
||||
return (client->byte_order != xim->byte_order);
|
||||
}
|
||||
|
||||
Xi18nClient *_Xi18nNewClient (NimfXim *xim)
|
||||
{
|
||||
static CARD16 connect_id = 0;
|
||||
int new_connect_id;
|
||||
Xi18nClient *client;
|
||||
|
||||
if (xim->address.free_clients)
|
||||
{
|
||||
client = xim->address.free_clients;
|
||||
xim->address.free_clients = client->next;
|
||||
new_connect_id = client->connect_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
client = (Xi18nClient *) malloc (sizeof (Xi18nClient));
|
||||
new_connect_id = ++connect_id;
|
||||
}
|
||||
/*endif*/
|
||||
memset (client, 0, sizeof (Xi18nClient));
|
||||
client->connect_id = new_connect_id;
|
||||
client->pending = (XIMPending *) NULL;
|
||||
client->sync = False;
|
||||
client->byte_order = '?'; /* initial value */
|
||||
memset (&client->pending, 0, sizeof (XIMPending *));
|
||||
_Xi18nInitOffsetCache (&client->offset_cache);
|
||||
client->next = xim->address.clients;
|
||||
xim->address.clients = client;
|
||||
|
||||
return (Xi18nClient *) client;
|
||||
}
|
||||
|
||||
Xi18nClient *_Xi18nFindClient (NimfXim *xim, CARD16 connect_id)
|
||||
{
|
||||
Xi18nClient *client = xim->address.clients;
|
||||
|
||||
while (client)
|
||||
{
|
||||
if (client->connect_id == connect_id)
|
||||
return client;
|
||||
/*endif*/
|
||||
client = client->next;
|
||||
}
|
||||
/*endwhile*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void _Xi18nDeleteClient (NimfXim *xim, CARD16 connect_id)
|
||||
{
|
||||
Xi18nClient *target = _Xi18nFindClient (xim, connect_id);
|
||||
Xi18nClient *ccp;
|
||||
Xi18nClient *ccp0;
|
||||
|
||||
for (ccp = xim->address.clients, ccp0 = NULL;
|
||||
ccp != NULL;
|
||||
ccp0 = ccp, ccp = ccp->next)
|
||||
{
|
||||
if (ccp == target)
|
||||
{
|
||||
if (ccp0 == NULL)
|
||||
xim->address.clients = ccp->next;
|
||||
else
|
||||
ccp0->next = ccp->next;
|
||||
/*endif*/
|
||||
/* put it back to free list */
|
||||
target->next = xim->address.free_clients;
|
||||
xim->address.free_clients = target;
|
||||
return;
|
||||
}
|
||||
/*endif*/
|
||||
}
|
||||
/*endfor*/
|
||||
}
|
||||
|
||||
void _Xi18nSendMessage (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
CARD8 major_opcode,
|
||||
CARD8 minor_opcode,
|
||||
unsigned char *data,
|
||||
long length)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec packet_header_fr[];
|
||||
unsigned char *reply_hdr = NULL;
|
||||
int header_size;
|
||||
unsigned char *reply = NULL;
|
||||
unsigned char *replyp;
|
||||
int reply_length;
|
||||
long p_len = length/4;
|
||||
|
||||
fm = FrameMgrInit (packet_header_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
header_size = FrameMgrGetTotalSize (fm);
|
||||
reply_hdr = (unsigned char *) malloc (header_size);
|
||||
if (reply_hdr == NULL)
|
||||
{
|
||||
_Xi18nSendMessage (xim, connect_id, XIM_ERROR, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
/*endif*/
|
||||
FrameMgrSetBuffer (fm, reply_hdr);
|
||||
|
||||
/* put data */
|
||||
FrameMgrPutToken (fm, major_opcode);
|
||||
FrameMgrPutToken (fm, minor_opcode);
|
||||
FrameMgrPutToken (fm, p_len);
|
||||
|
||||
reply_length = header_size + length;
|
||||
reply = (unsigned char *) malloc (reply_length);
|
||||
replyp = reply;
|
||||
memmove (reply, reply_hdr, header_size);
|
||||
replyp += header_size;
|
||||
|
||||
if (length > 0 && data != NULL)
|
||||
memmove (replyp, data, length);
|
||||
|
||||
Xi18nXSend (xim, connect_id, reply, reply_length);
|
||||
|
||||
XFree (reply);
|
||||
XFree (reply_hdr);
|
||||
FrameMgrFree (fm);
|
||||
}
|
||||
|
||||
void _Xi18nSetEventMask (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
CARD16 im_id,
|
||||
CARD16 ic_id,
|
||||
CARD32 forward_mask,
|
||||
CARD32 sync_mask)
|
||||
{
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec set_event_mask_fr[];
|
||||
unsigned char *reply = NULL;
|
||||
register int total_size;
|
||||
|
||||
fm = FrameMgrInit (set_event_mask_fr,
|
||||
NULL,
|
||||
_Xi18nNeedSwap (xim, connect_id));
|
||||
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
reply = (unsigned char *) malloc (total_size);
|
||||
if (!reply)
|
||||
return;
|
||||
/*endif*/
|
||||
memset (reply, 0, total_size);
|
||||
FrameMgrSetBuffer (fm, reply);
|
||||
|
||||
FrameMgrPutToken (fm, im_id); /* input-method-id */
|
||||
FrameMgrPutToken (fm, ic_id); /* input-context-id */
|
||||
FrameMgrPutToken (fm, forward_mask);
|
||||
FrameMgrPutToken (fm, sync_mask);
|
||||
|
||||
_Xi18nSendMessage (xim,
|
||||
connect_id,
|
||||
XIM_SET_EVENT_MASK,
|
||||
0,
|
||||
reply,
|
||||
total_size);
|
||||
|
||||
FrameMgrFree (fm);
|
||||
XFree(reply);
|
||||
}
|
||||
419
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nX.c
vendored
Normal file
419
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nX.c
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/******************************************************************
|
||||
|
||||
Copyright (C) 1994-1995 Sun Microsystems, Inc.
|
||||
Copyright (C) 1993-1994 Hewlett-Packard Company
|
||||
Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
|
||||
Copyright (C) 2014 Red Hat, Inc.
|
||||
|
||||
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 "i18nX.h"
|
||||
#include "FrameMgr.h"
|
||||
#include "Xi18n.h"
|
||||
#include "XimFunc.h"
|
||||
|
||||
extern Xi18nClient *_Xi18nFindClient (NimfXim *, CARD16);
|
||||
extern Xi18nClient *_Xi18nNewClient (NimfXim *);
|
||||
extern void _Xi18nDeleteClient (NimfXim *, CARD16);
|
||||
extern unsigned long _Xi18nLookupPropertyOffset (Xi18nOffsetCache *, Atom);
|
||||
extern void _Xi18nSetPropertyOffset (Xi18nOffsetCache *, Atom, unsigned long);
|
||||
|
||||
#define XCM_DATA_LIMIT 20
|
||||
|
||||
typedef struct _XClient
|
||||
{
|
||||
Window client_win; /* client window */
|
||||
Window accept_win; /* accept window */
|
||||
} XClient;
|
||||
|
||||
static XClient *NewXClient (NimfXim *xim, Window new_client)
|
||||
{
|
||||
Xi18nClient *client = _Xi18nNewClient (xim);
|
||||
XClient *x_client;
|
||||
|
||||
x_client = (XClient *) malloc (sizeof (XClient));
|
||||
x_client->client_win = new_client;
|
||||
x_client->accept_win = XCreateSimpleWindow (xim->display,
|
||||
DefaultRootWindow (xim->display),
|
||||
0, 0, 1, 1, 0, 0, 0);
|
||||
client->trans_rec = x_client;
|
||||
return ((XClient *) x_client);
|
||||
}
|
||||
|
||||
static unsigned char *ReadXIMMessage (NimfXim *xim,
|
||||
XClientMessageEvent *ev,
|
||||
int *connect_id)
|
||||
{
|
||||
Xi18nClient *client = xim->address.clients;
|
||||
XClient *x_client = NULL;
|
||||
FrameMgr fm;
|
||||
extern XimFrameRec packet_header_fr[];
|
||||
unsigned char *p = NULL;
|
||||
unsigned char *p1;
|
||||
|
||||
while (client != NULL) {
|
||||
x_client = (XClient *) client->trans_rec;
|
||||
if (x_client->accept_win == ev->window) {
|
||||
*connect_id = client->connect_id;
|
||||
break;
|
||||
}
|
||||
client = client->next;
|
||||
}
|
||||
|
||||
if (ev->format == 8) {
|
||||
/* ClientMessage only */
|
||||
XimProtoHdr *hdr = (XimProtoHdr *) ev->data.b;
|
||||
unsigned char *rec = (unsigned char *) (hdr + 1);
|
||||
register int total_size;
|
||||
CARD8 major_opcode;
|
||||
CARD8 minor_opcode;
|
||||
CARD16 length;
|
||||
extern int _Xi18nNeedSwap (NimfXim *, CARD16);
|
||||
|
||||
if (client->byte_order == '?')
|
||||
{
|
||||
if (hdr->major_opcode != XIM_CONNECT)
|
||||
return (unsigned char *) NULL; /* can do nothing */
|
||||
client->byte_order = (CARD8) rec[0];
|
||||
}
|
||||
|
||||
fm = FrameMgrInit (packet_header_fr,
|
||||
(char *) hdr,
|
||||
_Xi18nNeedSwap (xim, *connect_id));
|
||||
total_size = FrameMgrGetTotalSize (fm);
|
||||
/* get data */
|
||||
FrameMgrGetToken (fm, major_opcode);
|
||||
FrameMgrGetToken (fm, minor_opcode);
|
||||
FrameMgrGetToken (fm, length);
|
||||
FrameMgrFree (fm);
|
||||
|
||||
if ((p = (unsigned char *) malloc (total_size + length * 4)) == NULL)
|
||||
return (unsigned char *) NULL;
|
||||
|
||||
p1 = p;
|
||||
memmove (p1, &major_opcode, sizeof (CARD8));
|
||||
p1 += sizeof (CARD8);
|
||||
memmove (p1, &minor_opcode, sizeof (CARD8));
|
||||
p1 += sizeof (CARD8);
|
||||
memmove (p1, &length, sizeof (CARD16));
|
||||
p1 += sizeof (CARD16);
|
||||
memmove (p1, rec, length * 4);
|
||||
}
|
||||
else if (ev->format == 32) {
|
||||
/* ClientMessage and WindowProperty */
|
||||
unsigned long length = (unsigned long) ev->data.l[0];
|
||||
Atom atom = (Atom) ev->data.l[1];
|
||||
int return_code;
|
||||
Atom actual_type_ret;
|
||||
int actual_format_ret;
|
||||
unsigned long bytes_after_ret;
|
||||
unsigned char *prop;
|
||||
unsigned long nitems;
|
||||
Xi18nOffsetCache *offset_cache = &client->offset_cache;
|
||||
unsigned long offset;
|
||||
unsigned long end;
|
||||
unsigned long long_begin;
|
||||
unsigned long long_end;
|
||||
|
||||
if (length == 0) {
|
||||
fprintf (stderr, "%s: invalid length 0\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = _Xi18nLookupPropertyOffset (offset_cache, atom);
|
||||
end = offset + length;
|
||||
|
||||
/* The property data is retrieved in 32-bit chunks */
|
||||
long_begin = offset / 4;
|
||||
long_end = (end + 3) / 4;
|
||||
return_code = XGetWindowProperty (xim->display,
|
||||
x_client->accept_win,
|
||||
atom,
|
||||
long_begin,
|
||||
long_end - long_begin,
|
||||
True,
|
||||
AnyPropertyType,
|
||||
&actual_type_ret,
|
||||
&actual_format_ret,
|
||||
&nitems,
|
||||
&bytes_after_ret,
|
||||
&prop);
|
||||
if (return_code != Success || actual_format_ret == 0 || nitems == 0) {
|
||||
if (return_code == Success)
|
||||
XFree (prop);
|
||||
fprintf (stderr,
|
||||
"(XIM-IMdkit) ERROR: XGetWindowProperty failed.\n"
|
||||
"Protocol data is likely to be inconsistent.\n");
|
||||
_Xi18nSetPropertyOffset (offset_cache, atom, 0);
|
||||
return (unsigned char *) NULL;
|
||||
}
|
||||
/* Update the offset to read next time as needed */
|
||||
if (bytes_after_ret > 0)
|
||||
_Xi18nSetPropertyOffset (offset_cache, atom, offset + length);
|
||||
else
|
||||
_Xi18nSetPropertyOffset (offset_cache, atom, 0);
|
||||
/* if hit, it might be an error */
|
||||
if ((p = (unsigned char *) malloc (length)) == NULL)
|
||||
return (unsigned char *) NULL;
|
||||
|
||||
memcpy (p, prop + (offset % 4), length);
|
||||
XFree (prop);
|
||||
}
|
||||
return (unsigned char *) p;
|
||||
}
|
||||
|
||||
void ReadXConnectMessage (NimfXim *xim, XClientMessageEvent *ev)
|
||||
{
|
||||
XEvent event;
|
||||
Window new_client = ev->data.l[0];
|
||||
CARD32 major_version = ev->data.l[1];
|
||||
CARD32 minor_version = ev->data.l[2];
|
||||
XClient *x_client = NewXClient (xim, new_client);
|
||||
|
||||
if (ev->window != xim->im_window)
|
||||
return; /* incorrect connection request */
|
||||
|
||||
if (major_version != 0 || minor_version != 0)
|
||||
{
|
||||
major_version =
|
||||
minor_version = 0;
|
||||
/* Only supporting only-CM & Property-with-CM method */
|
||||
}
|
||||
/*endif*/
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.display = xim->display;
|
||||
event.xclient.window = new_client;
|
||||
event.xclient.message_type = xim->_xconnect;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = x_client->accept_win;
|
||||
event.xclient.data.l[1] = major_version;
|
||||
event.xclient.data.l[2] = minor_version;
|
||||
event.xclient.data.l[3] = XCM_DATA_LIMIT;
|
||||
|
||||
XSendEvent (xim->display,
|
||||
new_client,
|
||||
False,
|
||||
NoEventMask,
|
||||
&event);
|
||||
XFlush (xim->display);
|
||||
}
|
||||
|
||||
static char *MakeNewAtom (CARD16 connect_id, char *atomName)
|
||||
{
|
||||
static uint8_t sequence = 0;
|
||||
|
||||
sprintf (atomName,
|
||||
"_server%d_%d",
|
||||
connect_id,
|
||||
((sequence > 20) ? (sequence = 0) : (0x1f & sequence)));
|
||||
sequence++;
|
||||
return atomName;
|
||||
}
|
||||
|
||||
Bool Xi18nXSend (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
unsigned char *reply,
|
||||
long length)
|
||||
{
|
||||
Xi18nClient *client = _Xi18nFindClient (xim, connect_id);
|
||||
XClient *x_client = (XClient *) client->trans_rec;
|
||||
XEvent event;
|
||||
|
||||
event.type = ClientMessage;
|
||||
event.xclient.window = x_client->client_win;
|
||||
event.xclient.message_type = xim->_protocol;
|
||||
|
||||
if (length > XCM_DATA_LIMIT)
|
||||
{
|
||||
Atom atom;
|
||||
char atomName[16];
|
||||
Atom actual_type_ret;
|
||||
int actual_format_ret;
|
||||
int return_code;
|
||||
unsigned long nitems_ret;
|
||||
unsigned long bytes_after_ret;
|
||||
unsigned char *win_data;
|
||||
|
||||
event.xclient.format = 32;
|
||||
atom = XInternAtom (xim->display,
|
||||
MakeNewAtom (connect_id, atomName),
|
||||
False);
|
||||
return_code = XGetWindowProperty (xim->display,
|
||||
x_client->client_win,
|
||||
atom,
|
||||
0L,
|
||||
10000L,
|
||||
False,
|
||||
XA_STRING,
|
||||
&actual_type_ret,
|
||||
&actual_format_ret,
|
||||
&nitems_ret,
|
||||
&bytes_after_ret,
|
||||
&win_data);
|
||||
if (return_code != Success)
|
||||
return False;
|
||||
/*endif*/
|
||||
if (win_data)
|
||||
XFree ((char *) win_data);
|
||||
/*endif*/
|
||||
XChangeProperty (xim->display,
|
||||
x_client->client_win,
|
||||
atom,
|
||||
XA_STRING,
|
||||
8,
|
||||
PropModeAppend,
|
||||
(unsigned char *) reply,
|
||||
length);
|
||||
event.xclient.data.l[0] = length;
|
||||
event.xclient.data.l[1] = atom;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char buffer[XCM_DATA_LIMIT];
|
||||
int i;
|
||||
|
||||
event.xclient.format = 8;
|
||||
|
||||
/* Clear unused field with NULL */
|
||||
memmove(buffer, reply, length);
|
||||
for (i = length; i < XCM_DATA_LIMIT; i++)
|
||||
buffer[i] = (char) 0;
|
||||
/*endfor*/
|
||||
length = XCM_DATA_LIMIT;
|
||||
memmove (event.xclient.data.b, buffer, length);
|
||||
}
|
||||
XSendEvent (xim->display,
|
||||
x_client->client_win,
|
||||
False,
|
||||
NoEventMask,
|
||||
&event);
|
||||
XFlush (xim->display);
|
||||
return True;
|
||||
}
|
||||
|
||||
static Bool CheckCMEvent (Display *display, XEvent *event, XPointer arg)
|
||||
{
|
||||
NimfXim *xim = NIMF_XIM (arg);
|
||||
|
||||
if ((event->type == ClientMessage) &&
|
||||
(event->xclient.message_type == xim->_protocol))
|
||||
return True;
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool Xi18nXWait (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
CARD8 major_opcode,
|
||||
CARD8 minor_opcode)
|
||||
{
|
||||
XEvent event;
|
||||
Xi18nClient *client = _Xi18nFindClient (xim, connect_id);
|
||||
XClient *x_client = (XClient *) client->trans_rec;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
unsigned char *packet;
|
||||
XimProtoHdr *hdr;
|
||||
int connect_id_ret = 0;
|
||||
|
||||
XIfEvent (xim->display,
|
||||
&event,
|
||||
CheckCMEvent,
|
||||
(XPointer) xim);
|
||||
if (event.xclient.window == x_client->accept_win)
|
||||
{
|
||||
if ((packet = ReadXIMMessage (xim,
|
||||
(XClientMessageEvent *) & event,
|
||||
&connect_id_ret))
|
||||
== (unsigned char*) NULL)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
hdr = (XimProtoHdr *)packet;
|
||||
|
||||
if ((hdr->major_opcode == major_opcode)
|
||||
&&
|
||||
(hdr->minor_opcode == minor_opcode))
|
||||
{
|
||||
XFree (packet);
|
||||
return True;
|
||||
}
|
||||
else if (hdr->major_opcode == XIM_ERROR)
|
||||
{
|
||||
XFree (packet);
|
||||
return False;
|
||||
}
|
||||
|
||||
XFree (packet);
|
||||
}
|
||||
/*endif*/
|
||||
}
|
||||
/*endfor*/
|
||||
}
|
||||
|
||||
Bool Xi18nXDisconnect (NimfXim *xim, CARD16 connect_id)
|
||||
{
|
||||
Xi18nClient *client = _Xi18nFindClient (xim, connect_id);
|
||||
XClient *x_client = (XClient *) client->trans_rec;
|
||||
|
||||
XDestroyWindow (xim->display, x_client->accept_win);
|
||||
XFree (x_client);
|
||||
_Xi18nDeleteClient (xim, connect_id);
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool WaitXIMProtocol (NimfXim *xim,
|
||||
XEvent *ev)
|
||||
{
|
||||
extern void _Xi18nMessageHandler (NimfXim *, CARD16, unsigned char *, Bool *);
|
||||
Bool delete = True;
|
||||
unsigned char *packet;
|
||||
int connect_id = 0;
|
||||
|
||||
if (((XClientMessageEvent *) ev)->message_type
|
||||
== xim->_protocol)
|
||||
{
|
||||
if ((packet = ReadXIMMessage (xim,
|
||||
(XClientMessageEvent *) ev,
|
||||
&connect_id))
|
||||
== (unsigned char *) NULL)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
/*endif*/
|
||||
_Xi18nMessageHandler (xim, connect_id, packet, &delete);
|
||||
if (delete == True)
|
||||
XFree (packet);
|
||||
/*endif*/
|
||||
return True;
|
||||
}
|
||||
/*endif*/
|
||||
return False;
|
||||
}
|
||||
55
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nX.h
vendored
Normal file
55
Telegram/ThirdParty/nimf/modules/services/xim/IMdkit/i18nX.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/******************************************************************
|
||||
|
||||
Copyright (C) 1994-1995 Sun Microsystems, Inc.
|
||||
Copyright (C) 1993-1994 Hewlett-Packard Company
|
||||
Copyright (C) 2014 Peng Huang <shawn.p.huang@gmail.com>
|
||||
Copyright (C) 2014 Red Hat, Inc.
|
||||
|
||||
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
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef I18N_X_H
|
||||
#define I18N_X_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include "nimf-xim.h"
|
||||
|
||||
void ReadXConnectMessage (NimfXim *xim, XClientMessageEvent *ev);
|
||||
Bool WaitXIMProtocol (NimfXim*, XEvent*);
|
||||
Bool Xi18nXWait (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
CARD8 major_opcode,
|
||||
CARD8 minor_opcode);
|
||||
Bool Xi18nXDisconnect (NimfXim *xim, CARD16 connect_id);
|
||||
Bool Xi18nXSend (NimfXim *xim,
|
||||
CARD16 connect_id,
|
||||
unsigned char *reply,
|
||||
long length);
|
||||
#endif /* I18N_X_H */
|
||||
Reference in New Issue
Block a user