124f6443dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 324f6443dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 424f6443dSAndrew Rist * or more contributor license agreements. See the NOTICE file 524f6443dSAndrew Rist * distributed with this work for additional information 624f6443dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 724f6443dSAndrew Rist * to you under the Apache License, Version 2.0 (the 824f6443dSAndrew Rist * "License"); you may not use this file except in compliance 924f6443dSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1124f6443dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1324f6443dSAndrew Rist * Unless required by applicable law or agreed to in writing, 1424f6443dSAndrew Rist * software distributed under the License is distributed on an 1524f6443dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1624f6443dSAndrew Rist * KIND, either express or implied. See the License for the 1724f6443dSAndrew Rist * specific language governing permissions and limitations 1824f6443dSAndrew Rist * under the License. 19cdf0e10cSrcweir * 2024f6443dSAndrew Rist *************************************************************/ 2124f6443dSAndrew Rist 2224f6443dSAndrew Rist 23cdf0e10cSrcweir #ifndef _XIM_h 24cdf0e10cSrcweir #define _XIM_h 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <X11/Xlib.h> 27cdf0e10cSrcweir #include <X11/Xresource.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifdef __cplusplus 30cdf0e10cSrcweir extern "C" 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir XIM XvaOpenIM( Display*, XrmDatabase, char*, char*, ... ); 33cdf0e10cSrcweir 34cdf0e10cSrcweir extern Status XCloseIM(XIM); 35cdf0e10cSrcweir 36cdf0e10cSrcweir #ifndef XIMCallback1 37cdf0e10cSrcweir typedef int (*XIMProc1)(XIC, XPointer, XPointer); 38cdf0e10cSrcweir typedef struct { 39cdf0e10cSrcweir XPointer client_data; 40cdf0e10cSrcweir XIMProc1 callback; 41cdf0e10cSrcweir } XIMCallback1; 42cdf0e10cSrcweir #endif 43cdf0e10cSrcweir 44cdf0e10cSrcweir typedef struct _XIMAnnotation { 45cdf0e10cSrcweir int start_position; 46cdf0e10cSrcweir int end_position; 47cdf0e10cSrcweir XPointer data; 48cdf0e10cSrcweir } XIMAnnotation; 49cdf0e10cSrcweir 50cdf0e10cSrcweir /* 51cdf0e10cSrcweir XIMUText: XIMText extention for UTF16 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir typedef struct _XIMUnicodeText { 54cdf0e10cSrcweir unsigned short length; 55cdf0e10cSrcweir XIMFeedback *feedback; 56cdf0e10cSrcweir Bool encoding_is_wchar; 57cdf0e10cSrcweir union { 58cdf0e10cSrcweir char *multi_byte; 59cdf0e10cSrcweir wchar_t *wide_char; 60cdf0e10cSrcweir unsigned short *utf16_char; 61cdf0e10cSrcweir } string; 62cdf0e10cSrcweir unsigned int count_annotations; 63cdf0e10cSrcweir XIMAnnotation *annotations; 64cdf0e10cSrcweir } XIMUnicodeText; 65cdf0e10cSrcweir 66cdf0e10cSrcweir /* lookup choice */ 67cdf0e10cSrcweir typedef enum { 68cdf0e10cSrcweir XIMDrawUpHorizontally = 0 , 69cdf0e10cSrcweir XIMDrawUpVertically = 1 70cdf0e10cSrcweir } XIMDrawUpDirection ; 71cdf0e10cSrcweir 72cdf0e10cSrcweir typedef struct _XIMLookupStartCallbackStruct { 73cdf0e10cSrcweir int choice_per_window; /* Number of choices can be display 74cdf0e10cSrcweir * in the region 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir int nrows; 77cdf0e10cSrcweir int ncolumns; 78cdf0e10cSrcweir XIMDrawUpDirection draw_up_direction; 79cdf0e10cSrcweir } XIMLookupStartCallbackStruct; 80cdf0e10cSrcweir 81cdf0e10cSrcweir typedef struct _XIMUnicodeChoiceObject { 82cdf0e10cSrcweir XIMUnicodeText *label; 83cdf0e10cSrcweir XIMUnicodeText *value; 84cdf0e10cSrcweir } XIMUnicodeChoiceObject; 85cdf0e10cSrcweir 86cdf0e10cSrcweir typedef struct _XIMLookupDrawCallbackStruct { 87cdf0e10cSrcweir XIMUnicodeChoiceObject *choices; /* the lookup choices */ 88cdf0e10cSrcweir int n_choices; /* Total number of lookup choices */ 89cdf0e10cSrcweir int first_index; 90cdf0e10cSrcweir int last_index; 91cdf0e10cSrcweir int current_index; 92cdf0e10cSrcweir XIMUnicodeText *title; 93cdf0e10cSrcweir } XIMLookupDrawCallbackStruct; 94cdf0e10cSrcweir 95cdf0e10cSrcweir /* Unicode Subset */ 96cdf0e10cSrcweir typedef enum { 97cdf0e10cSrcweir XIMKatakana, XIMHanzi 98cdf0e10cSrcweir } XIMUnicodeCharacterSubsetID; 99cdf0e10cSrcweir 100*a3cca4d2SJohn Bampton typedef struct _XIMUnicodeSubset { 101cdf0e10cSrcweir XIMUnicodeCharacterSubsetID index; 102cdf0e10cSrcweir XIMUnicodeCharacterSubsetID subset_id; 103cdf0e10cSrcweir char *name; 104cdf0e10cSrcweir Bool is_active; 105cdf0e10cSrcweir } XIMUnicodeCharacterSubset; 106cdf0e10cSrcweir 107*a3cca4d2SJohn Bampton typedef struct _XIMUnicodeSubsets { 108cdf0e10cSrcweir unsigned short count_subsets; 109cdf0e10cSrcweir XIMUnicodeCharacterSubset *supported_subsets; 110cdf0e10cSrcweir } XIMUnicodeCharacterSubsets; 111cdf0e10cSrcweir 112cdf0e10cSrcweir typedef struct _XIMSwitchIMNotifyCallbackStruct { 113cdf0e10cSrcweir XIMUnicodeCharacterSubset *from; 114cdf0e10cSrcweir XIMUnicodeCharacterSubset *to; 115cdf0e10cSrcweir } XIMSwitchIMNotifyCallbackStruct; 116cdf0e10cSrcweir 117cdf0e10cSrcweir /* XIM attributes for multilingual IM extension */ 118cdf0e10cSrcweir #define XNMultiLingualInput "multiLingualInput" 119cdf0e10cSrcweir #define XNQueryUnicodeCharacterSubset "unicodeCharacterSubset" 120cdf0e10cSrcweir 121cdf0e10cSrcweir /* XIC attributes for multilingual IM extension */ 122cdf0e10cSrcweir 123*a3cca4d2SJohn Bampton #define XNUnicodeCharacterSubset "UnicodeCharacterSubset" 124cdf0e10cSrcweir 125cdf0e10cSrcweir #define XNSwitchIMNotifyCallback "switchIMNotifyCallback" 126cdf0e10cSrcweir #define XNCommitStringCallback "commitStringCallback" 127cdf0e10cSrcweir #define XNForwardEventCallback "forwardEventCallback" 128cdf0e10cSrcweir 129cdf0e10cSrcweir #define XNLookupStartCallback "lookupStartCallback" 130cdf0e10cSrcweir #define XNLookupDrawCallback "lookupDrawCallback" 131cdf0e10cSrcweir #define XNLookupDoneCallback "lookupDoneCallback" 132cdf0e10cSrcweir 133cdf0e10cSrcweir #endif 134