[haiku-development] Re: z-order in input dispatching and drawing

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 03 Sep 2011 17:57:30 +0200

Am 03.09.2011 17:28, schrieb pulkomandy@xxxxxxxxxxxxxxxxx:

On 2011-09-03 at 16:59:32 [+0200], Stephan Assmus<superstippi@xxxxxx>  wrote:
Hi,

Am 03.09.2011 15:28, schrieb pulkomandy@xxxxxxxxxxxxxxxxx:
In Haiku, sibling views are drawn one after the other, bottom-to-top. The
input dispatching is done in the same order, bottom-to-top.

It is an "invalid" layout to have overlapping sibling views. I think it
is documented in the BeBook that this results in undefined behavior. So
the implementation should (IMHO) be free to ignore this case and just
work as efficiently as is possible then.

 From AddChild documentation :

"AddChild() makes aView a child of the BView, provided that aView doesn't
already have a parent. The new child is added to the BView's list of
children immediately before the named sibling BView. If the sibling is NULL
(as it is by default), aView isn't added in front of any other view—in other
words, it's added to the end of the list. If the BView is attached to a
window, aView and all its descendants become attached to the same window.
Each of them is notified of this change through AttachedToWindow() and
AllAttached() function calls."

So, we have a parameter in AddChild for setting the position in the list,
and there is a nothion of "front" here. It's rather interesting to have this
(and it clearly shows the feature was planned), but no way to make use of it
?

The interface kit introduction, however, says the drawing and event
distribution order are undeterminate. But to me, that sounds like a bug more
than anything else. I think it's worth storing fLastChild in BView to get
support for it. The sibling list is already doubly linked, so we're almost
there...

Your interpretation of "before" isn't necessarily correct. It actually refers to the sibling *list* but not any kind of z-order. In which direction the order in the list is used for drawing or event dispatching is completely arbitrary. For example, I may think of BViews like sheets of paper which I can stack on a table (the parent view). The last stacked paper is then "naturally" the "front" paper. I may also think the "front" view is the first added child (as in front of the list), which gives me the opposite interpretation, but it's just in my head. The documentation just says it's undefined. It is actually important to avoid these layouts. It was much more the case on BeOS, on Haiku the drawing order is even deterministic.

Best regards,
-Stephan

Other related posts: