~ubuntu-branches/ubuntu/trusty/fcitx/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/0004-Upstream-post-release-changes.patch/src/lib/fcitx/ime.h

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-02-10 17:03:56 UTC
  • mfrom: (1.3.18) (33.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130210170356-2yuv6xy3ed378kn0
Tags: 1:4.2.7-1
* New upstream release.
* New binary packages:
  - fcitx-libs-gclient: D-Bus client library for Glib
  - fcitx-libs-qt: D-Bus client library for Qt
  - fcitx-module-quickphrase-editor: Quick Phrase editor module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2010~2010 by CSSlayer                                   *
 
3
 *   wengxt@gmail.com                                                      *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.              *
 
19
 ***************************************************************************/
 
20
 
 
21
/**
 
22
 * @addtogroup Fcitx
 
23
 * @{
 
24
 */
 
25
 
 
26
/**
 
27
 * @file   ime.h
 
28
 * @author Yuking yuking_net@sohu.com
 
29
 * @date   2008-1-16
 
30
 *
 
31
 *  Public Header for Input Method Develop
 
32
 *
 
33
 * The input method is key event centric application. When a key event comes to fcitx,
 
34
 * the process handling the keyboard event can be separated into 7 phases, PreInput, DoInput, Update Candidates, Prev/Next Page
 
35
 * PostInput, Hotkey, and key blocker.
 
36
 *
 
37
 * The input method engine process key event inside "DoInput".
 
38
 *
 
39
 * Each phase will change the INPUT_RETURN_VALUE, if INPUT_RETURN_VALUE is non-zero (non IRV_TO_PROCESS), the following
 
40
 * phases will not run.
 
41
 *
 
42
 * If a key event goes through all phase and still the state is IRV_TO_PROCESS, it will be forwarded.
 
43
 *
 
44
 * When it comes to update candidates, if the flag contains IRV_FLAG_UPDATE_CANDIDATE_WORDS, it will trigger the GetCandWords
 
45
 * of input method engine and clean up all stiring in the input window, after that, it will trigger update candidates hook.
 
46
 *
 
47
 * Key blocker is useful if you want to do something in the post input phase, but you don't want forward key if they do nothing.
 
48
 * There is an default implemention inside fcitx, it will blocks key when raw input buffer is not empty. Those keys
 
49
 * contains direction key(left/right..), key will cause something input (a,b,c...), key will cause cursor move (home/end...).
 
50
 *
 
51
 * DoInput, Update Candidates, Key Blocker are belongs to input method engine, other can be registered by other addon.
 
52
 */
 
53
#ifndef _FCITX_IME_H_
 
54
#define _FCITX_IME_H_
 
55
 
 
56
#include <time.h>
 
57
#include <fcitx-utils/utf8.h>
 
58
#include <fcitx-config/hotkey.h>
 
59
#include <fcitx/ui.h>
 
60
#include <fcitx/addon.h>
 
61
 
 
62
#ifdef __cplusplus
 
63
 
 
64
extern "C" {
 
65
#endif
 
66
 
 
67
/** max length of rawInputBuffer and outputString */
 
68
#define MAX_USER_INPUT    300
 
69
 
 
70
/** FcitxHotkey internally use 2 hotkeys for everycase */
 
71
#define HOT_KEY_COUNT   2
 
72
 
 
73
/**
 
74
 * Only keep for compatible
 
75
 * @deprecated
 
76
 */
 
77
#define MAX_CAND_LEN    127
 
78
 
 
79
/** max language code length, common 5 length is zh_CN
 
80
 * a shorter case is en
 
81
 */
 
82
#define LANGCODE_LENGTH 5
 
83
 
 
84
/** when input method priority is larger than 100, it will be disabled by default after install */
 
85
#define PRIORITY_DISABLE 100
 
86
 
 
87
/** due to backward compatible, this priority will be the most priority one */
 
88
#define PRIORITY_MAGIC_FIRST 0xf1527
 
89
 
 
90
    struct _FcitxInputContext;
 
91
    struct _FcitxInstance;
 
92
    struct _FcitxAddon;
 
93
    struct _FcitxCandidateWordList;
 
94
 
 
95
    /** input method available status */
 
96
    typedef enum _FcitxIMAvailableStatus {
 
97
        IMAS_Enable,
 
98
        IMAS_Disable,
 
99
    } FcitxIMAvailableStatus;
 
100
 
 
101
    /** do input function return value */
 
102
    typedef enum _INPUT_RETURN_VALUE {
 
103
        IRV_TO_PROCESS = 0, /* do something */
 
104
        IRV_FLAG_BLOCK_FOLLOWING_PROCESS = 1 << 0, /* nothing to do, actually non-zero is blocking, but you need a flag for do nothing */
 
105
        IRV_FLAG_FORWARD_KEY = 1 << 1, /* the key will be forwarded */
 
106
        IRV_FLAG_RESET_INPUT = 1 << 2, /* reset input */
 
107
        IRV_FLAG_PENDING_COMMIT_STRING = 1 << 3, /* there is something in input strStringGet buffer, commit it */
 
108
        IRV_FLAG_UPDATE_INPUT_WINDOW = 1 << 4, /* something updated in input window, let the UI update */
 
109
        IRV_FLAG_UPDATE_CANDIDATE_WORDS = 1 << 5, /* update the candidate words */
 
110
        IRV_FLAG_ENG = 1 << 6, /* special */
 
111
        IRV_FLAG_PUNC = 1 << 7, /* special */
 
112
        IRV_FLAG_DISPLAY_LAST = 1 << 8, /* special */
 
113
        IRV_FLAG_DO_PHRASE_TIPS = 1 << 9, /* special */
 
114
        /* compatible */
 
115
        IRV_DONOT_PROCESS = IRV_FLAG_FORWARD_KEY,
 
116
        IRV_COMMIT_STRING = IRV_FLAG_PENDING_COMMIT_STRING | IRV_FLAG_DO_PHRASE_TIPS,
 
117
        IRV_DO_NOTHING = IRV_FLAG_BLOCK_FOLLOWING_PROCESS,
 
118
        IRV_CLEAN = IRV_FLAG_RESET_INPUT,
 
119
        IRV_COMMIT_STRING_REMIND = IRV_FLAG_PENDING_COMMIT_STRING | IRV_FLAG_UPDATE_INPUT_WINDOW,
 
120
        IRV_DISPLAY_CANDWORDS = IRV_FLAG_UPDATE_INPUT_WINDOW | IRV_FLAG_UPDATE_CANDIDATE_WORDS,
 
121
        IRV_DONOT_PROCESS_CLEAN = IRV_FLAG_FORWARD_KEY | IRV_FLAG_RESET_INPUT,
 
122
        IRV_COMMIT_STRING_NEXT =  IRV_FLAG_PENDING_COMMIT_STRING | IRV_FLAG_UPDATE_INPUT_WINDOW,
 
123
        IRV_DISPLAY_MESSAGE = IRV_FLAG_UPDATE_INPUT_WINDOW,
 
124
        IRV_ENG = IRV_FLAG_PENDING_COMMIT_STRING | IRV_FLAG_ENG | IRV_FLAG_RESET_INPUT,
 
125
        IRV_PUNC = IRV_FLAG_PENDING_COMMIT_STRING | IRV_FLAG_PUNC | IRV_FLAG_RESET_INPUT,
 
126
        IRV_DISPLAY_LAST = IRV_FLAG_UPDATE_INPUT_WINDOW | IRV_FLAG_DISPLAY_LAST
 
127
    } INPUT_RETURN_VALUE;
 
128
 
 
129
    /**
 
130
     * Fcitx Input Method class, it can register more than one input
 
131
     *        method in create function
 
132
     **/
 
133
    typedef struct _FcitxIMClass {
 
134
        void* (*Create)(struct _FcitxInstance* instance); /**< interface for create a input method */
 
135
        void  (*Destroy)(void *arg); /**< interface for destroy all input method created by this class */
 
136
    } FcitxIMClass;
 
137
 
 
138
    /**
 
139
     * Fcitx Input Method class, it can register more than one input
 
140
     *        method in create function
 
141
     **/
 
142
    typedef struct _FcitxIMClass2 {
 
143
        void* (*Create)(struct _FcitxInstance* instance); /**< interface for create a input method */
 
144
        void  (*Destroy)(void *arg); /**< interface for destroy all input method created by this class */
 
145
        void  (*ReloadConfig)(void *arg); /**< interface for destroy all input method created by this class */
 
146
        void  (*padding1)(void *arg); /**< padding */
 
147
        void  (*padding2)(void *arg); /**< padding */
 
148
        void  (*padding3)(void *arg); /**< padding */
 
149
        void  (*padding4)(void *arg); /**< padding */
 
150
        void  (*padding5)(void *arg); /**< padding */
 
151
    } FcitxIMClass2;
 
152
 
 
153
    typedef enum _FcitxIMCloseEventType {
 
154
        /**
 
155
         * when user press inactivate key, default behavior is commit raw preedit.
 
156
         * If you want to OVERRIDE this behavior, be sure to implement this function.
 
157
         *
 
158
         * in some case, your implementation of OnClose should respect the value of
 
159
         * [Output/SendTextWhenSwitchEng], when this value is true, commit something you
 
160
         * want.
 
161
         *
 
162
         * And no matter in which case, Reset will be called after that.
 
163
         */
 
164
        CET_ChangeByInactivate,
 
165
        /**
 
166
         * when using lost focus
 
167
         * this might be variance case to case. the default behavior is to commit
 
168
         * the preedit, and resetIM.
 
169
         *
 
170
         * Controlled by [Output/DontCommitPreeditWhenUnfocus], this option will not
 
171
         * work for application switch doesn't support async commit.
 
172
         *
 
173
         * So OnClose is called when preedit IS committed (not like CET_ChangeByInactivate,
 
174
         * this behavior cannot be overrided), it give im a chance to choose remember this
 
175
         * word or not.
 
176
         *
 
177
         * Input method need to notice, that the commit is already DONE, do not to extra commit.
 
178
         */
 
179
        CET_LostFocus,
 
180
        /**
 
181
         * when user switch to a different input method by hand
 
182
         * such as ctrl+shift by default, or by ui,
 
183
         * not implemented yet, default behavior is reset IM.
 
184
         */
 
185
        CET_ChangeByUser,
 
186
    } FcitxIMCloseEventType;
 
187
 
 
188
    typedef boolean(*FcitxIMInit)(void *arg); /**< FcitxIMInit */
 
189
    typedef void (*FcitxIMResetIM)(void *arg); /**< FcitxIMResetIM */
 
190
    typedef INPUT_RETURN_VALUE(*FcitxIMDoInput)(void *arg, FcitxKeySym, unsigned int); /**< FcitxIMDoInput */
 
191
    typedef INPUT_RETURN_VALUE(*FcitxIMGetCandWords)(void *arg); /**< FcitxIMGetCandWords */
 
192
    typedef boolean(*FcitxIMPhraseTips)(void *arg); /**< FcitxIMPhraseTips */
 
193
    typedef void (*FcitxIMSave)(void *arg); /**< FcitxIMSave */
 
194
    typedef void (*FcitxIMReloadConfig)(void *arg); /**< FcitxIMReloadConfig */
 
195
    typedef INPUT_RETURN_VALUE (*FcitxIMKeyBlocker)(void* arg, FcitxKeySym, unsigned int); /**< FcitxIMKeyBlocker */
 
196
    typedef void (*FcitxIMUpdateSurroundingText)(void* arg); /**< FcitxIMKeyBlocker */
 
197
    typedef void (*FcitxIMOnClose)(void* arg, FcitxIMCloseEventType);
 
198
 
 
199
    /**
 
200
     * a more fexible interface for input method
 
201
     *
 
202
     * @since 4.2.3
 
203
     **/
 
204
    typedef struct _FcitxIMIFace {
 
205
        FcitxIMResetIM ResetIM /**< Reset input method state */;
 
206
        FcitxIMDoInput DoInput /**< process key input */;
 
207
        FcitxIMGetCandWords GetCandWords; /**< get candidate words */
 
208
        FcitxIMPhraseTips PhraseTips; /**< don't use it */
 
209
        FcitxIMSave Save; /**< force save input method data */
 
210
        FcitxIMInit Init; /**< called when switch to this input method */
 
211
        FcitxIMReloadConfig ReloadConfig; /**< reload configuration */
 
212
        FcitxIMKeyBlocker KeyBlocker; /**< block unused key */
 
213
        FcitxIMUpdateSurroundingText UpdateSurroundingText; /**< surrounding text update trigger */
 
214
        FcitxIMDoInput DoReleaseInput; /**< process key release event */
 
215
        FcitxIMOnClose OnClose; /**< process when im being switched away */
 
216
        void* padding[62]; /**< padding */
 
217
    } FcitxIMIFace;
 
218
 
 
219
    /**
 
220
     * Fcitx Input method instance
 
221
     **/
 
222
    typedef struct _FcitxIM {
 
223
        /**
 
224
         * The name that can be display on the UI
 
225
         **/
 
226
        char              *strName;
 
227
        /**
 
228
         * icon name used to find icon
 
229
         **/
 
230
        char              *strIconName;
 
231
        /**
 
232
         * reset im status
 
233
         **/
 
234
        FcitxIMResetIM ResetIM;
 
235
        /**
 
236
         * process key input
 
237
         **/
 
238
        FcitxIMDoInput DoInput;
 
239
        /**
 
240
         * update candidate works function
 
241
         **/
 
242
        FcitxIMGetCandWords GetCandWords;
 
243
        /**
 
244
         * phrase tips function
 
245
         **/
 
246
        FcitxIMPhraseTips PhraseTips;
 
247
        /**
 
248
         * save function
 
249
         **/
 
250
        FcitxIMSave Save;
 
251
        /**
 
252
         * init function
 
253
         **/
 
254
        FcitxIMInit Init;
 
255
        /**
 
256
         * reload config function
 
257
         **/
 
258
        FcitxIMReloadConfig ReloadConfig;
 
259
 
 
260
        void* unused; /**< unused */
 
261
        /**
 
262
         * the pointer to im class
 
263
         **/
 
264
        void* klass;
 
265
        /**
 
266
         * the priority order
 
267
         **/
 
268
        int iPriority;
 
269
        /**
 
270
         * Language Code
 
271
         **/
 
272
        char langCode[LANGCODE_LENGTH + 1];
 
273
 
 
274
        /**
 
275
         * uniqueName
 
276
         **/
 
277
        char *uniqueName;
 
278
 
 
279
        /**
 
280
         * input method initialized or not
 
281
         */
 
282
        boolean initialized;
 
283
 
 
284
        /**
 
285
         * Fcitx Addon
 
286
         **/
 
287
        FcitxAddon* owner;
 
288
        /**
 
289
         * reload config function
 
290
         **/
 
291
        FcitxIMKeyBlocker KeyBlocker;
 
292
 
 
293
        FcitxIMUpdateSurroundingText UpdateSurroundingText; /**< called when surrounding text updated */
 
294
 
 
295
        FcitxIMDoInput DoReleaseInput;
 
296
 
 
297
        FcitxIMOnClose OnClose;
 
298
 
 
299
        void* padding[8]; /**< padding */
 
300
    } FcitxIM;
 
301
 
 
302
    /** a key event is press or release */
 
303
    typedef enum _FcitxKeyEventType {
 
304
        FCITX_PRESS_KEY,
 
305
        FCITX_RELEASE_KEY
 
306
    } FcitxKeyEventType;
 
307
 
 
308
    /**
 
309
     * Global Input State, including displayed message.
 
310
     **/
 
311
    typedef struct _FcitxInputState FcitxInputState;
 
312
 
 
313
    /**
 
314
     * create a new input state
 
315
     *
 
316
     * @return FcitxInputState*
 
317
     **/
 
318
    FcitxInputState* FcitxInputStateCreate();
 
319
 
 
320
    /**
 
321
     * the string pending commit
 
322
     *
 
323
     * @param input input state
 
324
     * @return char*
 
325
     **/
 
326
    char* FcitxInputStateGetOutputString(FcitxInputState* input);
 
327
 
 
328
    /**
 
329
     * @brief get last commit string
 
330
     *
 
331
     * @param input input state
 
332
     * @return const char*
 
333
     *
 
334
     * @since 4.2.3
 
335
     **/
 
336
    const char* FcitxInputStateGetLastCommitString(FcitxInputState * input);
 
337
 
 
338
    /**
 
339
     * get current input method, return result can be NULL.
 
340
     *
 
341
     * @param instance fcitx instance
 
342
     * @return _FcitxIM*
 
343
     **/
 
344
    struct _FcitxIM* FcitxInstanceGetCurrentIM(struct _FcitxInstance *instance);
 
345
 
 
346
    /**
 
347
     * get input method by name
 
348
     *
 
349
     * @param instance fcitx instance
 
350
     * @param index index
 
351
     * @return _FcitxIM*
 
352
     *
 
353
     * @since 4.2.7
 
354
     **/
 
355
    struct _FcitxIM* FcitxInstanceGetIMByIndex(struct _FcitxInstance* instance, int index);
 
356
 
 
357
    /**
 
358
     * get im index by im name
 
359
     *
 
360
     * @param instance fcitx instance
 
361
     * @param imName im name
 
362
     * @return int im index
 
363
     *
 
364
     * @since 4.2
 
365
     **/
 
366
    int FcitxInstanceGetIMIndexByName(struct _FcitxInstance* instance, const char* imName);
 
367
 
 
368
    /**
 
369
     * get im index by im name
 
370
     *
 
371
     * @param instance fcitx instance
 
372
     * @param imName im name
 
373
     * @return int im index
 
374
     *
 
375
     * @since 4.2.7
 
376
     **/
 
377
    struct _FcitxIM* FcitxInstanceGetIMByName(struct _FcitxInstance* instance, const char* imName);
 
378
 
 
379
    /**
 
380
     * enable im
 
381
     *
 
382
     * @param instance fcitx instance
 
383
     * @param ic input context
 
384
     * @param keepState keep current state or not
 
385
     * @return void
 
386
     **/
 
387
    void FcitxInstanceEnableIM(struct _FcitxInstance* instance, struct _FcitxInputContext* ic, boolean keepState);
 
388
 
 
389
    /**
 
390
     * End Input
 
391
     *
 
392
     * @param instance
 
393
     * @param ic input context
 
394
     * @return void
 
395
     **/
 
396
    void FcitxInstanceCloseIM(struct _FcitxInstance* instance, struct _FcitxInputContext* ic);
 
397
 
 
398
    /**
 
399
     * Change im state between IS_ACTIVE and IS_ENG
 
400
     *
 
401
     * @param instance fcitx instance
 
402
     * @param ic input context
 
403
     * @return void
 
404
     **/
 
405
    void FcitxInstanceChangeIMState(struct _FcitxInstance* instance, struct _FcitxInputContext* ic);
 
406
 
 
407
    /**
 
408
     * reset input state
 
409
     *
 
410
     * @param instance fcitx instance
 
411
     * @return void
 
412
     **/
 
413
    void FcitxInstanceResetInput(struct _FcitxInstance* instance);
 
414
 
 
415
    /**
 
416
     * clean whole input window
 
417
     *
 
418
     * @param instance fcitx instance
 
419
     * @return void
 
420
     **/
 
421
    void FcitxInstanceCleanInputWindow(struct _FcitxInstance *instance);
 
422
 
 
423
    /**
 
424
     * clean preedit string and aux up
 
425
     *
 
426
     * @param instance fcitx instance
 
427
     * @return void
 
428
     **/
 
429
    void FcitxInstanceCleanInputWindowUp(struct _FcitxInstance *instance);
 
430
 
 
431
    /**
 
432
     * clean candidate word list and aux down
 
433
     *
 
434
     * @param instance fcitx instance
 
435
     * @return void
 
436
     **/
 
437
    void FcitxInstanceCleanInputWindowDown(struct _FcitxInstance *instance);
 
438
 
 
439
    /**
 
440
     * Sometimes, we use INPUT_RETURN_VALUE not from ProcessKey, so use this function to do the correct thing.
 
441
     *
 
442
     * @param instance fcitx instance
 
443
     * @param retVal input return val
 
444
     * @return void
 
445
     **/
 
446
    void FcitxInstanceProcessInputReturnValue(
 
447
        struct _FcitxInstance* instance,
 
448
        INPUT_RETURN_VALUE retVal
 
449
    );
 
450
 
 
451
    /**
 
452
     * register a new input method
 
453
     *
 
454
     * @param instance fcitx instance
 
455
     * @param imclass pointer to input method class
 
456
     * @param uniqueName uniqueName which cannot be duplicated to others
 
457
     * @param name input method name
 
458
     * @param iconName icon name
 
459
     * @param Init init callback
 
460
     * @param ResetIM reset callback
 
461
     * @param DoInput do input callback
 
462
     * @param GetCandWords get candidate words callback
 
463
     * @param PhraseTips phrase tips callback
 
464
     * @param Save save callback
 
465
     * @param ReloadConfig reload config callback
 
466
     * @param KeyBlocker key blocker callback
 
467
     * @param priority order of this input method
 
468
     * @param langCode language code for this input method
 
469
     * @return void
 
470
     **/
 
471
    void FcitxInstanceRegisterIM(struct _FcitxInstance *instance,
 
472
                           void *imclass,
 
473
                           const char* uniqueName,
 
474
                           const char* name,
 
475
                           const char* iconName,
 
476
                           FcitxIMInit Init,
 
477
                           FcitxIMResetIM ResetIM,
 
478
                           FcitxIMDoInput DoInput,
 
479
                           FcitxIMGetCandWords GetCandWords,
 
480
                           FcitxIMPhraseTips PhraseTips,
 
481
                           FcitxIMSave Save,
 
482
                           FcitxIMReloadConfig ReloadConfig,
 
483
                           FcitxIMKeyBlocker KeyBlocker,
 
484
                           int priority,
 
485
                           const char *langCode
 
486
                          );
 
487
 
 
488
    /**
 
489
     * register a new input method
 
490
     *
 
491
     * @param instance fcitx instance
 
492
     * @param imclass pointer to input method class
 
493
     * @param uniqueName uniqueName which cannot be duplicated to others
 
494
     * @param name input method name
 
495
     * @param iconName icon name
 
496
     * @param iface interface
 
497
     * @param priority order of this input method
 
498
     * @param langCode language code for this input method
 
499
     * @return void
 
500
     *
 
501
     * @see FcitxInstanceRegisterIMv2
 
502
     *
 
503
     * @since 4.2.3
 
504
     **/
 
505
    void FcitxInstanceRegisterIMv2(struct _FcitxInstance *instance,
 
506
                       void *imclass,
 
507
                       const char* uniqueName,
 
508
                       const char* name,
 
509
                       const char* iconName,
 
510
                       FcitxIMIFace iface,
 
511
                       int priority,
 
512
                       const char *langCode
 
513
                      );
 
514
 
 
515
    /**
 
516
     * process a key event, should only used by frontend
 
517
     *
 
518
     * @param instance fcitx instance
 
519
     * @param event event type
 
520
     * @param timestamp timestamp
 
521
     * @param sym keysym
 
522
     * @param state key state
 
523
     * @return INPUT_RETURN_VALUE
 
524
     **/
 
525
    INPUT_RETURN_VALUE FcitxInstanceProcessKey(struct _FcitxInstance* instance, FcitxKeyEventType event, long unsigned int timestamp, FcitxKeySym sym, unsigned int state);
 
526
 
 
527
    /**
 
528
     * another half part for process key, will be called by FcitxInstanceProcessKey()
 
529
     *
 
530
     * @param instance fcitx instance
 
531
     * @param retVal last return value
 
532
     * @param event event type
 
533
     * @param timestamp timestamp
 
534
     * @param sym keysym
 
535
     * @param state key state
 
536
     * @return INPUT_RETURN_VALUE
 
537
     **/
 
538
    INPUT_RETURN_VALUE FcitxInstanceDoInputCallback(
 
539
        struct _FcitxInstance* instance,
 
540
        INPUT_RETURN_VALUE retVal,
 
541
        FcitxKeyEventType event,
 
542
        long unsigned int timestamp,
 
543
        FcitxKeySym sym,
 
544
        unsigned int state);
 
545
 
 
546
 
 
547
    /**
 
548
     * @brief choose candidate by index
 
549
     *
 
550
     * @param instance instance
 
551
     * @param index idx
 
552
     * @return INPUT_RETURN_VALUE
 
553
     **/
 
554
    void FcitxInstanceChooseCandidateByIndex(
 
555
        struct _FcitxInstance* instance,
 
556
        int index);
 
557
 
 
558
    /**
 
559
     * send a new key event to client
 
560
     *
 
561
     * @param instance fcitx instance
 
562
     * @param ic input context
 
563
     * @param event event tpye
 
564
     * @param sym keysym
 
565
     * @param state key state
 
566
     * @return void
 
567
     **/
 
568
    void FcitxInstanceForwardKey(struct _FcitxInstance* instance, struct _FcitxInputContext* ic, FcitxKeyEventType event, FcitxKeySym sym, unsigned int state);
 
569
 
 
570
    /**
 
571
     * save all input method data
 
572
     *
 
573
     * @param instance fcitx instance
 
574
     * @return void
 
575
     **/
 
576
    void FcitxInstanceSaveAllIM(struct _FcitxInstance* instance);
 
577
 
 
578
    /**
 
579
     * reload only an addon's configuration, there are some short hand for reloading
 
580
     * other configuration, "global" for ~/.config/fcitx/config, "profile" for
 
581
     * ~/.config/fcitx/profile, "addon" for addon info. "ui" for current user interface
 
582
     * Input method unique can be also used here.
 
583
     *
 
584
     * @param instance fcitx instance
 
585
     * @param addon addon name
 
586
     * @return void
 
587
     *
 
588
     * @since 4.2.7
 
589
     **/
 
590
    void FcitxInstanceReloadAddonConfig(struct _FcitxInstance* instance, const char* addon);
 
591
 
 
592
    /**
 
593
     * reload all config
 
594
     *
 
595
     * @param instance fcitx instance
 
596
     * @return void
 
597
     **/
 
598
    void FcitxInstanceReloadConfig(struct _FcitxInstance* instance);
 
599
 
 
600
    /**
 
601
     * switch to input method by index, if index is zero, it will be skipped
 
602
     *
 
603
     * @deprecated
 
604
     *
 
605
     * @see FcitxInstanceSwitchIMByIndex
 
606
     *
 
607
     * @param instance fcitx instance
 
608
     * @param index input method index
 
609
     * @return void
 
610
     **/
 
611
    FCITX_DEPRECATED void FcitxInstanceSwitchIM(struct _FcitxInstance* instance, int index);
 
612
 
 
613
 
 
614
    /**
 
615
     * switch to a input method by name, name need to be valid, otherwise it have no effect
 
616
     * And if the index is zero, the state will automatically change to inactive
 
617
     *
 
618
     * @param instance fcitx instance
 
619
     * @param name ...
 
620
     * @return void
 
621
     *
 
622
     * @since 4.2.4
 
623
     **/
 
624
    void FcitxInstanceSwitchIMByName(struct _FcitxInstance* instance, const char* name);
 
625
 
 
626
    /**
 
627
     * switch to a input method by index, index need to be valid, otherwise it have no effect
 
628
     * And if the object index is zero, the state will automatically change to inactive
 
629
     * -1 means scroll forward, and -2 means scroll backward.
 
630
     * -3 means scroll forward without first one, -4 mean scroll backward without first one.
 
631
     *
 
632
     *
 
633
     * @param instance fcitx instance
 
634
     * @param name ...
 
635
     * @return void
 
636
     *
 
637
     * @since 4.2.4
 
638
     **/
 
639
    void FcitxInstanceSwitchIMByIndex(struct _FcitxInstance* instance, int index);
 
640
 
 
641
    /**
 
642
     * check is choose key or not, if so, return the choose index
 
643
     *
 
644
     * @param sym keysym
 
645
     * @param state keystate
 
646
     * @param strChoose choose key string
 
647
     * @return int
 
648
     **/
 
649
    int FcitxHotkeyCheckChooseKey(FcitxKeySym sym, unsigned int state, const char* strChoose);
 
650
 
 
651
    /**
 
652
     * check is choose key or not, if so, return the choose index
 
653
     *
 
654
     * @param sym keysym
 
655
     * @param state keystate
 
656
     * @param strChoose choose key string
 
657
     * @param candState candidate keystate
 
658
     * @return int
 
659
     **/
 
660
    int FcitxHotkeyCheckChooseKeyAndModifier(FcitxKeySym sym, unsigned int state, const char* strChoose, int candState);
 
661
 
 
662
    /**
 
663
     * ...
 
664
     *
 
665
     * @param input ...
 
666
     * @return _FcitxCandidateWordList*
 
667
     **/
 
668
    struct _FcitxCandidateWordList* FcitxInputStateGetCandidateList(FcitxInputState* input);
 
669
 
 
670
    /**
 
671
     * get current is in remind or not.
 
672
     *
 
673
     * @param input input state
 
674
     * @return remind state
 
675
     **/
 
676
    boolean FcitxInputStateGetIsInRemind(FcitxInputState* input);
 
677
 
 
678
    /**
 
679
     * set remind state
 
680
     *
 
681
     * @param input input state
 
682
     * @param isInRemind remind state
 
683
     * @return void
 
684
     **/
 
685
    void FcitxInputStateSetIsInRemind(FcitxInputState* input, boolean isInRemind);
 
686
 
 
687
    /**
 
688
     * get current key will be only processed by DoInput or not.
 
689
     *
 
690
     * @param input input state
 
691
     * @return DoInput Only state
 
692
     **/
 
693
    boolean FcitxInputStateGetIsDoInputOnly(FcitxInputState* input);
 
694
 
 
695
    /**
 
696
     * set current key will be only processed by DoInput or not.
 
697
     *
 
698
     * @param input input state
 
699
     * @param isDoInputOnly DoInput Only state
 
700
     * @return void
 
701
     **/
 
702
    void FcitxInputStateSetIsDoInputOnly(FcitxInputState* input, boolean isDoInputOnly);
 
703
 
 
704
    /**
 
705
     * get a writable raw input buffer, which is used as a hint for other module
 
706
     *
 
707
     * @param input input state
 
708
     * @return char*
 
709
     **/
 
710
    char* FcitxInputStateGetRawInputBuffer(FcitxInputState* input);
 
711
 
 
712
    /**
 
713
     * get current cursor position, offset is counted by byte in Preedit String
 
714
     *
 
715
     * @param input input state
 
716
     * @return current cursor position
 
717
     **/
 
718
    int FcitxInputStateGetCursorPos(FcitxInputState* input);
 
719
 
 
720
    /**
 
721
     * set current cursor position, offset is counted by byte in Preedit String
 
722
     *
 
723
     * @param input input state
 
724
     * @param cursorPos current cursor position
 
725
     * @return void
 
726
     **/
 
727
    void FcitxInputStateSetCursorPos(FcitxInputState* input, int cursorPos);
 
728
 
 
729
    /**
 
730
     * get client cursor position, which is similar to cursor position, but used with client preedit
 
731
     *
 
732
     * @param input input state
 
733
     * @return current client cursor position
 
734
     **/
 
735
    int FcitxInputStateGetClientCursorPos(FcitxInputState* input);
 
736
 
 
737
    /**
 
738
     * set client cursor position, which is similar to cursor position, but used with client preedit
 
739
     *
 
740
     * @param input input state
 
741
     * @param cursorPos current client cursor position
 
742
     * @return void
 
743
     **/
 
744
    void FcitxInputStateSetClientCursorPos(FcitxInputState* input, int cursorPos);
 
745
 
 
746
    /**
 
747
     * get auxiliary string displayed in the upper side of input panel
 
748
     *
 
749
     * @param input input state
 
750
     * @return upper auxiliary string
 
751
     **/
 
752
    FcitxMessages* FcitxInputStateGetAuxUp(FcitxInputState* input);
 
753
 
 
754
    /**
 
755
     * get auxiliary string displayed in the lower side of input panel
 
756
     *
 
757
     * @param input input state
 
758
     * @return lower auxiliary string
 
759
     **/
 
760
    FcitxMessages* FcitxInputStateGetAuxDown(FcitxInputState* input);
 
761
 
 
762
    /**
 
763
     * get preedit string which will be displayed in the input panel with a cursor
 
764
     *
 
765
     * @param input input state
 
766
     * @return preedit string
 
767
     **/
 
768
    FcitxMessages* FcitxInputStateGetPreedit(FcitxInputState* input);
 
769
 
 
770
    /**
 
771
     * get preedit string which will be displayed in the client window with a cursor
 
772
     *
 
773
     * @param input input state
 
774
     * @return client preedit string
 
775
     **/
 
776
    FcitxMessages* FcitxInputStateGetClientPreedit(FcitxInputState* input);
 
777
 
 
778
    /**
 
779
     * get current raw input buffer size
 
780
     *
 
781
     * @param input input state
 
782
     * @return raw input buffer size
 
783
     **/
 
784
    int FcitxInputStateGetRawInputBufferSize(FcitxInputState* input);
 
785
 
 
786
    /**
 
787
     * set current raw input buffer size
 
788
     *
 
789
     * @param input input state
 
790
     * @param size raw input buffer size
 
791
     * @return void
 
792
     **/
 
793
    void FcitxInputStateSetRawInputBufferSize(FcitxInputState* input, int size);
 
794
 
 
795
    /**
 
796
     * get cursor is visible or not
 
797
     *
 
798
     * @param input input state
 
799
     * @return cursor visibility
 
800
     **/
 
801
    boolean FcitxInputStateGetShowCursor(FcitxInputState* input);
 
802
 
 
803
    /**
 
804
     * set cursor is visible or not
 
805
     *
 
806
     * @param input input state
 
807
     * @param showCursor cursor visibility
 
808
     * @return void
 
809
     **/
 
810
    void FcitxInputStateSetShowCursor(FcitxInputState* input, boolean showCursor);
 
811
 
 
812
    /**
 
813
     * get last char is single char or not
 
814
     *
 
815
     * @param input input state
 
816
     * @return int
 
817
     **/
 
818
    int FcitxInputStateGetLastIsSingleChar(FcitxInputState* input);
 
819
 
 
820
    /**
 
821
     * set last char is single char or not
 
822
     *
 
823
     * @param input input state
 
824
     * @param lastIsSingleChar ...
 
825
     * @return void
 
826
     **/
 
827
    void FcitxInputStateSetLastIsSingleChar(FcitxInputState* input, int lastIsSingleChar);
 
828
 
 
829
    /**
 
830
     * set keycode for current key event
 
831
     *
 
832
     * @param input input state
 
833
     * @param value keycode
 
834
     * @return void
 
835
     **/
 
836
    void FcitxInputStateSetKeyCode( FcitxInputState* input, uint32_t value );
 
837
 
 
838
    /**
 
839
     * set keysym for current key event
 
840
     *
 
841
     * @param input input state
 
842
     * @param value sym
 
843
     * @return void
 
844
     **/
 
845
    void FcitxInputStateSetKeySym( FcitxInputState* input, uint32_t value );
 
846
 
 
847
    /**
 
848
     * set keystate for current key state
 
849
     *
 
850
     * @param input input state
 
851
     * @param state key state
 
852
     * @return void
 
853
     **/
 
854
    void FcitxInputStateSetKeyState( FcitxInputState* input, uint32_t state );
 
855
 
 
856
    /**
 
857
     * get keycode for current key event
 
858
     *
 
859
     * @param input input state
 
860
     * @return uint32_t
 
861
     **/
 
862
    uint32_t FcitxInputStateGetKeyCode( FcitxInputState* input);
 
863
 
 
864
    /**
 
865
     * get keysym for current key event
 
866
     *
 
867
     * @param input input state
 
868
     * @return uint32_t
 
869
     **/
 
870
    uint32_t FcitxInputStateGetKeySym( FcitxInputState* input);
 
871
 
 
872
    /**
 
873
     * get keystate for current key event
 
874
     *
 
875
     * @param input input state
 
876
     * @return uint32_t
 
877
     **/
 
878
    uint32_t FcitxInputStateGetKeyState( FcitxInputState* input);
 
879
 
 
880
    /**
 
881
     * get input method from input method list by name
 
882
     *
 
883
     * @param instance fcitx instance
 
884
     * @param imas from available list or full list
 
885
     * @param name input method name
 
886
     * @return input method pointer
 
887
     **/
 
888
    FcitxIM* FcitxInstanceGetIMFromIMList(struct _FcitxInstance* instance, FcitxIMAvailableStatus imas, const char* name);
 
889
 
 
890
    /**
 
891
     * update current input method list
 
892
     *
 
893
     * @param instance fcitx instance
 
894
     * @return void
 
895
     **/
 
896
    void FcitxInstanceUpdateIMList(struct _FcitxInstance* instance);
 
897
 
 
898
    /**
 
899
     * notify surrounding text changed to im
 
900
     *
 
901
     * @param instance instance
 
902
     * @param ic ic
 
903
     * @return void
 
904
     **/
 
905
    void FcitxInstanceNotifyUpdateSurroundingText(struct _FcitxInstance* instance, struct _FcitxInputContext* ic);
 
906
 
 
907
    /**
 
908
     * an standard key blocker, block all the key that cause cursor move when raw input buffer is not empty.
 
909
     *
 
910
     * @param input input state
 
911
     * @param key keysym
 
912
     * @param state key state
 
913
     * @return INPUT_RETURN_VALUE
 
914
     **/
 
915
    INPUT_RETURN_VALUE FcitxStandardKeyBlocker(FcitxInputState* input, FcitxKeySym key, unsigned int state);
 
916
 
 
917
    /**
 
918
     * set local input method name
 
919
     *
 
920
     * @param instance Fcitx Instance
 
921
     * @param ic input context
 
922
     * @param imname im name
 
923
     * @return void
 
924
     **/
 
925
    void FcitxInstanceSetLocalIMName(struct _FcitxInstance* instance, struct _FcitxInputContext* ic, const char* imname);
 
926
 
 
927
    /**
 
928
     * unregister an im entry
 
929
     *
 
930
     * @param instance Fcitx Instance
 
931
     * @param name imname
 
932
     * @return void
 
933
     *
 
934
     * @since 4.2.6
 
935
     */
 
936
    void FcitxInstanceUnregisterIM(struct _FcitxInstance* instance, const char* name);
 
937
 
 
938
#ifdef __cplusplus
 
939
}
 
940
#endif
 
941
 
 
942
#endif
 
943
 
 
944
/**
 
945
 * @}
 
946
 */
 
947
// kate: indent-mode cstyle; space-indent on; indent-width 0;