Re: Question about events
James Harr <[email protected]>
| Newsgroups | gmane.comp.graphics.y.devel |
|---|---|
| Message-ID | <[email protected]> |
> 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. Actually it doesn't have to test everything. The only thing it will really have to test is the widget it is currently in, and any of its children widgets. It's hard to put this into an example, but lets say there is a put-stuff-anywhere widget where you could just throw children widgets in at arbitrary locations. Your mouse is inside the put-stuff-anywhere widget. It only has to test for if you exit its borders or if the mouse crosses into a child widget (and non-recursive so it doesn't have to keep track of children of children). Even on a complex widget this is a relatively simple operation. You're comparing integers which is fast. Then take into account that most of the time you will be on a leaf widget (no children). The most calculations will happen in the root widget. Now who ever does these event notifications probably has a better idea. Your mouse doesn't have that fast of a refresh rate either in comparison to the CPU. A quick google search shows that usb mice sample at 135Hz by default (http://www.tweak3d.net/articles/q3strategy/2.shtml). These calculations are rather insignificant in comparison to everything else your cpu does. -- James Harr <[email protected]> http://www.grickle.org/