guibuilder_pel7x64builder0
5 years ago
4 changed files with 202 additions and 1 deletions
@ -0,0 +1,56 @@ |
|||||||
|
From 6d2cde9633b5ee020cb60caea1cf61e090b86dd2 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Adam Jackson <ajax@redhat.com> |
||||||
|
Date: Fri, 24 Mar 2017 11:07:35 -0400 |
||||||
|
Subject: [PATCH 1/2] _XDefaultIOError: Reformat to be less ugly |
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com> |
||||||
|
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> |
||||||
|
--- |
||||||
|
src/XlibInt.c | 26 +++++++++++++------------- |
||||||
|
1 file changed, 13 insertions(+), 13 deletions(-) |
||||||
|
|
||||||
|
diff --git a/src/XlibInt.c b/src/XlibInt.c |
||||||
|
index 73afe024..903e47f3 100644 |
||||||
|
--- a/src/XlibInt.c |
||||||
|
+++ b/src/XlibInt.c |
||||||
|
@@ -1243,24 +1243,24 @@ _X_NORETURN int _XDefaultIOError( |
||||||
|
Display *dpy) |
||||||
|
{ |
||||||
|
if (ECHECK(EPIPE)) { |
||||||
|
- (void) fprintf (stderr, |
||||||
|
- "X connection to %s broken (explicit kill or server shutdown).\r\n", |
||||||
|
- DisplayString (dpy)); |
||||||
|
+ fprintf (stderr, |
||||||
|
+ "X connection to %s broken (explicit kill or server shutdown).\r\n", |
||||||
|
+ DisplayString (dpy)); |
||||||
|
} else { |
||||||
|
- (void) fprintf (stderr, |
||||||
|
- "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", |
||||||
|
+ fprintf (stderr, |
||||||
|
+ "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", |
||||||
|
#ifdef WIN32 |
||||||
|
- WSAGetLastError(), strerror(WSAGetLastError()), |
||||||
|
+ WSAGetLastError(), strerror(WSAGetLastError()), |
||||||
|
#else |
||||||
|
- errno, strerror (errno), |
||||||
|
+ errno, strerror (errno), |
||||||
|
#endif |
||||||
|
- DisplayString (dpy)); |
||||||
|
- (void) fprintf (stderr, |
||||||
|
- " after %lu requests (%lu known processed) with %d events remaining.\r\n", |
||||||
|
- NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), |
||||||
|
- QLength(dpy)); |
||||||
|
+ DisplayString (dpy)); |
||||||
|
+ fprintf (stderr, |
||||||
|
+ " after %lu requests (%lu known processed) with %d events remaining.\r\n", |
||||||
|
+ NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), |
||||||
|
+ QLength(dpy)); |
||||||
|
+ } |
||||||
|
|
||||||
|
- } |
||||||
|
exit(1); |
||||||
|
/*NOTREACHED*/ |
||||||
|
} |
||||||
|
-- |
||||||
|
2.21.0 |
||||||
|
|
@ -0,0 +1,79 @@ |
|||||||
|
From 5538b3e4ae6dee32c47db9dfc85b07bbe7b90f6c Mon Sep 17 00:00:00 2001 |
||||||
|
From: Adam Jackson <ajax@redhat.com> |
||||||
|
Date: Fri, 24 Mar 2017 11:07:36 -0400 |
||||||
|
Subject: [PATCH 2/2] _XDefaultIOError: Do better at detecting explicit |
||||||
|
shutdown |
||||||
|
|
||||||
|
Currently, when the X server crashes or a client is disconnected with |
||||||
|
XKillClient, you get a somewhat confusing error message from libX11 |
||||||
|
along the lines of: |
||||||
|
|
||||||
|
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" |
||||||
|
after 98 requests (40 known processed) with 0 events remaining. |
||||||
|
|
||||||
|
What's happening here is the previous recvmsg has thrown EAGAIN, since |
||||||
|
the socket is non-blocking. In this case, check whether the socket has |
||||||
|
any more data to read, and if not treat it like EPIPE. |
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com> |
||||||
|
--- |
||||||
|
src/XlibInt.c | 29 ++++++++++++++++++++++++++++- |
||||||
|
1 file changed, 28 insertions(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/src/XlibInt.c b/src/XlibInt.c |
||||||
|
index 903e47f3..dd39445b 100644 |
||||||
|
--- a/src/XlibInt.c |
||||||
|
+++ b/src/XlibInt.c |
||||||
|
@@ -50,6 +50,8 @@ from The Open Group. |
||||||
|
#ifdef XTHREADS |
||||||
|
#include "locking.h" |
||||||
|
|
||||||
|
+#include <sys/ioctl.h> |
||||||
|
+ |
||||||
|
/* these pointers get initialized by XInitThreads */ |
||||||
|
LockInfoPtr _Xglobal_lock = NULL; |
||||||
|
void (*_XCreateMutex_fn)(LockInfoPtr) = NULL; |
||||||
|
@@ -1234,6 +1236,21 @@ _XWireToEvent( |
||||||
|
return(True); |
||||||
|
} |
||||||
|
|
||||||
|
+static int |
||||||
|
+SocketBytesReadable(Display *dpy) |
||||||
|
+{ |
||||||
|
+ int bytes = 0, last_error; |
||||||
|
+#ifdef WIN32 |
||||||
|
+ last_error = WSAGetLastError(); |
||||||
|
+ ioctlsocket(ConnectionNumber(dpy), FIONREAD, &bytes); |
||||||
|
+ WSASetLastError(last_error); |
||||||
|
+#else |
||||||
|
+ last_error = errno; |
||||||
|
+ ioctl(ConnectionNumber(dpy), FIONREAD, &bytes); |
||||||
|
+ errno = last_error; |
||||||
|
+#endif |
||||||
|
+ return bytes; |
||||||
|
+} |
||||||
|
|
||||||
|
/* |
||||||
|
* _XDefaultIOError - Default fatal system error reporting routine. Called |
||||||
|
@@ -1242,7 +1259,17 @@ _XWireToEvent( |
||||||
|
_X_NORETURN int _XDefaultIOError( |
||||||
|
Display *dpy) |
||||||
|
{ |
||||||
|
- if (ECHECK(EPIPE)) { |
||||||
|
+ int killed = ECHECK(EPIPE); |
||||||
|
+ |
||||||
|
+ /* |
||||||
|
+ * If the socket was closed on the far end, the final recvmsg in |
||||||
|
+ * xcb will have thrown EAGAIN because we're non-blocking. Detect |
||||||
|
+ * this to get the more informative error message. |
||||||
|
+ */ |
||||||
|
+ if (ECHECK(EAGAIN) && SocketBytesReadable(dpy) <= 0) |
||||||
|
+ killed = True; |
||||||
|
+ |
||||||
|
+ if (killed) { |
||||||
|
fprintf (stderr, |
||||||
|
"X connection to %s broken (explicit kill or server shutdown).\r\n", |
||||||
|
DisplayString (dpy)); |
||||||
|
-- |
||||||
|
2.21.0 |
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
diff -up libX11-1.6.3/modules/im/ximcp/imDefFlt.c.jx libX11-1.6.3/modules/im/ximcp/imDefFlt.c |
||||||
|
--- libX11-1.6.3/modules/im/ximcp/imDefFlt.c.jx 2015-03-09 18:28:45.000000000 -0400 |
||||||
|
+++ libX11-1.6.3/modules/im/ximcp/imDefFlt.c 2015-03-10 12:32:31.912149644 -0400 |
||||||
|
@@ -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; |
||||||
|
diff -up libX11-1.6.3/modules/im/ximcp/imDefLkup.c.jx libX11-1.6.3/modules/im/ximcp/imDefLkup.c |
||||||
|
--- libX11-1.6.3/modules/im/ximcp/imDefLkup.c.jx 2015-03-09 18:28:45.000000000 -0400 |
||||||
|
+++ libX11-1.6.3/modules/im/ximcp/imDefLkup.c 2015-03-10 12:32:31.911149637 -0400 |
||||||
|
@@ -332,6 +332,17 @@ _XimForwardEvent( |
||||||
|
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)) |
||||||
|
@@ -604,6 +615,19 @@ _XimUnregCommitInfo( |
||||||
|
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; |
||||||
|
} |
||||||
|
|
Loading…
Reference in new issue