diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-05-07 19:04:10 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-05-07 20:35:17 -0400 |
commit | dc33dc58f8ec841f002b9c65fb86b879b2d7d44a (patch) | |
tree | c8d0071f3f0abfd34915339c046989f4d73c8305 /src/Event.c | |
parent | f0ff9ea4fc653d27db3251a5bae97df4b963b1ba (diff) | |
download | xorg-lib-libXt-dc33dc58f8ec841f002b9c65fb86b879b2d7d44a.tar.gz |
Proposed revision of XtAppMainLoop() in
https://gitlab.freedesktop.org/xorg/lib/libxt/issues/7
caused applications such as xclock to hang, because it did first not
check if there was an available event corresponding to the mask
parameter before calling XtAppProcessEvent().
For instance, if the mask was XtIMXEvent, it would ignore timer events
until an X event occurred.
Fix this by checking with XtAppPending() when the mask is not XtIMAll.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/Event.c')
-rw-r--r-- | src/Event.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Event.c b/src/Event.c index 8feb2f6..dee108d 100644 --- a/src/Event.c +++ b/src/Event.c @@ -74,6 +74,7 @@ in this Software without prior written authorization from The Open Group. #include "IntrinsicI.h" #include "Shell.h" #include "StringDefs.h" +#include <stdio.h> typedef struct _XtEventRecExt { int type; @@ -1543,10 +1544,17 @@ void XtAppMainLoop( XtAppContext app) { XtInputMask m = XtIMAll; + XtInputMask t; LOCK_APP(app); do { - if( m == 0 ) m=XtIMAll; - XtAppProcessEvent(app, m); + if (m == 0) { + m = XtIMAll; + /* wait for any event, blocking */ + XtAppProcessEvent(app, m); + } else if (((t = XtAppPending(app)) & m)) { + /* wait for certain events, stepping through choices */ + XtAppProcessEvent(app, t & m); + } m >>= 1; } while(app->exit_flag == FALSE); UNLOCK_APP(app); |