Commit 1871ff03 authored by Choe Hwanjin's avatar Choe Hwanjin Committed by Ulrich Sibiller

XIM: Make Xim handle NEED_SYNC_REPLY flag

NEED_SYNC_REPLY flag should be in Xim not in Xic. Because the focused Xic can be changed before sending sync reply. After focused Xic changed, the new Xic doesn't have NEED_SYNC_REPLY flag enabled, so libX11 doesn't send XIM_SYNC_REPLY packet. This patch adds sync reply flag to Xim and removes sync reply from Xic. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=7869Signed-off-by: 's avatarChoe Hwanjin <choe.hwanjin@gmail.com> Reviewed-by: 's avatarJeremy Huddleston <jeremyhu@apple.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 7efa7da5
...@@ -161,6 +161,8 @@ typedef struct _XimProtoPrivateRec { ...@@ -161,6 +161,8 @@ typedef struct _XimProtoPrivateRec {
#define DELAYBINDABLE (1L << 3) #define DELAYBINDABLE (1L << 3)
#define RECONNECTABLE (1L << 4) #define RECONNECTABLE (1L << 4)
#endif /* XIM_CONNECTABLE */ #endif /* XIM_CONNECTABLE */
#define FABRICATED (1L << 5)
#define NEED_SYNC_REPLY (1L << 6)
/* /*
* macro for the flag of XIMPrivateRec * macro for the flag of XIMPrivateRec
...@@ -199,6 +201,20 @@ typedef struct _XimProtoPrivateRec { ...@@ -199,6 +201,20 @@ typedef struct _XimProtoPrivateRec {
(((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE))
#endif /* XIM_CONNECTABLE */ #endif /* XIM_CONNECTABLE */
#define IS_FABRICATED(im) \
(((Xim)im)->private.proto.flag & FABRICATED)
#define MARK_FABRICATED(im) \
(((Xim)im)->private.proto.flag |= FABRICATED)
#define UNMARK_FABRICATED(im) \
(((Xim)im)->private.proto.flag &= ~FABRICATED)
#define IS_NEED_SYNC_REPLY(im) \
(((Xim)im)->private.proto.flag & NEED_SYNC_REPLY)
#define MARK_NEED_SYNC_REPLY(im) \
(((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY)
#define UNMARK_NEED_SYNC_REPLY(im) \
(((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY)
/* /*
* bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec
*/ */
...@@ -259,9 +275,6 @@ typedef struct _XicProtoPrivateRec { ...@@ -259,9 +275,6 @@ typedef struct _XicProtoPrivateRec {
* bit mask for the flag of XICPrivateRec * bit mask for the flag of XICPrivateRec
*/ */
#define IC_CONNECTED (1L) #define IC_CONNECTED (1L)
#define FABLICATED (1L << 1)
#define NEED_SYNC_REPLY (1L << 2)
#define FOCUSED (1L << 3)
/* /*
* macro for the flag of XICPrivateRec * macro for the flag of XICPrivateRec
...@@ -273,27 +286,6 @@ typedef struct _XicProtoPrivateRec { ...@@ -273,27 +286,6 @@ typedef struct _XicProtoPrivateRec {
#define UNMARK_IC_CONNECTED(ic) \ #define UNMARK_IC_CONNECTED(ic) \
(((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED)
#define IS_FABLICATED(ic) \
(((Xic)ic)->private.proto.flag & FABLICATED)
#define MARK_FABLICATED(ic) \
(((Xic)ic)->private.proto.flag |= FABLICATED)
#define UNMARK_FABLICATED(ic) \
(((Xic)ic)->private.proto.flag &= ~FABLICATED)
#define IS_NEED_SYNC_REPLY(ic) \
(((Xic)ic)->private.proto.flag & NEED_SYNC_REPLY)
#define MARK_NEED_SYNC_REPLY(ic) \
(((Xic)ic)->private.proto.flag |= NEED_SYNC_REPLY)
#define UNMARK_NEED_SYNC_REPLY(ic) \
(((Xic)ic)->private.proto.flag &= ~NEED_SYNC_REPLY)
#define IS_FOCUSED(ic) \
(((Xic)ic)->private.proto.flag & FOCUSED)
#define MARK_FOCUSED(ic) \
(((Xic)ic)->private.proto.flag |= FOCUSED)
#define UNMARK_FOCUSED(ic) \
(((Xic)ic)->private.proto.flag &= ~FOCUSED)
/* /*
* macro for the filter_event_mask of XICPrivateRec * macro for the filter_event_mask of XICPrivateRec
*/ */
......
...@@ -128,9 +128,9 @@ _XimPendingFilter( ...@@ -128,9 +128,9 @@ _XimPendingFilter(
{ {
Xim im = (Xim)ic->core.im; Xim im = (Xim)ic->core.im;
if (IS_NEED_SYNC_REPLY(ic)) { if (IS_NEED_SYNC_REPLY(im)) {
(void)_XimProcSyncReply(im, ic); (void)_XimProcSyncReply(im, ic);
UNMARK_NEED_SYNC_REPLY(ic); UNMARK_NEED_SYNC_REPLY(im);
} }
return; return;
} }
...@@ -140,13 +140,11 @@ _XimProtoKeypressFilter( ...@@ -140,13 +140,11 @@ _XimProtoKeypressFilter(
Xic ic, Xic ic,
XKeyEvent *ev) XKeyEvent *ev)
{ {
#ifdef XIM_CONNECTABLE
Xim im = (Xim)ic->core.im; Xim im = (Xim)ic->core.im;
#endif
if (IS_FABLICATED(ic)) { if (IS_FABRICATED(im)) {
_XimPendingFilter(ic); _XimPendingFilter(ic);
UNMARK_FABLICATED(ic); UNMARK_FABRICATED(im);
return NOTFILTERD; return NOTFILTERD;
} }
...@@ -203,13 +201,11 @@ _XimProtoKeyreleaseFilter( ...@@ -203,13 +201,11 @@ _XimProtoKeyreleaseFilter(
Xic ic, Xic ic,
XKeyEvent *ev) XKeyEvent *ev)
{ {
#ifdef XIM_CONNECTABLE
Xim im = (Xim)ic->core.im; Xim im = (Xim)ic->core.im;
#endif
if (IS_FABLICATED(ic)) { if (IS_FABRICATED(im)) {
_XimPendingFilter(ic); _XimPendingFilter(ic);
UNMARK_FABLICATED(ic); UNMARK_FABRICATED(im);
return NOTFILTERD; return NOTFILTERD;
} }
......
...@@ -968,8 +968,6 @@ _XimProtoSetFocus( ...@@ -968,8 +968,6 @@ _XimProtoSetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
MARK_FOCUSED(ic);
_XimRegisterFilter(ic); _XimRegisterFilter(ic);
return; return;
} }
...@@ -1015,8 +1013,6 @@ _XimProtoUnsetFocus( ...@@ -1015,8 +1013,6 @@ _XimProtoUnsetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
UNMARK_FOCUSED(ic);
_XimUnregisterFilter(ic); _XimUnregisterFilter(ic);
return; return;
} }
......
...@@ -213,12 +213,8 @@ _XimRespSyncReply( ...@@ -213,12 +213,8 @@ _XimRespSyncReply(
Xic ic, Xic ic,
BITMASK16 mode) BITMASK16 mode)
{ {
if (mode & XimSYNCHRONUS) /* SYNC Request */ { if (mode & XimSYNCHRONUS) /* SYNC Request */
if (IS_FOCUSED(ic)) MARK_NEED_SYNC_REPLY(ic->core.im);
MARK_NEED_SYNC_REPLY(ic);
else
_XimProcSyncReply((Xim)ic->core.im, ic);
}
return True; return True;
} }
...@@ -356,7 +352,7 @@ _XimProcEvent( ...@@ -356,7 +352,7 @@ _XimProcEvent(
ev->xany.serial |= serial << 16; ev->xany.serial |= serial << 16;
ev->xany.send_event = False; ev->xany.send_event = False;
ev->xany.display = d; ev->xany.display = d;
MARK_FABLICATED(ic); MARK_FABRICATED(ic->core.im);
return; return;
} }
...@@ -706,7 +702,7 @@ _XimCommitRecv( ...@@ -706,7 +702,7 @@ _XimCommitRecv(
(void)_XimRespSyncReply(ic, flag); (void)_XimRespSyncReply(ic, flag);
MARK_FABLICATED(ic); MARK_FABRICATED(im);
ev.type = KeyPress; ev.type = KeyPress;
ev.send_event = False; ev.send_event = False;
......
...@@ -159,7 +159,7 @@ _XimProcExtForwardKeyEvent( ...@@ -159,7 +159,7 @@ _XimProcExtForwardKeyEvent(
XPutBackEvent(im->core.display, &ev); XPutBackEvent(im->core.display, &ev);
_XimRespSyncReply(ic, buf_s[0]); _XimRespSyncReply(ic, buf_s[0]);
MARK_FABLICATED(ic); MARK_FABRICATED(im);
return True; return True;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment