1
/* Copyright (C) 2011 Edward Der-Hua Liu, Hsin-Chu, Taiwan
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; either
6
* version 2.1 of the License, or (at your option) any later version.
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.
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
18
#ifndef HIME_IM_CLIENT_H
19
#define HIME_IM_CLIENT_H
22
typedef struct HIME_client_handle_S {
24
Window client_win; /* client window */
25
u_int input_style; /* input style */
26
XPoint spot_location; /* spot location */
27
// below is private data, don't modify them.
30
struct HIME_PASSWD *passwd;
35
FLAG_HIME_client_handle_has_focus = 1,
36
FLAG_HIME_client_handle_use_preedit = 2,
37
FLAG_HIME_client_handle_raise_window = 0x1000 // for mozilla, dirty fix
41
FLAG_HIME_srv_ret_status_use_pop_up = 1 // If this is used, we don't need the dirty fix
49
HIME_client_handle *hime_im_client_open(Display *disp);
50
void hime_im_client_close(HIME_client_handle *handle);
51
void hime_im_client_focus_in(HIME_client_handle *handle);
52
void hime_im_client_focus_out(HIME_client_handle *handle);
53
void hime_im_client_focus_out2(HIME_client_handle *handle, char **rstr);
54
void hime_im_client_set_window(HIME_client_handle *handle, Window win);
55
void hime_im_client_set_cursor_location(HIME_client_handle *handle,
57
/* rstr returns UTF-8 encoded string, you should use 'free()' to free the
61
FALSE : the key is rejected, should use client's own result(ASCII key).
62
TRUE : the key is accepted, translated result is in rstr.
64
int hime_im_client_forward_key_press(HIME_client_handle *handle,
65
KeySym key, u_int state,
67
// return some state bits instead of TRUE/FALSE
68
int hime_im_client_forward_key_press2(HIME_client_handle *handle,
69
KeySym key, u_int state,
71
int hime_im_client_forward_key_release(HIME_client_handle *handle,
72
KeySym key, u_int state,
75
void hime_im_client_set_flags(HIME_client_handle *handle, int flags, int *ret_flags);
76
void hime_im_client_clear_flags(HIME_client_handle *handle, int flags, int *ret_flags);
78
void hime_im_client_reset(HIME_client_handle *handle);
79
void hime_im_client_message(HIME_client_handle *handle, char *message);
81
#include "hime-im-client-attr.h"
82
int hime_im_client_get_preedit(HIME_client_handle *handle, char **str, HIME_PREEDIT_ATTR att[], int *cursor, int *sub_comp_len);
84
Window find_hime_window(Display *dpy);