[haiku-development] Re: WindowAt fix

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 01 Aug 2007 15:27:51 +0200

Varadi Zsolt Gyula <karmaxxl@xxxxxxxxx> wrote:
> I've updated _CountWindows() with your fix as well. And I think the 
> not
> operator is not needed in _WindowAt, so I deleted it.

I'm not sure what you are thinking _WindowAt() and _CountWindows() are 
doing, but they are working fine as is, and your change would just 
break them.
The 'includeMenus' is supposed to have either method consider 
BMenuWindows in the stuff they return or not.
So for example if you have this looper list:
1. some looper
2. BWindow A
3. BWindow B
4. a menu (ie. BMenuWindow)
5. BWindow C

_WindowAt(index = 0, includeMenus = *) would always return 2.). 
_WindowAt(index = 3, includeMenus = true) would return 4.), 
_WindowAt(index = 3, includeMenus = false) needs to return 5.).
 _CountWindows(includeMenus = true) would need to return 4, and 
_CountWindows(includeMenus = false) would return 3.

And that's exactly what happens with the current logic. _CountWindows() 
must only increase "count" when the condition is true (ie. it's a 
window you'd want to be considered), and _WindowAt() must only increase 
"index" when it's *not* a window that you would want to consider.


Other related posts: