2023-04-12 10:15:09 +08:00
|
|
|
From f8b0946c5594728ce7e1cd04552acce05571cd4e Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: leeffo <leeffo@yeah.net>
|
|
|
|
|
Date: Wed, 12 Apr 2023 10:40:48 +0800
|
|
|
|
|
Subject: [PATCH] dont forward keycode 0
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
modules/im/ximcp/imDefFlt.c | 2 +-
|
|
|
|
|
modules/im/ximcp/imDefLkup.c | 24 ++++++++++++++++++++++++
|
|
|
|
|
2 files changed, 25 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/modules/im/ximcp/imDefFlt.c b/modules/im/ximcp/imDefFlt.c
|
|
|
|
|
index 44cc688..f89d2cb 100644
|
|
|
|
|
--- a/modules/im/ximcp/imDefFlt.c
|
|
|
|
|
+++ b/modules/im/ximcp/imDefFlt.c
|
2019-09-30 10:59:10 -04:00
|
|
|
@@ -142,7 +142,7 @@ _XimProtoKeypressFilter(
|
|
|
|
|
{
|
|
|
|
|
Xim im = (Xim)ic->core.im;
|
|
|
|
|
|
|
|
|
|
- if (IS_FABRICATED(im)) {
|
|
|
|
|
+ if ((ev->keycode == 0) || IS_FABRICATED(im)) {
|
|
|
|
|
_XimPendingFilter(ic);
|
|
|
|
|
UNMARK_FABRICATED(im);
|
|
|
|
|
return NOTFILTERD;
|
2023-04-12 10:15:09 +08:00
|
|
|
diff --git a/modules/im/ximcp/imDefLkup.c b/modules/im/ximcp/imDefLkup.c
|
|
|
|
|
index dd1adf5..61f9c95 100644
|
|
|
|
|
--- a/modules/im/ximcp/imDefLkup.c
|
|
|
|
|
+++ b/modules/im/ximcp/imDefLkup.c
|
|
|
|
|
@@ -333,6 +333,17 @@ _XimForwardEvent(
|
2019-09-30 10:59:10 -04:00
|
|
|
XEvent *ev,
|
|
|
|
|
Bool sync)
|
|
|
|
|
{
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Don't forward a key event which has keycode=0.
|
|
|
|
|
+ * keycode=0 is reserved for special purpose to let Xmb/wcLookupString()
|
|
|
|
|
+ * functions know that there is a commited string available from IM.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (((ev->type == KeyPress) || (ev->type == KeyRelease))) {
|
|
|
|
|
+ if (((XKeyEvent *)ev)->keycode == 0) {
|
|
|
|
|
+ return True;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
#ifdef EXT_FORWARD
|
|
|
|
|
if (((ev->type == KeyPress) || (ev->type == KeyRelease)))
|
|
|
|
|
if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync))
|
2023-04-12 10:15:09 +08:00
|
|
|
@@ -605,6 +616,19 @@ _XimUnregCommitInfo(
|
2019-09-30 10:59:10 -04:00
|
|
|
Xfree(info->keysym);
|
|
|
|
|
ic->private.proto.commit_info = info->next;
|
|
|
|
|
Xfree(info);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * "Commit" uses fabricated flag to process a commited string
|
|
|
|
|
+ * from IM engine.
|
|
|
|
|
+ * Turn off the fabricated flag here (unregister the commited
|
|
|
|
|
+ * information function). Otherwise, next regular key press
|
|
|
|
|
+ * event will be ignored at _XimProtoKeypressFilter() and it
|
|
|
|
|
+ * will not be passed to IM engine.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (IS_FABRICATED(ic)) {
|
|
|
|
|
+ UNMARK_FABRICATED(ic);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-12 10:15:09 +08:00
|
|
|
--
|
|
|
|
|
2.20.1
|
|
|
|
|
|