1 /* Copyright (C) 2011 Edward Der-Hua Liu, Hsin-Chu, Taiwan
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation version 2.1
6 * of the License.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 /**
19 @file hime-gb-toggle.c
20 @brief Send control messages to hime server
21
22 Provides:
23 hime-gb-toggle
24 hime-trad
25 hime-sim
26 hime-exit
27 hime-kbm-toggle
28
29 */
30
31 #include "hime.h"
32
33 #include "hime-im-client.h"
34
main(int argc,char ** argv)35 int main (int argc, char **argv) {
36 gdk_init (NULL, NULL);
37
38 /* Force to output original string, usually are Traditional Chinese */
39 if (strstr (argv[0], "hime-trad"))
40 send_hime_message (GDK_DISPLAY (), TRAD_OUTPUT_TOGGLE);
41
42 /* Force to output Simplified Chinese */
43 if (strstr (argv[0], "hime-sim"))
44 send_hime_message (GDK_DISPLAY (), SIM_OUTPUT_TOGGLE);
45
46 /* Toggle between Original string and Simplified Chinese */
47 if (strstr (argv[0], "hime-gb-toggle"))
48 send_hime_message (GDK_DISPLAY (), GB_OUTPUT_TOGGLE);
49
50 /* Toggle virtual keyboard */
51 if (strstr (argv[0], "hime-kbm-toggle"))
52 send_hime_message (GDK_DISPLAY (), KBM_TOGGLE);
53
54 if (strstr (argv[0], "hime-exit")) {
55 Display *dpy = GDK_DISPLAY ();
56 if (find_hime_window (dpy) == None)
57 return 0;
58 send_hime_message (dpy, HIME_EXIT_MESSAGE);
59 }
60
61 return 0;
62 }
63