Emit FORWARD_KEY_EVENT signal correctly
authorPeng Huang <shawn.p.huang@gmail.com>
Tue, 8 Jun 2010 23:16:33 +0000 (07:16 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Tue, 8 Jun 2010 23:18:02 +0000 (07:18 +0800)
client/x11/main.c
src/ibusinputcontext.c

index 2b30a545ac8794b5643d8fcb65158e58fef4bd8a..3d93c2ad8287da165db3105ad8094f7af5b1c9bd 100644 (file)
@@ -802,10 +802,6 @@ _context_forward_key_event_cb (IBusInputContext *context,
 {
     g_assert (x11ic);
 
-    /* ignore handled key event */
-    if (state & IBUS_HANDLED_MASK)
-        return;
-
     _xim_forward_key_event (x11ic, keyval, keycode, state);
 }
 
index 5869a854f9e150d51de14872834b5bb642138f8f..295655defcfd814da760baf75fc9772ed8820504 100644 (file)
@@ -680,6 +680,8 @@ ibus_input_context_ibus_signal (IBusProxy           *proxy,
                                             G_TYPE_INVALID);
 
             if (retval) {
+                /* Forward key event back with IBUS_FORWARD_MASK. And process_key_event will
+                 * not process key event with IBUS_FORWARD_MASK again. */
                 g_signal_emit (context,
                                context_signals[FORWARD_KEY_EVENT],
                                0,
@@ -762,19 +764,16 @@ _process_key_event_reply_cb (IBusPendingCall *pending,
         retval = FALSE;
     }
 
-    if (retval == TRUE) {
-        call_data->state |= IBUS_HANDLED_MASK;
-    }
-    else {
-        call_data->state |= IBUS_IGNORED_MASK;
+    if (!retval) {
+        /* Forward key event back with IBUS_FORWARD_MASK. And process_key_event will
+         * not process key event with IBUS_FORWARD_MASK again. */
+        g_signal_emit (call_data->context,
+                       context_signals[FORWARD_KEY_EVENT],
+                       0,
+                       call_data->keyval,
+                       call_data->keycode,
+                       call_data->state | IBUS_FORWARD_MASK);
     }
-    /* forward key event back with ignored or handled mask */
-    g_signal_emit (call_data->context,
-                   context_signals[FORWARD_KEY_EVENT],
-                   0,
-                   call_data->keyval,
-                   call_data->keycode,
-                   call_data->state);
 }
 
 static void