1b4ee4795Smrg/* 25efbdfc3Smrg * Copyright (c) 1991, 1992, Oracle and/or its affiliates. 3b4ee4795Smrg * 4b4ee4795Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b4ee4795Smrg * copy of this software and associated documentation files (the "Software"), 6b4ee4795Smrg * to deal in the Software without restriction, including without limitation 7b4ee4795Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8b4ee4795Smrg * and/or sell copies of the Software, and to permit persons to whom the 9b4ee4795Smrg * Software is furnished to do so, subject to the following conditions: 10b4ee4795Smrg * 11b4ee4795Smrg * The above copyright notice and this permission notice (including the next 12b4ee4795Smrg * paragraph) shall be included in all copies or substantial portions of the 13b4ee4795Smrg * Software. 14b4ee4795Smrg * 15b4ee4795Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b4ee4795Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b4ee4795Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18b4ee4795Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b4ee4795Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20b4ee4795Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21b4ee4795Smrg * DEALINGS IN THE SOFTWARE. 22b4ee4795Smrg */ 231ab64890Smrg/****************************************************************** 241ab64890Smrg 251ab64890Smrg Copyright 1992, 1993, 1994 by FUJITSU LIMITED 261ab64890Smrg Copyright 1993, 1994 by Sony Corporation 271ab64890Smrg 281ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and 291ab64890Smrgits documentation for any purpose is hereby granted without fee, provided 301ab64890Smrgthat the above copyright notice appear in all copies and that both that 311ab64890Smrgcopyright notice and this permission notice appear in supporting 32b4ee4795Smrgdocumentation, and that the name of FUJITSU LIMITED and Sony Corporation 33b4ee4795Smrgnot be used in advertising or publicity pertaining to distribution of the 34b4ee4795Smrgsoftware without specific, written prior permission. FUJITSU LIMITED and 35b4ee4795SmrgSony Corporation makes no representations about the suitability of this 361ab64890Smrgsoftware for any purpose. It is provided "as is" without express or 3761b2299dSmrgimplied warranty. 381ab64890Smrg 39b4ee4795SmrgFUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD 40b4ee4795SmrgTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 41b4ee4795SmrgFITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE 42b4ee4795SmrgFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 43b4ee4795SmrgRESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 44b4ee4795SmrgNEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE 45b4ee4795SmrgUSE OR PERFORMANCE OF THIS SOFTWARE. 461ab64890Smrg 471ab64890Smrg Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. 4861b2299dSmrg Takashi Fujiwara FUJITSU LIMITED 491ab64890Smrg fujiwara@a80.tech.yk.fujitsu.co.jp 501ab64890Smrg Makoto Wakamatsu Sony Corporation 511ab64890Smrg makoto@sm.sony.co.jp 521ab64890Smrg Hiroyuki Miyamoto Digital Equipment Corporation 531ab64890Smrg miyamoto@jrd.dec.com 541ab64890Smrg 551ab64890Smrg******************************************************************/ 561ab64890Smrg 571ab64890Smrg#ifndef _XIMINTP_H 581ab64890Smrg#define _XIMINTP_H 591ab64890Smrg 601ab64890Smrg#include "XimProto.h" 611ab64890Smrg#include "XlcPublic.h" 621ab64890Smrg 631ab64890Smrg/* 641ab64890Smrg * for protocol layer callback function 651ab64890Smrg */ 661ab64890Smrgtypedef Bool (*XimProtoIntrProc)( 671ab64890Smrg Xim, INT16, XPointer, XPointer 681ab64890Smrg); 691ab64890Smrgtypedef struct _XimProtoIntrRec { 701ab64890Smrg XimProtoIntrProc func; 711ab64890Smrg CARD16 major_code; 721ab64890Smrg CARD16 minor_code; 731ab64890Smrg XPointer call_data; 741ab64890Smrg struct _XimProtoIntrRec *next; 751ab64890Smrg} XimProtoIntrRec; 761ab64890Smrg 771ab64890Smrg/* 781ab64890Smrg * for transport layer methods 791ab64890Smrg */ 801ab64890Smrgtypedef Bool (*XimTransConnectProc)( 811ab64890Smrg Xim 821ab64890Smrg); 831ab64890Smrgtypedef Bool (*XimTransShutdownProc)( 841ab64890Smrg Xim 851ab64890Smrg); 861ab64890Smrgtypedef Bool (*XimTransWriteProc)( 871ab64890Smrg Xim, INT16, XPointer 881ab64890Smrg); 891ab64890Smrgtypedef Bool (*XimTransReadProc)( 901ab64890Smrg Xim, XPointer, int, int * 911ab64890Smrg); 921ab64890Smrgtypedef void (*XimTransFlushProc)( 931ab64890Smrg Xim 941ab64890Smrg); 951ab64890Smrgtypedef Bool (*XimTransRegDispatcher)( 961ab64890Smrg Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer 971ab64890Smrg); 981ab64890Smrgtypedef Bool (*XimTransCallDispatcher)( 991ab64890Smrg Xim, INT16, XPointer 1001ab64890Smrg); 1011ab64890Smrg 1021ab64890Smrg/* 1031ab64890Smrg * private part of IM 1041ab64890Smrg */ 1051ab64890Smrgtypedef struct _XimProtoPrivateRec { 1061ab64890Smrg /* The first fields are identical with XimCommonPrivateRec. */ 1071ab64890Smrg XlcConv ctom_conv; 1081ab64890Smrg XlcConv ctow_conv; 1091ab64890Smrg XlcConv ctoutf8_conv; 1101ab64890Smrg XlcConv cstomb_conv; 1111ab64890Smrg XlcConv cstowc_conv; 1121ab64890Smrg XlcConv cstoutf8_conv; 1131ab64890Smrg XlcConv ucstoc_conv; 1141ab64890Smrg XlcConv ucstoutf8_conv; 1151ab64890Smrg 1161ab64890Smrg Window im_window; 1171ab64890Smrg XIMID imid; 1181ab64890Smrg CARD16 unused; 1191ab64890Smrg XIMStyles *default_styles; 1201ab64890Smrg CARD32 *im_onkeylist; 1211ab64890Smrg CARD32 *im_offkeylist; 1221ab64890Smrg BITMASK32 flag; 1231ab64890Smrg 1241ab64890Smrg BITMASK32 registed_filter_event; 1251ab64890Smrg EVENTMASK forward_event_mask; 1261ab64890Smrg EVENTMASK synchronous_event_mask; 1271ab64890Smrg 1281ab64890Smrg XimProtoIntrRec *intrproto; 1291ab64890Smrg XIMResourceList im_inner_resources; 1301ab64890Smrg unsigned int im_num_inner_resources; 1311ab64890Smrg XIMResourceList ic_inner_resources; 1321ab64890Smrg unsigned int ic_num_inner_resources; 1331ab64890Smrg char *hold_data; 1341ab64890Smrg int hold_data_len; 1351ab64890Smrg char *locale_name; 1361ab64890Smrg CARD16 protocol_major_version; 1371ab64890Smrg CARD16 protocol_minor_version; 1381ab64890Smrg XrmQuark *saved_imvalues; 1391ab64890Smrg int num_saved_imvalues; 1401ab64890Smrg 1411ab64890Smrg /* 1421ab64890Smrg * transport specific 1431ab64890Smrg */ 1441ab64890Smrg XimTransConnectProc connect; 1451ab64890Smrg XimTransShutdownProc shutdown; 1461ab64890Smrg XimTransWriteProc write; 1471ab64890Smrg XimTransReadProc read; 1481ab64890Smrg XimTransFlushProc flush; 1491ab64890Smrg XimTransRegDispatcher register_dispatcher; 1501ab64890Smrg XimTransCallDispatcher call_dispatcher; 1511ab64890Smrg XPointer spec; 1523b4ba46cSmrg 1533b4ba46cSmrg unsigned long fabricated_serial; 1543b4ba46cSmrg Time fabricated_time; 1553b4ba46cSmrg Bool enable_fabricated_order; 1561ab64890Smrg} XimProtoPrivateRec; 1571ab64890Smrg 1581ab64890Smrg/* 1591ab64890Smrg * bit mask for the flag of XIMPrivateRec 1601ab64890Smrg */ 1611ab64890Smrg#define SERVER_CONNECTED (1L) 1621ab64890Smrg#define DYNAMIC_EVENT_FLOW (1L << 1) 1631ab64890Smrg#define USE_AUTHORIZATION_FUNC (1L << 2) 1641ab64890Smrg#ifdef XIM_CONNECTABLE 1651ab64890Smrg#define DELAYBINDABLE (1L << 3) 1661ab64890Smrg#define RECONNECTABLE (1L << 4) 1671ab64890Smrg#endif /* XIM_CONNECTABLE */ 168eb411b4bSmrg#define FABRICATED (1L << 5) 169eb411b4bSmrg#define NEED_SYNC_REPLY (1L << 6) 1701ab64890Smrg 1711ab64890Smrg/* 1721ab64890Smrg * macro for the flag of XIMPrivateRec 1731ab64890Smrg */ 1741ab64890Smrg#define IS_SERVER_CONNECTED(im) \ 1751ab64890Smrg ((((Xim)im))->private.proto.flag & SERVER_CONNECTED) 1761ab64890Smrg#define MARK_SERVER_CONNECTED(im) \ 1771ab64890Smrg ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) 1781ab64890Smrg#define UNMARK_SERVER_CONNECTED(im) \ 1791ab64890Smrg ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) 1801ab64890Smrg 1811ab64890Smrg#define IS_DYNAMIC_EVENT_FLOW(im) \ 1821ab64890Smrg (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) 1831ab64890Smrg#define MARK_DYNAMIC_EVENT_FLOW(im) \ 1841ab64890Smrg (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) 1851ab64890Smrg 1861ab64890Smrg#define IS_USE_AUTHORIZATION_FUNC(im) \ 1871ab64890Smrg (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) 1881ab64890Smrg#define MARK_USE_AUTHORIZATION_FUNC(im) \ 1891ab64890Smrg (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) 1901ab64890Smrg 1911ab64890Smrg#ifdef XIM_CONNECTABLE 1921ab64890Smrg#define IS_DELAYBINDABLE(im) \ 1931ab64890Smrg (((Xim)im)->private.proto.flag & DELAYBINDABLE) 1941ab64890Smrg#define MARK_DELAYBINDABLE(im) \ 1951ab64890Smrg (((Xim)im)->private.proto.flag |= DELAYBINDABLE) 1961ab64890Smrg 1971ab64890Smrg#define IS_RECONNECTABLE(im) \ 1981ab64890Smrg (((Xim)im)->private.proto.flag & RECONNECTABLE) 1991ab64890Smrg#define MARK_RECONNECTABLE(im) \ 2001ab64890Smrg (((Xim)im)->private.proto.flag |= RECONNECTABLE) 2011ab64890Smrg 2021ab64890Smrg#define IS_CONNECTABLE(im) \ 2031ab64890Smrg (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) 2041ab64890Smrg#define UNMAKE_CONNECTABLE(im) \ 2051ab64890Smrg (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) 2061ab64890Smrg#endif /* XIM_CONNECTABLE */ 2071ab64890Smrg 208eb411b4bSmrg#define IS_FABRICATED(im) \ 209eb411b4bSmrg (((Xim)im)->private.proto.flag & FABRICATED) 210eb411b4bSmrg#define MARK_FABRICATED(im) \ 211eb411b4bSmrg (((Xim)im)->private.proto.flag |= FABRICATED) 212eb411b4bSmrg#define UNMARK_FABRICATED(im) \ 213eb411b4bSmrg (((Xim)im)->private.proto.flag &= ~FABRICATED) 214eb411b4bSmrg 215eb411b4bSmrg#define IS_NEED_SYNC_REPLY(im) \ 216eb411b4bSmrg (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) 217eb411b4bSmrg#define MARK_NEED_SYNC_REPLY(im) \ 218eb411b4bSmrg (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) 219eb411b4bSmrg#define UNMARK_NEED_SYNC_REPLY(im) \ 220eb411b4bSmrg (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) 221eb411b4bSmrg 2221ab64890Smrg/* 2231ab64890Smrg * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec 2241ab64890Smrg */ 2251ab64890Smrg#define KEYPRESS_MASK (1L) 2261ab64890Smrg#define KEYRELEASE_MASK (1L << 1) 2271ab64890Smrg#define DESTROYNOTIFY_MASK (1L << 2) 2281ab64890Smrg 2291ab64890Smrgtypedef struct _XimCommitInfoRec { 2301ab64890Smrg struct _XimCommitInfoRec *next; 2311ab64890Smrg char *string; 2321ab64890Smrg int string_len; 2331ab64890Smrg KeySym *keysym; 2341ab64890Smrg int keysym_len; 2351ab64890Smrg} XimCommitInfoRec, *XimCommitInfo; 2361ab64890Smrg 2371ab64890Smrgtypedef struct _XimPendingCallback { 2381ab64890Smrg int major_opcode; 2391ab64890Smrg Xim im; 2401ab64890Smrg Xic ic; 2411ab64890Smrg char *proto; 2421ab64890Smrg int proto_len; 2431ab64890Smrg struct _XimPendingCallback *next; 2441ab64890Smrg} XimPendingCallbackRec, *XimPendingCallback; 2451ab64890Smrg 2461ab64890Smrg 2471ab64890Smrg/* 2481ab64890Smrg * private part of IC 2491ab64890Smrg */ 2501ab64890Smrgtypedef struct _XicProtoPrivateRec { 2511ab64890Smrg XICID icid; /* ICID */ 2521ab64890Smrg CARD16 dmy; 2531ab64890Smrg BITMASK32 flag; /* Input Mode */ 2541ab64890Smrg 2551ab64890Smrg BITMASK32 registed_filter_event; /* registed filter mask */ 2561ab64890Smrg EVENTMASK forward_event_mask; /* forward event mask */ 2571ab64890Smrg EVENTMASK synchronous_event_mask;/* sync event mask */ 2581ab64890Smrg EVENTMASK filter_event_mask; /* negrect event mask */ 2591ab64890Smrg EVENTMASK intercept_event_mask; /* deselect event mask */ 2601ab64890Smrg EVENTMASK select_event_mask; /* select event mask */ 2611ab64890Smrg 2621ab64890Smrg char *preedit_font; /* Base font name list */ 2631ab64890Smrg int preedit_font_length; /* length of base font name */ 2641ab64890Smrg char *status_font; /* Base font name list */ 2651ab64890Smrg int status_font_length; /* length of base font name */ 2661ab64890Smrg 2671ab64890Smrg XimCommitInfo commit_info; 2681ab64890Smrg XIMResourceList ic_resources; 2691ab64890Smrg unsigned int ic_num_resources; 2701ab64890Smrg XIMResourceList ic_inner_resources; 2711ab64890Smrg unsigned int ic_num_inner_resources; 2721ab64890Smrg XrmQuark *saved_icvalues; 2731ab64890Smrg int num_saved_icvalues; 2741ab64890Smrg XimPendingCallback pend_cb_que; 2751ab64890Smrg Bool waitCallback; 2761ab64890Smrg} XicProtoPrivateRec ; 2771ab64890Smrg 2781ab64890Smrg/* 2791ab64890Smrg * bit mask for the flag of XICPrivateRec 2801ab64890Smrg */ 2811ab64890Smrg#define IC_CONNECTED (1L) 2821ab64890Smrg 2831ab64890Smrg/* 2841ab64890Smrg * macro for the flag of XICPrivateRec 2851ab64890Smrg */ 2861ab64890Smrg#define IS_IC_CONNECTED(ic) \ 2871ab64890Smrg (((Xic)ic)->private.proto.flag & IC_CONNECTED) 2881ab64890Smrg#define MARK_IC_CONNECTED(ic) \ 2891ab64890Smrg (((Xic)ic)->private.proto.flag |= IC_CONNECTED) 2901ab64890Smrg#define UNMARK_IC_CONNECTED(ic) \ 2911ab64890Smrg (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) 2921ab64890Smrg 2931ab64890Smrg/* 2941ab64890Smrg * macro for the filter_event_mask of XICPrivateRec 2951ab64890Smrg */ 2961ab64890Smrg#define IS_NEGLECT_EVENT(ic, mask) \ 2971ab64890Smrg (((Xic)ic)->private.proto.filter_event_mask & (mask)) 2981ab64890Smrg 2991ab64890Smrg/* 3001ab64890Smrg * macro for the forward_event_mask of XICPrivateRec 3011ab64890Smrg */ 3021ab64890Smrg#define IS_FORWARD_EVENT(ic, mask) \ 3031ab64890Smrg (((Xic)ic)->private.proto.forward_event_mask & (mask)) 3041ab64890Smrg 3051ab64890Smrg/* 3061ab64890Smrg * macro for the synchronous_event_mask of XICPrivateRec 3071ab64890Smrg */ 3081ab64890Smrg#define IS_SYNCHRONOUS_EVENT(ic, mask) \ 3091ab64890Smrg ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) 3101ab64890Smrg 3111ab64890Smrg#define XIM_MAXIMNAMELEN 64 3121ab64890Smrg#define XIM_MAXLCNAMELEN 64 3131ab64890Smrg 31407fb9b8fSmrg_X_HIDDEN Bool 3153b4ba46cSmrg_XimFabricateSerial( 3163b4ba46cSmrg Xim im, 3173b4ba46cSmrg XKeyEvent *event); 3183b4ba46cSmrg 31907fb9b8fSmrg_X_HIDDEN Bool 3203b4ba46cSmrg_XimUnfabricateSerial( 3213b4ba46cSmrg Xim im, 3223b4ba46cSmrg Xic ic, 3233b4ba46cSmrg XKeyEvent *event); 3243b4ba46cSmrg 32507fb9b8fSmrg_X_HIDDEN Bool 3263b4ba46cSmrg_XimIsFabricatedSerial( 3273b4ba46cSmrg Xim im, 3283b4ba46cSmrg XKeyEvent *event); 3293b4ba46cSmrg 3301ab64890Smrg#endif /* _XIMINTP_H */ 331