[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

756.0. "XtMainLoop() and XtDispatchEvent()" by SAC::HIRST_SJ (Lean, Mean, Fast) Wed May 10 1989 11:48

    Can anybody tell me what the difference is between using
    
    XtMainLoop();
    
    and
    
    for ( ; ; )
     {
      XtNextEvent( &event );
      XtDispatchEvent( &event );
      }
    
    The former works fine and the latter ACCVIOs when I call a callback
    routine that fetches and maps a popup dialog box widget.
    
    Any suggestions/help on how to use the latter would be appreciated,
    I am trying to get some events not associated with a widget and
    this is the only way I can think of doing it.
    
    Thanks
    
    Stephen

T.RTitleUserPersonal
Name
DateLines
756.1LEOVAX::TREGGIARIWed May 10 1989 15:0122
>    Can anybody tell me what the difference is between using
>    
>    XtMainLoop();
>    
>    and
>    
>    for ( ; ; )
>     {
>      XtNextEvent( &event );
>      XtDispatchEvent( &event );
>      }

There should be no difference.
   
>    I am trying to get some events not associated with a widget and
>    this is the only way I can think of doing it.
  
Is any of the code to do that being executed now?  That is, are you
doing anything else in the loop besides XtNextEvent, XtDispatchEvent?

Leo

756.2Filter Out Events??TOOK::MERSHONRic MershonWed May 10 1989 15:1521
	
>    I am trying to get some events not associated with a widget and
>    this is the only way I can think of doing it.

	Here's my best guess:

	You say you are trying to get some events not associated with
	a widget.  Are these possibly events generated by something
	that you wouldn't want to dispatch on?  I once did some playing
	around with DECterm to get its events to pass through my event
	processing loop.  I made sure that if the event that I got with
	XtNextEvent was from the DECterm, that I filtered it out and didn't
	pass it to XtDispatchEvent.

	This may be the problem, and it may not; it's only my best
	guess.

	Hope this helps,

	-ric.

756.3XEvent?DECWIN::KLEINWed May 10 1989 15:5212
>>    for ( ; ; )
>>     {
>>      XtNextEvent( &event );
>>      XtDispatchEvent( &event );
>>      }

How are you declaring "event"?  To get the right size buffer, use:

	XEvent event;

-steve-

756.4Still stuck42397::HIRST_SJLean, Mean, FastThu May 11 1989 06:0134
    A bit more explanation.
    
    Re .3
    
    I am declaring 'event'
    
    static XAnyEvent event;
    
    The additional events come from the window manager window. I locate
    the window manager window and do a XSelectInput with the
    SubstructureNotifyMask. The reason being the application is basically
    captive with a tiled window at the left of the screen with
    OverrideRedirect set so it is always at the front. If any other
    window is configured in the same area I move it so it is visible
    (This may not be friendly but it is only a prototype).
    
    Using:
    
    XtMainLoop();
    
    even with the additional input selected works fine.
    
    Using:
    
    XtNextEvent();
    XtDispatchEvent();
    
    with or without the additional events selected fails. The ACCVIO
    actually occurs in DwtFetchWidget in a callback routine.
    
    Thanks for all the ideas so far.
    
    Stephen

756.5You have a problem52494::LACROIXGone with the windThu May 11 1989 09:1613
    Re .4:

>    static XAnyEvent event;

    I don't know whether this is your problem, but this is wrong. Re-read
    the relevant section in the Xlib manual: XAnyEvent is a convenience
    structure to access members common to any event. Since many events are
    larger than XAnyEvent, Xlib is probably overwriting some data critical
    to your program... Use: static XEvent event instead. Why static, by the
    way?

    Denis.

756.642397::HIRST_SJLean, Mean, FastThu May 11 1989 13:078
    Re .5
    
    That seems to have been the problem.
    
    Thanks
    
    Stephen