From 73c82c6b983e39e24f49c2c794d654bd349309d3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 27 Nov 2013 23:36:44 -0800 Subject: Print correct event names for events sent via SendEvent requests The high bit of an X11 event id is set to 0 for events generated by the server, 1 for events sent from another client via SendEvent requests. Previously xscope printed: ..............EVENT: **INVALID** (150) Now it prints: ..............EVENT: ConfigureNotify source: SendEvent Signed-off-by: Alan Coopersmith --- prtype.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'prtype.c') diff --git a/prtype.c b/prtype.c index 5889b52..96523f9 100644 --- a/prtype.c +++ b/prtype.c @@ -613,6 +613,28 @@ PrintEVENTFORM(const unsigned char *buf) return 32; } +int +PrintEVENT(const unsigned char *buf) +{ + uint8_t n = IByte(buf); + long e = (long) (n & 0x7f); + struct ValueListEntry *p; + + p = TD[EVENT].ValueList; + while (p != NULL && p->Value != e) + p = p->Next; + + if (p != NULL) + fprintf(stdout, "%s", p->Name); + else + fprintf(stdout, "**INVALID** (%d)", n); + + if (n & 0x80) + fprintf(stdout, "\n%s%20s: %s", Leader, "source", "SendEvent"); + + return 1; +} + /* ************************************************************ */ int -- cgit v1.2.1