[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBackingStoreNonretained

From: Frederic De Jaeger
Subject: Re: NSBackingStoreNonretained
Date: 03 Sep 2002 22:23:35 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

AF> Frederic De Jaeger wrote:
>> - when an expose event arrives, all the content of the window is
>> refreshed instead of the necessary parts.

AF> All the expose rectangles are stored in window->exposedRects, so it
AF> should be simple to NSUnionRect these. The problem here is figuring
AF> out which views need to be redisplayed based on the rect. This can be
AF> done in the front end, but it seems odd to call a front end method
AF> from the backend (even though that's the way it is done now). Perhaps
AF> this could be cleaned up some - or we could define a new AppKit
AF> specific event to handle the expose in the front end.

I have a short solution is the present patch (see attachement).  It calls a
frontend method from the backend, so maybe you won't like it either.  
The idea is simple, for each invalidated rectangle sent by Xserver, I
invalidate the corresponding rectangle of the contentview of the
corresponding window with this :
>         [v setNeedsDisplayInRect: rect];

And that'all.  It works quite well and boosts the performance a lot.
(on windows with backingtype = NSBackingStoreNonretained)

I needed a method to convert rectangles sent by X to rectangles in the
NSWindow frame system (_XWinFrameToOSWinFrame:)  maybe this method
already exists in the backend but I haven't found it. 

So it solves the first point (maybe badly).

NOW, the second point :

>> - when the window is refreshed, it begins by repainting its content
>> with the background color (which is already done by the Xserver (but
>> it does it with the wrong color))

AF> X windows allows you to set the default background, although currently
AF> it's setup to do XSetWindowBackgroundPixmap
AF> (XGServerWindow:_createBuffer), which perhaps is wrong.

This is perfect for a retained window.  So the server repaints the
exposed area itself.  But this is not the point here because we don't
have any background pixmap in this case.  We should use 

AF> Then we have the fact that the frontend doesn't know this. Maybe we
AF> should document that all backends need to paint exposed areas in the
AF> windows background color and take this out of the frontend.

I have looked a little bit into the backend but I'm not sure I fully
understand all the architecture.  IMHO, in 
[NSWindow _initBackendWindow] (file NSWindow.m) ,
there should be something like :
[srv setBackgroundColor: [self backgroundColor] : _windowNum];

Then, we can remove the [GSWindowView drawRect: ] (again in
NSWindow.m) that becomes useless, now.
I is very simple to implement (maybe 10 lines of code...)

But maybe the design looks ugly for some people, that's the reason why
I haven't written those lines yet. I prefer to ask backend gurus
before doing something.  (maybe people would prefer a pseudo DPS


Attachment: txtR6xfUvpY2J.txt
Description: patch of XGServerWindow.m

reply via email to

[Prev in Thread] Current Thread [Next in Thread]