🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #583

Session::read_nonevent ()

#583
From: Donn Cave
Date: Thu, 03 Sep 1992 17:27
43 lines
1845 bytes
I find that InterViews 3.0.1 applications that use additional input units
via the Dispatcher, need to process an actual X event before Session::read()
will return.  For applications that use a simple loop of the form
    for (;;) {
	Session::read(Event&);
	Event::handle();
	... // do stuff, but you'll have to twitch the mouse before
	    // I can get here after a callback from an alternate unit.
    }

it would be helpful if Session had an alternative to read(Event&) that 
returned without waiting for a true event.  Based on the 3.0.1 Session,
I think the appended code might do it.  The above loop could be modified
to read

    for (;;) {
	if (Session::read_nonevent(Event&)) {
		Event::handle();
	}
	else {
		... // do stuff
	}
    }


	Donn Cave, University Computing Services, University of Washington
	donn@cac.washington.edu
-------------------------------

int Session::read_nonevent(Event& e) {
    boolean save = rep_->readinput_;
    rep_->readinput_ = false;
    if (rep_->done_) return false;		// ?
    if (rep_->check(e)) return true;		//
    else {					//
	Dispatcher::instance().dispatch();	//
	return false;				//
    }						//
//read()	    while (!rep_->done_ && !rep_->check(e)) {
//read()		Dispatcher::instance().dispatch();
//read()	    }
    rep_->readinput_ = save;
}
Technical Details
Message-ID: <1992Sep3.172723.29504@u.washington.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!news.u.washington.edu!carson.u.washington.edu!donn

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!news.u.washington.edu!carson.u.washington.edu!donn
From: donn@carson.u.washington.edu (Donn Cave)
Newsgroups: comp.windows.interviews
Subject: Session::read_nonevent ()
Summary: Request for enhancement of Session, read() that returns on non-event
Message-ID: <1992Sep3.172723.29504@u.washington.edu>
Date: 3 Sep 92 17:27:23 GMT
Article-I.D.: u.1992Sep3.172723.29504
Sender: news@u.washington.edu (USENET News System)
Organization: University of Washington
Lines: 43