Question about events

"clearm" <[email protected]>
Newsgroups gmane.comp.graphics.y.devel
Message-ID <[email protected]>
I have a question about implementing an event system - perhaps someone can
answer this...

BACKGROUND:  Window systems such as X and Y have event systems that notify
client apps when certain events occur.  Some of these notifications are easy
to program, such as key presses and mouse clicks - when the keyboard driver
or mouse driver tells the server that a key is pressed or the mouse is
moved, then the window system simply sends a "keypressNotify" or
"mousemoveNotify" event to the application.  But other notifications seem
very difficult to implement, for example "enterNotify" and "leaveNotify"
events.

QUESTION:  How does a window system know when the mouse enters/leaves the
bounding box of a particular window/widget, especially since these
windows/widgets are nested within one another?  Does the window system have
to test the mouse cursor location against the bounds of each window/widget
*every* time the pointer moves?!?!  That seems like an awful lot of work if
there are a lot of windows/widgets on screen.  It also means a lot of if
statements, which means it's terribly inefficient on a pipelined processor.

How do window systems implement enterNotify and leaveNotify event
notifications?

-- MC
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.