Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!harrier.ukc.ac.uk!rlh2 From: rlh2@ukc.ac.uk (Richard Hesketh) Newsgroups: comp.windows.x Subject: Re: Incremental Display of Widget Tree Message-ID: <5251@harrier.ukc.ac.uk> Date: 8 Aug 90 17:07:42 GMT References: <1990Aug8.025339.3419@pcrat.uucp> Reply-To: rlh2@ukc.ac.uk (Richard Hesketh) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 47 Summary: Expires: Sender: Followup-To: In article <1990Aug8.025339.3419@pcrat.uucp> rick@pcrat.uucp (Rick Richardson) writes: >I want to create a Box (or RowColumn in Motif) widget that contains > - Now, process events until widgets are displayed > **** How do I do this **** I thought of a routine that would wait for a particular event. Here's the routine. It works for me (I've tried waiting for various events). I'd like to know if I've missed anything. Specifically will this routine break the Intrinsics when a translation table has been set on this widget .. and what about grabs? Boolean XukcWaitForWidgetEvent(widget, eventmask, type) Widget widget; long eventmask; int type; { XEvent ev; long oldmask; XWindowAttributes atts; if (!XGetWindowAttributes(XtDisplay(widget), XtWindow(widget), &atts)) return (FALSE); /* Help! .. failed X request */ oldmask = atts.your_event_mask; XSelectInput(XtDisplay(widget), XtWindow(widget), oldmask | eventmask); while (1) { if (XtAppPeekEvent(XtWidgetToApplicationContext(widget), &ev) && (ev.type == type) && (ev.xany.window == XtWindow(widget))) break; XtAppNextEvent(XtWidgetToApplicationContext(widget), &ev); XtDispatchEvent(&ev); } if (!(oldmask & eventmask)) /* eat up this event if the widget didn't select for it */ XtAppNextEvent(XtWidgetToApplicationContext(widget), &ev); XSelectInput(XtDisplay(widget), XtWindow(widget), oldmask); return (TRUE); } Richard Hesketh : @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk : rlh2@ukc.ac.uk ..!mcsun!ukc!rlh2 --- Computing Lab., University of Kent at Canterbury, Canterbury, Kent, CT2 7NF, United Kingdom. Tel: +44 227 764000 ext 7620/3682