~ubuntu-branches/ubuntu/quantal/fbterm-ucimf/quantal

« back to all changes in this revision

Viewing changes to immessage.h

  • Committer: Bazaar Package Importer
  • Author(s): Aron Xu
  • Date: 2010-01-30 14:06:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100130140631-lxlcr8er962pperf
Tags: upstream-0.2.6
Import upstream version 0.2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright © 2008-2009 dragchan <zgchan317@gmail.com>
 
3
 *   This file is part of FbTerm.
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or
 
6
 *   modify it under the terms of the GNU General Public License
 
7
 *   as published by the Free Software Foundation; either version 2
 
8
 *   of the License, or (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 Free Software
 
17
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef IM_MESSAGE_H
 
22
#define IM_MESSAGE_H
 
23
 
 
24
/*
 
25
 * messages from IM to Fbterm:
 
26
 *
 
27
 * Connect:         IM send it to FbTerm after ending initization
 
28
 * PutText:         IM put translated input method text in this message, then send back to FbTerm
 
29
 * SetWins:         IM tell FbTerm that rectangles contained in the message will be used to draw IM's UI,
 
30
 *                  and FbTerm should NOT paint on these areas
 
31
 *
 
32
 *
 
33
 * messages from FbTerm to IM:
 
34
 *
 
35
 * FbTermInfo:      FbTerm send font name/size etc to IM, help IM to keep same UI with FbTerm
 
36
 * Disconnect:      FbTerm request IM to exit
 
37
 * Active:          FbTerm tell IM that user switch input method state on
 
38
 * Deactive:        FbTerm tell IM that user siwtch input method state off
 
39
 * SendKey:         when input method state is on, FbTerm send all keybord keys to IM
 
40
 * CursorPosition:  FbTerm tell IM that cursor poisition has been changed
 
41
 * AckWins:         when receive message SetWins, FbTerm send this message to IM,
 
42
 *                  on the other side, after sending SetWins, IM will keep waiting until receive AckWins from FbTerm
 
43
 * TermMode:        FbTerm send term mode to IM, help IM to translate keycode to terminal input
 
44
 *
 
45
 */
 
46
 
 
47
typedef enum {
 
48
        Connect = 0, Disconnect,
 
49
        Active, Deactive,
 
50
        SendKey, PutText,
 
51
        SetWins, AckWins,
 
52
        CursorPosition, FbTermInfo, TermMode,
 
53
        ShowUI, HideUI, AckHideUI
 
54
} MessageType;
 
55
 
 
56
typedef struct {
 
57
        unsigned char rotate;
 
58
        unsigned short fontSize, fontHeight, fontWidth;
 
59
        char fontName[0];
 
60
} Info;
 
61
 
 
62
#define NR_IM_WINS 10
 
63
 
 
64
typedef struct {
 
65
        unsigned x, y;
 
66
        unsigned w, h;
 
67
} ImWin;
 
68
 
 
69
typedef struct {
 
70
        unsigned short type;  // message's type, see enum MessageType
 
71
        unsigned short len;  // message's length, including head and body
 
72
 
 
73
        union {
 
74
                char keys[0]; // for SendKey
 
75
                char texts[0]; // for PutText
 
76
                ImWin wins[0]; // for SetWins
 
77
                Info info; // for FbTermInfo
 
78
                char raw; // for Connect, 1: when IM actived, FbTerm sets keyboard mode to K_MEDIUMRAW
 
79
                                  //              0: keep K_UNICODE mode
 
80
 
 
81
                struct {
 
82
                        char crWithLf;
 
83
                        char applicKeypad;
 
84
                        char cursorEscO;
 
85
                } term; // for TermMode;
 
86
 
 
87
                struct {
 
88
                        unsigned x, y;
 
89
                } cursor; // for CursorPosition
 
90
        };
 
91
} Message;
 
92
 
 
93
#endif