[haiku-appserver] (new clipping code) breakthrough and then problems :-)

  • From: Adi Oanca <adioanca@xxxxxxxxxxxxxx>
  • To: AppServer <haiku-appserver@xxxxxxxxxxxxx>
  • Date: Wed, 19 Oct 2005 10:56:08 +0300

Hi guys,

Yesterday around 19 PM I was a very happy man. :-) :-P I finally nailed a bug in the new clipping code(and not only), a bug that I was hunting for some time. All the time I thought the problem is in the server, I turned the server upside-down and search and tested again and again, when in fact there was a tricky problem in the client code, more exact BView::Bounds(). After solving this bug, I again tested the new clipping code and a ton of my problems disappeared. I played with Stephan's Playground application and _all_ works fine except with a little problem involving scrolling.

   Now, about the bug I solved and further directions in this area.
   The bug was in
        // do we need to update our bounds?
        if (!fState->IsValid(B_VIEW_FRAME_BIT) && fOwner) {


                int32 code;
                if (fOwner->fLink->FlushWithReply(code) == B_OK
                        && code == SERVER_TRUE) {
                        fState->valid_flags |= B_VIEW_FRAME_BIT;

        return fBounds;

   As you see, we contact the server only if B_VIEW_FRAME_BIT is not set. 
Looking through BView
code you will see this bit is cleared in some cases like resizing and moving. 
When I wrote
the code for BView I didn't know all the details of the implementation and I 
thought if I clear
the bit on local resize/move calls and when B_VIEW_RESIZED/MOVED messages 
arrive for this view,
all will be OK. At that time I simply did not realized these 2 message only 
come if specifically
asked for. So, you now realize that some views did not had their bounds and 
frame rectangle
updated and problems appeared.
   The solution was to query the server for coordinates each time when Bounds() 
is called.

   Back then, when I was writing the client code, I had very long talks with 
Marc Flerackers,
and I remember him saying something like: "anyway you will use BView::fBounds 
until your view
is connected to app_server". Now I understand what meant. We must do that 
because we want to stay
in sync with the server and ATM there is no other way to sync the two parts.

   Is this solution good? Shouldn't we cache the frame and localOrigin for each 
BView? I ask this
because I think Bounds() and Frame() methods are used quite frequently.
   Should we do the same thing Stephan did with views that have B_FRAME_EVENTS 
flag? Send one
message at the end of a resize operation with all the views that had their 
frame modified?

Opinions, Ideas?

bye, Adi.

Other related posts:

  • » [haiku-appserver] (new clipping code) breakthrough and then problems :-)