ET++: Stepping through a left mouse click in a button

This code gets the next XWindows event, maps it to a Token (an ET++ operating-system event), finds which WindowPort was involved, and calls WindowPort::InputNotify() on that WindowPort with the Token (a Port is an abstract object for drawing, a "paper" which the program can draw on. WindowPort is a subclass of Port which implements drawing in a window. WindowPort is overridden for each supported windowing system).


bool XWinSystem::Notify()
{
	Allow();
	if (XEventsQueued(display, QueuedAfterReading) > 0) {
		XEvent xe; Token t; XWindowPort *p;
		[ ... ]
		XNextEvent(display, &xe);
		
		[ ... handle RPC events ... ]
		[ ... code to handle selection ... ]

		if (p= (XWindowPort*)FindWindowWithId((int)xe.xany.window)) {
			if (p->MapEvent(xe, &t))
				p->InputNotify(&t);
		}
		return TRUE;
	}
	[ ... cleanup, update, flush ... ]
	return FALSE;
}

Back to the method call sequence