+ Lisp_Object devcons, concons;
+ CONSOLE_LOOP (concons)
+ {
+ struct console *con = XCONSOLE (XCAR (concons));
+ if (!con->input_enabled)
+ continue;
+
+ /* sjt sez: Have you tried the loop over devices with XtAppPending(),
+ not XEventsQueued()?
+ Ben Sigelman sez: No.
+ sjt sez: I'm guessing that the reason that your patch "works" is this:
+
+ + struct device* d;
+ + Display* display;
+ + d = XDEVICE (XCAR (devcons));
+ + if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) {
+
+ Ie, if the device goes down, XEmacs detects that and deletes it.
+ Then the if() fails (DEVICE_X_DISPLAY(d) is NULL), and we don't go
+ into the Xlib-of-no-return. If you know different, I'd like to hear
+ about it. ;-)
+
+ These ideas haven't been tested; the code below works for Ben.
+ */
+ CONSOLE_DEVICE_LOOP (devcons, con)
+ {
+ struct device* d;
+ Display* display;
+ d = XDEVICE (XCAR (devcons));
+ if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) {
+ display = DEVICE_X_DISPLAY (d);
+ while (XEventsQueued (display, QueuedAfterReading))
+ XtAppProcessEvent (Xt_app_con, XtIMXEvent);
+ }
+ }
+ }
+ /* This is the old code, before Ben Sigelman's patch. */
+ /*