| Home
| Previous
| Next
| Up

MGL_wmProcessEvent

Processes event and distributes it to windows.

Declaration

ibool MGLAPI MGL_wmProcessEvent(
winmng_t *wm,
event_t *event)

Prototype In

mgraph.h

Parameters

wm | window manager
event | event to distribute

Return Value

Returns true if the event was processed or false otherwise.

Description

MGL_wmProcessEvent distributes events to windows and passes them to event handlers that the user attached to windows. This happens in several steps:

First, global event handlers (see MGL_wmPushGlobalEventHandler) are searched for one that can handle this event (by ANDing event->what with the mask) and if such handler exists, the event is passed to it. If global handler returns true, processing ends and MGL_wmProcessEvent returns true. If the handler returns false, search continues among other global handlers.

Next, redirection table is searched for windows that have captured events of this type. If such window is found, it will be used in the next step. Otherwise, MGL_wmProcessEvent uses the window under mouse pointer.

Finally, event table of the window determined in the previous step is searched for a handler that accepts this type of events and the event is passed to it. If the handler returns true, the function returns with true, otherwise it continues with the rest of handlers.

If none of the above steps succeeded, false is returned.

Note: This function also handles changes of mouse cursor as the pointer moves from one window to another.

Note: Mouse position information in event_t is NOT translated to window's local coordinates!

Note: A typical application will run in event loop and repeatedly call EVT_halt, MGL_wmProcessEvent and MGL_wmUpdateDC.

See Also

MGL_wmPushWindowEventHandler, MGL_wmPopWindowEventHandler, MGL_wmRemoveWindowEventHandler, MGL_wmPushGlobalEventHandler, MGL_wmPopGlobalEventHandler, MGL_wmRemoveGlobalEventHander, MGL_wmCaptureEvents, MGL_wmUncaptureEvents

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com