Path: utzoo!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!nerus.pfc.mit.edu!mrl From: mrl@nerus.pfc.mit.edu Newsgroups: comp.windows.x Subject: Busy question. Message-ID: <18MAR91.21091289@nerus.pfc.mit.edu> Date: 18 Mar 91 21:09:12 GMT Article-I.D.: nerus.18MAR91.21091289 Sender: news@athena.mit.edu (News system) Organization: MIT PLASMA FUSION CENTER Lines: 56 I'm presently using the "Busy" code which I obtained from a friend, which I believe appeared on comp.windows.x. It works fine. However, I would like to be able to use it for a window that gets updated by an AST. The busy code I am using is the code that follows this message. The AST calls Busy, updates the mainwidget, and then calls UnBusy before exiting. I've tried to use it, and it works relatively fine as long as I am using only the mainwidget. However it has problems when the AST arrives, and I am managing or using a popup attached dialog box that was created from the mainwidget. After the AST finishes, sometimes the box will no longer accept input. If it was in the process of being created, it will not finish doing so, and sometimes the program crashes with a X server error. Can anyone help? Thanks. (This message was also sent directly to the writers who were cited as being the authors of the code). Mark ------------------------------------------------------------------------------- static Window CreateBusyWindow(Widget toplevel) { unsigned long valuemask; XSetWindowAttributes attributes; /* Ignore device events while the busy cursor is displayed. */ valuemask = CWDontPropagate | CWCursor; attributes.do_not_propagate_mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); attributes.cursor = XCreateFontCursor(XtDisplay(toplevel), XC_watch); /* The window will be as big as the display screen, and clipped by its own parent window, so we never have to worry about resizing */ return XCreateWindow(XtDisplay(toplevel), XtWindow(toplevel), 0, 0, WidthOfScreen(XtScreen(toplevel)), HeightOfScreen(XtScreen(toplevel)), (unsigned int) 0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); } void Busy() { if (BusyWindow) { XMapRaised(XtDisplay(MainWidget),BusyWindow); while (XPending(XtDisplay(MainWidget))) { XEvent event; XtNextEvent(&event); XtDispatchEvent(&event); } XFlush(XtDisplay(MainWidget)); if (LIB$AST_IN_PROG()) XSync(XtDisplay(MainWidget)); } } void UnBusy() { if (BusyWindow) XUnmapWindow(XtDisplay(MainWidget),BusyWindow); if (LIB$AST_IN_PROG()) XSync(XtDisplay(MainWidget)); }