[haiku-appserver] Re: invalidation again

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Fri, 15 Apr 2005 13:31:38 +0200 CEST

Hi  Adi,

thanks for your quick answer.

> > I was trying to make BView::Invalidate() work. I'm giving up, 
> > because I 
> > don't understand the code.
>       If you spend some time on it, you will. Same happen to me when I 
> came
> to work on app_server. :-) But I can understand you as the code is 
> more
> complex now.

I agree that it can be expected from someone to spend a reasonable 
ammount of time to understand the code when comming into the team. 
However, even the most complex thing can be broken down into smaller 
parts, and that is the key to refactoring and making the code path 

> > I have an idea what the problem is, but I 
> > have no idea where to fix it. The triggering of update requests 
> > works 
> > for moving windows arround. So I thought it must be simple to make 
> > BView::Invalidate() work.
>       It is simple. If it doesn't work, that's another problem...
> GetRootLayer()->GoRedraw(cl, reg) should've worked in this case.

I think the problem is that SendUpdateMsg() is not called for the 
client if a layer is not the top layer.

> > However, there is no one central mechanism, 
> > while it should be the same thing.
>       There is a central mechanism:
> RootLayer::GoInvalidate()
> RootLayer::GoRedraw()
>       from a tread != RootLayer's one
> RootLayer::invalidate_layer()
> RootLayer::redraw_layer()
>       from inside RootLayer's thread.

That part was clear to me (and I understand why it works that way), but 
there is also Layer::Redraw(), Layer::RequestRedraw() and probably even 
more... :-}

> > A little commenting about the *structure* of the 
> > code and the interacting parts would help too.
>       When I'll have time I'll make a diagram about how region rebuilding
> and region invalidation works.
>       You'll see that's it's pretty simple to grab by someone with your
> experience.
> [ The main idea is that all region rebuilding and canvas cleaning is 
> done from
> one thread only: RootLayer's one. If you want to understand how that 
> works
> start with RootLayer::invalidate_layer() and go down until you hit 
> Painter
> :-) ]

Yeah, I tried to follow that. The main problem was all these clipping 
regions with completely obscure names. They give no hint what they are 
used for. At first I thought the problem might be that the clipping 
forbids any drawing, but I think the problem might be that 
SendUpdateMsg() is not called on any other layer than the top layer.

> > Adi, if you find some time, it would be really nice if you could 
> > make 
> > BView::Invalidate() work. I would do it, but I'm just clueless.
>       OK, I will see what's wrong during this weekend.

Thank you, if this thing works, I think we can have a first couple of 
apps running under Haiku, and when you push a button, you will see it 
redraw... The drawing code itself should be no problem for the 
app_server anymore in terms of it's correctness. (There might be places 
where the implementation is incorrect, but it means no hold up at the 
moment.) So the focus can be on cient <-> app_server communication and 
the interface kit actually working (to a reasonable degree). Once we 
start running real apps, we will find all sorts of problems and it will 
help us to get our implementation correct.

> > Since this is an open source project, we all benefit from people 
> > digging in and trying to help. So code should be written with that 
> > in 
> > mind.
>       We don't even have an alpha going, this is still early stage
> development, specifications are not complete and thus code is not 
> that
> clear until a certain point in time when a cleaning is required.
> Clipping code still has some things left to be done, like BView 
> origin
> support(not that big of a deal), dragging transparent surfaces, etc.
>       I have started a big cleanup in window management code (RooLayer,
> WinBorder, Workspace, ServerWindow partially) and I'm almost 
> finished,
> but I have not yet reached the clipping and update code.

If you hit outdated or duplicated code, which is not used anymore, 
please just delete it or comment it away, so that it stops confusing 
people locking at the code. If you put *one* invalidation mechanism in 
place (one function for triggering a message, another one doing the 
real work is just fine, I'd still call this *one* mechanism), and you 
comment out all other suspiciously similar looking functions, you will 
either see no difference, or find a couple of places where some old 
mechanism is used, and you can change those to use the only current 
one. Who knows what else you will fix by doing this... ;-)

Best regards,

Other related posts: