summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2009-03-05 14:39:12 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2009-03-05 14:39:12 +0800
commitd415e945d62d69c097cf6aae701f42806529dfb7 (patch)
tree6869b129f47c6891d3757c18d9e48ded18ad5015
parent740acea3c7103af63f4e572c4e4c3ae39153430e (diff)
downloadibus-d415e945d62d69c097cf6aae701f42806529dfb7.tar.gz
ibus-d415e945d62d69c097cf6aae701f42806529dfb7.tar.xz
ibus-d415e945d62d69c097cf6aae701f42806529dfb7.zip
Process release key event correctly.
-rw-r--r--bus/inputcontext.c8
-rw-r--r--src/ibushotkey.c6
-rw-r--r--src/ibushotkey.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
index 663812e..4d66232 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
@@ -2048,6 +2048,9 @@ 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) {
@@ -2059,7 +2062,12 @@ 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,
0);
+ prev_keyval = keyval;
+ prev_modifiers = modifiers;
+
if (event == trigger) {
if (priv->engine == NULL) {
g_signal_emit (context, context_signals[REQUEST_ENGINE], 0, NULL);
diff --git a/src/ibushotkey.c b/src/ibushotkey.c
index 0f1b314..1d3a4b3 100644
--- a/src/ibushotkey.c
+++ b/src/ibushotkey.c
@@ -459,6 +459,8 @@ GQuark
ibus_hotkey_profile_filter_key_event (IBusHotkeyProfile *profile,
guint keyval,
guint modifiers,
+ guint prev_keyval,
+ guint prev_modifiers,
gpointer user_data)
{
IBusHotkeyProfilePrivate *priv;
@@ -469,6 +471,10 @@ ibus_hotkey_profile_filter_key_event (IBusHotkeyProfile *profile,
.modifiers = modifiers & priv->mask,
};
+ if ((modifiers & IBUS_RELEASE_MASK) && keyval != prev_keyval) {
+ return 0;
+ }
+
GQuark event = (GQuark) GPOINTER_TO_UINT (g_tree_lookup (priv->hotkeys, &hotkey));
if (event != 0) {
diff --git a/src/ibushotkey.h b/src/ibushotkey.h
index 75b0844..03331dd 100644
--- a/src/ibushotkey.h
+++ b/src/ibushotkey.h
@@ -80,6 +80,8 @@ GQuark ibus_hotkey_profile_filter_key_event
(IBusHotkeyProfile *profile,
guint keyval,
guint modifiers,
+ guint prev_keyval,
+ guint prev_modifiers,
gpointer user_data);
G_END_DECLS