Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!adobe!asente From: asente@adobe.com (Paul Asente) Newsgroups: comp.windows.x Subject: Re: How do I block X events? Message-ID: <8379@adobe.UUCP> Date: 19 Nov 90 21:26:48 GMT References: <1990Nov15.190220.20413@csug.rdg.ac.uk> Sender: news@adobe.COM Organization: Adobe Systems Inc. Lines: 34 In article <1990Nov15.190220.20413@csug.rdg.ac.uk> ac1@csug.cs.rdg.ac.uk (Andrew Cunningham) writes: >I am writing an X application using the Motif toolkit (on HP-UX 7.0, if it >makes a difference). The program has to perform a computationally intensive >task from time to time, and I'd like to be able to block the user interface >while this is going on. Ideally I want to > > a) Display an hourglass cursor over the whole application Use Xlib for this. > b) Ignore any mouse/keyboard events until the operation is > complete. Call XtSetSensitive(your_root_shell_widget, FALSE); when you want to start ignoring events. Call XtSetSensitive(your_root_shell_widget, TRUE); to start processing them again. This will ignore mouse and keyboard events while still passing through expose events and the like. Be sure to do while (XtAppPending(app_context)) { XtAppProcessEvent(app_context, XtIMAll); } periodically during your task to process expose events. Also do it before resensitizing your user interface to make sure any queued-up mouse or keyboard events are thrown away. -paul asente asente@adobe.com ...decwrl!adobe!asente