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