libX11/0003-imDefLkup-Mark-and-unmark-fabricated-with-serial-0.patch

66 lines
2.0 KiB
Diff

From ed53956985d37c57fcd3587c642ee7ebf653d1af Mon Sep 17 00:00:00 2001
From: Takao Fujiwara <tfujiwar@redhat.com>
Date: Fri, 12 Apr 2024 10:50:33 +0900
Subject: [PATCH libX11 3/7] imDefLkup: Mark and unmark fabricated with serial
0
GTK2 applications with GTK_IM_MODULE=xim sets the serial number 0
to the XKeyEvent and the previous _XimFabricateSerial() logic did
not work for the applications.
Now the API marks to fabricate with the serial 0.
Closes: #205
Fixes: 024d229f ("ximcp: Unmark to fabricate key events with XKeyEvent serial")
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/246>
(cherry picked from commit 1181abd6ffede3ac5663a3a3d4ee66aef1fa553b)
---
modules/im/ximcp/imDefLkup.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/modules/im/ximcp/imDefLkup.c b/modules/im/ximcp/imDefLkup.c
index 31205e6b..53cf1f87 100644
--- a/modules/im/ximcp/imDefLkup.c
+++ b/modules/im/ximcp/imDefLkup.c
@@ -356,8 +356,11 @@ _XimFabricateSerial(
Xim im,
unsigned long serial)
{
- if (!serial)
- return False;
+ /* GTK2 XIM module sets serial=0. */
+ if (!serial) {
+ MARK_FABRICATED(im);
+ return True;
+ }
if (serial == im->private.proto.fabricated_serial) {
fprintf(stderr, "%s,%d: The key event is already fabricated.\n", __FILE__, __LINE__);
return False;
@@ -375,8 +378,11 @@ _XimUnfabricateSerial(
Xim im,
unsigned long serial)
{
- if (!serial)
- return False;
+ /* GTK2 XIM module sets serial=0. */
+ if (!serial) {
+ UNMARK_FABRICATED(im);
+ return True;
+ }
if (!im->private.proto.fabricated_serial) {
fprintf(stderr, "%s,%d: The key event is already unfabricated.\n", __FILE__, __LINE__);
return False;
@@ -394,8 +400,9 @@ _XimIsFabricatedSerial(
Xim im,
unsigned long serial)
{
+ /* GTK2 XIM module sets serial=0. */
if (!serial)
- return False;
+ return IS_FABRICATED(im);
return (serial == im->private.proto.fabricated_serial);
}
--
2.47.1