summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/gtk2/ibusimcontext.c6
-rw-r--r--client/gtk2/ibusimcontext.h2
-rw-r--r--client/x11/gdk-private.c4
-rw-r--r--client/x11/main.c2
-rw-r--r--lib/gtk2/ibusimclient.c27
5 files changed, 20 insertions, 21 deletions
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index c85c346..c42cc02 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -52,7 +52,6 @@ static guint _signal_preedit_end_id = 0;
static guint _signal_delete_surrounding_id = 0;
static guint _signal_retrieve_surrounding_id = 0;
-
/* functions prototype */
static void ibus_im_context_class_init (IBusIMContextClass *klass);
static void ibus_im_context_init (IBusIMContext *obj);
@@ -156,13 +155,13 @@ ibus_im_context_get_type (void)
return _ibus_type_im_context;
}
-GtkIMContext *
+IBusIMContext *
ibus_im_context_new (void)
{
IBusIMContext *obj;
obj = IBUS_IM_CONTEXT(g_object_new (IBUS_TYPE_IM_CONTEXT, NULL));
- return GTK_IM_CONTEXT(obj);
+ return obj;
}
static void
@@ -529,7 +528,6 @@ _client_forward_event_cb (IBusIMClient *client, const gchar *ic, GdkEvent *event
IBusIMContext *context = g_hash_table_lookup (_ic_table, ic);
g_return_if_fail (context != NULL);
- event->any.send_event = TRUE;
if (event->type == GDK_KEY_PRESS ||
event->type == GDK_KEY_RELEASE) {
/*
diff --git a/client/gtk2/ibusimcontext.h b/client/gtk2/ibusimcontext.h
index ab549cd..9f2636f 100644
--- a/client/gtk2/ibusimcontext.h
+++ b/client/gtk2/ibusimcontext.h
@@ -55,7 +55,7 @@ struct _IBusIMContextClass {
};
int ibus_im_context_get_type(void);
-GtkIMContext
+IBusIMContext
*ibus_im_context_new (void);
void ibus_im_context_register_type
(GTypeModule *type_module);
diff --git a/client/x11/gdk-private.c b/client/x11/gdk-private.c
index 83a49ed..75f2723 100644
--- a/client/x11/gdk-private.c
+++ b/client/x11/gdk-private.c
@@ -33,8 +33,10 @@ translate_key_event (GdkDisplay *display,
XEvent *xevent)
{
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
+#if 0
gunichar c = 0;
gchar buf[7];
+#endif
event->key.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;
event->key.time = xevent->xkey.time;
@@ -122,8 +124,8 @@ translate_key_event (GdkDisplay *display,
event->key.length = 0;
event->key.string = g_strdup ("");
}
-#endif
out:
+#endif
return;
}
diff --git a/client/x11/main.c b/client/x11/main.c
index 20c3af2..04bfa74 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -496,7 +496,6 @@ _xim_forward_gdk_event (GdkEventKey *event, X11IC *x11ic)
{
g_return_if_fail (x11ic != NULL);
- GTimeVal time;
IMForwardEventStruct fe = {0};
XEvent xkp = {0};
@@ -510,6 +509,7 @@ _xim_forward_gdk_event (GdkEventKey *event, X11IC *x11ic)
xkp.xkey.root = DefaultRootWindow (GDK_DISPLAY());
/*
+ GTimeVal time;
g_get_current_time (&time);
xkp.xkey.time = time.tv_sec * 1000 + time.tv_usec / 1000;
*/
diff --git a/lib/gtk2/ibusimclient.c b/lib/gtk2/ibusimclient.c
index 03bac85..8621620 100644
--- a/lib/gtk2/ibusimclient.c
+++ b/lib/gtk2/ibusimclient.c
@@ -47,6 +47,12 @@
#include "ibusmarshalers.h"
#include "ibusimclient.h"
+#define IBUS_NAME "org.freedesktop.IBus"
+#define IBUS_IFACE "org.freedesktop.IBus"
+#define IBUS_PATH "/org/freedesktop/IBus"
+
+#define IBUS_FORWARD_MASK (1<<25)
+#define I_(string) g_intern_static_string (string)
enum {
CONNECTED,
@@ -61,11 +67,6 @@ enum {
LAST_SIGNAL,
};
-#define IBUS_NAME "org.freedesktop.IBus"
-#define IBUS_IFACE "org.freedesktop.IBus"
-#define IBUS_PATH "/org/freedesktop/IBus"
-
-#define I_(string) g_intern_static_string (string)
/* IBusIMClientPriv */
struct _IBusIMClientPrivate {
@@ -572,7 +573,7 @@ ibus_im_client_init (IBusIMClient *obj)
g_object_ref (priv->keymap);
_keymap_find_japan_groups (client);
_keymap_find_yen_bar_keys (client);
- g_debug ("japan_groups = 0x%lx", priv->japan_groups);
+ g_debug ("japan_groups = 0x%x", priv->japan_groups);
priv->keymap_handler_id =
g_signal_connect (priv->keymap, "keys-changed",
@@ -695,7 +696,7 @@ ibus_im_client_filter_keypress (IBusIMClient *client, const gchar *ic, GdkEventK
guint state = event->state;
gboolean is_press = event->type == GDK_KEY_PRESS;
- if (event->send_event) {
+ if ((event->state & IBUS_FORWARD_MASK) != 0) {
return FALSE;
}
@@ -1533,7 +1534,7 @@ _ibus_call_with_reply (DBusConnection *connection, const gchar *method,
struct _KeyPressCallData {
IBusIMClient *client;
gchar *ic;
- GdkEvent event;
+ GdkEvent *event;
};
static KeyPressCallData *
@@ -1542,9 +1543,8 @@ _key_press_call_data_new (IBusIMClient *client, const gchar *ic, GdkEvent *event
KeyPressCallData *p = g_new (KeyPressCallData, 1);
p->client = g_object_ref (client);
p->ic = g_strdup (ic);
- p->event = *event;
- if (p->event.any.window)
- g_object_ref (p->event.any.window);
+ p->event = gdk_event_copy (event);
+ p->event->key.state |= IBUS_FORWARD_MASK;
return p;
}
@@ -1554,8 +1554,7 @@ _key_press_call_data_free (KeyPressCallData *p)
if (p) {
g_object_unref (p->client);
g_free (p->ic);
- if (p->event.any.window)
- g_object_unref (p->event.any.window);
+ gdk_event_free (p->event);
}
g_free (p);
}
@@ -1588,7 +1587,7 @@ _ibus_filter_keypress_reply_cb (DBusPendingCall *pending, void *user_data)
if (!retval) {
g_signal_emit (call_data->client, client_signals[FORWARD_EVENT], 0,
- call_data->ic, &(call_data->event));
+ call_data->ic, call_data->event);
}
}