Store prev_key event in inputcontext object.
authorPeng Huang <shawn.p.huang@gmail.com>
Mon, 13 Apr 2009 04:27:10 +0000 (12:27 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Mon, 13 Apr 2009 04:28:46 +0000 (12:28 +0800)
bus/inputcontext.c

index 723f3af..456e049 100644 (file)
@@ -80,6 +80,10 @@ struct _BusInputContextPrivate {
     gint w;
     gint h;
 
+    /* prev key event */
+    guint prev_keyval;
+    guint prev_modifiers;
+
     /* preedit text */
     IBusText *preedit_text;
     guint     preedit_cursor_pos;
@@ -529,6 +533,9 @@ bus_input_context_init (BusInputContext *context)
     priv->has_focus = FALSE;
     priv->enabled = FALSE;
 
+    priv->prev_keyval = IBUS_VoidSymbol;
+    priv->prev_modifiers = 0;
+
     priv->capabilities = 0;
 
     priv->x = 0;
@@ -2048,9 +2055,6 @@ bus_input_context_filter_keyboard_shortcuts (BusInputContext    *context,
     static GQuark next_factory;
     static GQuark prev_factory;
 
-    static guint prev_keyval = 0;
-    static guint prev_modifiers = 0;
-
     GQuark event;
 
     if (trigger == 0) {
@@ -2062,11 +2066,11 @@ bus_input_context_filter_keyboard_shortcuts (BusInputContext    *context,
     event = ibus_hotkey_profile_filter_key_event (BUS_DEFAULT_HOTKEY_PROFILE,
                                                   keyval,
                                                   modifiers,
-                                                  prev_keyval,
-                                                  prev_modifiers,
+                                                  priv->prev_keyval,
+                                                  priv->prev_modifiers,
                                                   0);
-    prev_keyval = keyval;
-    prev_modifiers = modifiers;
+    priv->prev_keyval = keyval;
+    priv->prev_modifiers = modifiers;
 
     if (event == trigger) {
         if (priv->engine == NULL) {