加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dont-forward-keycode-0.patch 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
Funda Wang 提交于 2024-08-04 20:12 . 1.8.10
diff -up libX11-1.8.10/modules/im/ximcp/imDefFlt.c.jx libX11-1.8.10/modules/im/ximcp/imDefFlt.c
--- libX11-1.8.10/modules/im/ximcp/imDefFlt.c.jx 2024-08-04 19:08:38.884682300 +0800
+++ libX11-1.8.10/modules/im/ximcp/imDefFlt.c 2024-08-04 19:09:16.340626000 +0800
@@ -143,7 +143,7 @@
{
Xim im = (Xim)ic->core.im;
- if (_XimIsFabricatedSerial(im, ev)) {
+ if ((ev->keycode == 0) || _XimIsFabricatedSerial(im, ev)) {
_XimPendingFilter(ic);
_XimUnfabricateSerial(im, ic, ev);
return NOTFILTERD;
diff -up libX11-1.8.10/modules/im/ximcp/imDefLkup.c.jx libX11-1.8.10/modules/im/ximcp/imDefLkup.c
--- libX11-1.8.10/modules/im/ximcp/imDefLkup.c.jx 2024-08-04 19:09:16.340626000 +0800
+++ libX11-1.8.10/modules/im/ximcp/imDefLkup.c 2024-08-04 19:09:16.340626000 +0800
@@ -333,6 +333,17 @@
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))
@@ -703,6 +714,19 @@
else
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;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化