Index: event-Xt.c =================================================================== RCS file: /pack/xemacscvs/XEmacs/xemacs/src/event-Xt.c,v retrieving revision 1.71 diff -u -r1.71 event-Xt.c --- src/event-Xt.c 2002/11/18 06:52:38 1.71 +++ src/event-Xt.c 2002/12/03 07:08:52 @@ -3124,7 +3124,7 @@ } static void -emacs_Xt_quit_p (void) +drain_X_queue (void) { Lisp_Object devcons, concons; CONSOLE_LOOP (concons) @@ -3136,43 +3136,54 @@ CONSOLE_DEVICE_LOOP (devcons, con) { struct device *d; + Display *display; d = XDEVICE (XCAR (devcons)); - if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) - /* emacs may be exiting */ - x_check_for_quit_char (DEVICE_X_DISPLAY (d)); - else if (DEVICE_TTY_P (d)) - check_for_tty_quit_char (d); + { + display = DEVICE_X_DISPLAY (d); + while (XEventsQueued (display, QueuedAfterReading)) + XtAppProcessEvent (Xt_app_con, XtIMXEvent); + } } } + /* + while (XtAppPending (Xt_app_con) & XtIMXEvent) + XtAppProcessEvent (Xt_app_con, XtIMXEvent); + */ } static void -drain_X_queue (void) +emacs_Xt_quit_p (void) { Lisp_Object devcons, concons; - CONSOLE_LOOP (concons) - { - struct console *con = XCONSOLE (XCAR (concons)); - if (!con->input_enabled) - continue; - CONSOLE_DEVICE_LOOP (devcons, con) +#if 0 + drain_X_queue (); + EVENT_CHAIN_LOOP (event, dispatch_event_queue) { - 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); - } } - } - /* - while (XtAppPending (Xt_app_con) & XtIMXEvent) - XtAppProcessEvent (Xt_app_con, XtIMXEvent); - */ +#endif + + CONSOLE_LOOP (concons) + { + struct console *con = XCONSOLE (XCAR (concons)); + if (!con->input_enabled) + continue; + + CONSOLE_DEVICE_LOOP (devcons, con) + { + struct device *d; + d = XDEVICE (XCAR (devcons)); + +#if 1 /* remove soon */ + if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) + /* emacs may be exiting */ + x_check_for_quit_char (DEVICE_X_DISPLAY (d)); +#endif + if (DEVICE_TTY_P (d)) + check_for_tty_quit_char (d); + } + } } static int @@ -3294,6 +3305,30 @@ if (!user_p || command_event_p (event)) return 1; } + + return 0; +} + +int +check_if_pending_expose_event (struct frame *f) +{ + Display *d = DEVICE_X_DISPLAY (XDEVICE (f->device)); + Lisp_Object event; + + drain_X_queue (); + + EVENT_CHAIN_LOOP (event, dispatch_event_queue) + if (XEVENT_TYPE (event) == magic_event) + { +#ifdef USE_KKCC + XEvent *xev = &XMAGIC_DATA_X_EVENT (XEVENT_DATA (event)); +#else /* not USE_KKCC */ + XEvent *xev = &XEVENT (event)->event.magic.underlying_x_event; +#endif + if (ev->type == Expose && + ev->xexpose.display == d) + return 1; + } return 0; } Index: redisplay-x.c =================================================================== RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay-x.c,v retrieving revision 1.34 diff -u -r1.34 redisplay-x.c --- src/redisplay-x.c 2002/06/20 21:18:42 1.34 +++ src/redisplay-x.c 2002/12/03 07:08:55 @@ -1772,6 +1772,8 @@ x_redraw_exposed_window (XWINDOW (window), x, y, width, height); } +int check_if_pending_expose_event (struct frame *f); + /***************************************************************************** x_redraw_exposed_area @@ -1799,7 +1801,8 @@ { x_redraw_exposed_windows (f->root_window, x, y, width, height); - XFlush (DEVICE_X_DISPLAY (XDEVICE (f->device))); + if (!(check_if_pending_expose_event (f))) + XFlush (DEVICE_X_DISPLAY (XDEVICE (f->device))); } else MARK_FRAME_CHANGED (f);