ximcp: Unmark fabricated with serial 0 and Xic commit_info

GTK2 XIM resets the XKeyEvent serial to 0 even if _XimCommitRecv()
sets the serial so now checks if the events are sent with
Xic->private.proto.commit_info.

Closes: !246
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/246>
This commit is contained in:
Takao Fujiwara 2024-04-26 01:29:34 +09:00
parent 5a1e62d77b
commit 898746f9b1
3 changed files with 14 additions and 3 deletions

View file

@ -145,7 +145,7 @@ _XimProtoKeypressFilter(
if (_XimIsFabricatedSerial(im, ev)) {
_XimPendingFilter(ic);
_XimUnfabricateSerial(im, ev);
_XimUnfabricateSerial(im, ic, ev);
return NOTFILTERD;
}
/* w=0 is used for _XimIsFabricatedSerial() only */
@ -210,7 +210,7 @@ _XimProtoKeyreleaseFilter(
if (_XimIsFabricatedSerial(im, ev)) {
_XimPendingFilter(ic);
_XimUnfabricateSerial(im, ev);
_XimUnfabricateSerial(im, ic, ev);
return NOTFILTERD;
}
/* w=0 is used for _XimIsFabricatedSerial() only */

View file

@ -367,10 +367,20 @@ _XimFabricateSerial(
Bool
_XimUnfabricateSerial(
Xim im,
Xic ic,
XKeyEvent *event)
{
if (!im->private.proto.enable_fabricated_order) {
UNMARK_FABRICATED(im);
return True;
}
/* GTK2 XIM module sets serial=0. */
if (!event->serial || !im->private.proto.enable_fabricated_order) {
if (!event->serial) {
/* _XimCommitRecv() sets event->serial and call _XimFabricateSerial()
* but GTK2 XIM always reset event->serial=0 with XFilterEvent().
*/
if (ic && ic->private.proto.commit_info)
im->private.proto.fabricated_serial = 0;
UNMARK_FABRICATED(im);
return True;
}

View file

@ -319,6 +319,7 @@ _XimFabricateSerial(
Bool
_XimUnfabricateSerial(
Xim im,
Xic ic,
XKeyEvent *event);
Bool