summaryrefslogtreecommitdiffstats
path: root/client/x11/platform.cpp
diff options
context:
space:
mode:
authorYaniv Kamay <ykamay@redhat.com>2009-11-21 19:28:59 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-11-30 18:22:13 +0200
commit6c5966d8ed8ff248ca21900aaf2350aac87f68e4 (patch)
treea210b657ee7f2815aeabad400b9bfa946cde50fb /client/x11/platform.cpp
parent81241dd8251078fb049d35b7bc8a6c4dcfb6fa98 (diff)
downloadspice-6c5966d8ed8ff248ca21900aaf2350aac87f68e4.tar.gz
spice-6c5966d8ed8ff248ca21900aaf2350aac87f68e4.tar.xz
spice-6c5966d8ed8ff248ca21900aaf2350aac87f68e4.zip
client: KeyHandler now receive unicode char event in addition to RedKey events
Diffstat (limited to 'client/x11/platform.cpp')
-rw-r--r--client/x11/platform.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 217664a4..1ac45ef8 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -64,7 +64,9 @@
static Display* x_display = NULL;
static XVisualInfo **vinfo = NULL;
-static GLXFBConfig **fb_config;
+static GLXFBConfig **fb_config = NULL;
+static XIM x_input_method = NULL;
+static XIC x_input_context = NULL;
static XContext win_proc_context;
static ProcessLoop* main_loop = NULL;
@@ -193,6 +195,11 @@ GLXFBConfig** XPlatform::get_fbconfig()
return fb_config;
}
+XIC XPlatform::get_input_context()
+{
+ return x_input_context;
+}
+
void XPlatform::set_win_proc(Window win, win_proc_t proc)
{
if (XSaveContext(x_display, win, win_proc_context, (XPointer)proc)) {
@@ -2021,6 +2028,25 @@ static void init_kbd()
num_lock_mask = get_modifier_mask(XK_Num_Lock);
}
+static void init_XIM()
+{
+ char app_name[20];
+ strcpy(app_name, "spicec");
+
+ XSetLocaleModifiers("");
+ x_input_method = XOpenIM(x_display, NULL, app_name, app_name);
+
+ if (!x_input_method) {
+ THROW("open IM failed");
+ }
+
+ x_input_context = XCreateIC(x_input_method, XNInputStyle, XIMPreeditNone | XIMStatusNone, NULL);
+
+ if (!x_input_context) {
+ THROW("create IC failed");
+ }
+}
+
static int x_error_handler(Display* display, XErrorEvent* error_event)
{
char error_str[256];
@@ -2072,6 +2098,8 @@ void Platform::init()
DBG(0, "");
+ setlocale(LC_ALL, "");
+
threads_enable = XInitThreads();
@@ -2127,6 +2155,7 @@ void Platform::init()
init_kbd();
init_xrandr();
init_xrender();
+ init_XIM();
struct sigaction act;
memset(&act, 0, sizeof(act));