[interfacekit] server part of BDirectWindow

I'm going to spend a bit of time working on the server part of BDirectWindow. 
It needs very little code, though I'll have to change some files on the 
app_server's side.

I won't do that till tuesday, at least, but I thought it would be good to write 
here what I was going to do.

Basically, for now, I'll just add this function to ServerWindow.cpp

const uint64 kDirectWindowTimeout = 3000000; 

/*! \brief Does the work needed to call BDirectWindow::DirectConnected()
        Called when the Window clipping region changes. 
*/      
status_t
ServerWindow::HandleDirectWindow(direct_buffer_state state)
{
        // TODO: Implement correctly
        fDirectBufferInfo->buffer_state = state;
        fDirectBufferInfo->bits = NULL; // Should be a pointer to the frame 
buffer
        fDirectBufferInfo->pci_bits = NULL; // Should be a pointer to the pci 
space
        fDirectBufferInfo->bytes_per_row = 0;
        fDirectBufferInfo->bits_per_pixel = 0;
        fDirectBufferInfo->pixel_format = B_NO_COLOR_SPACE;
        fDirectBufferInfo->layout = B_BUFFER_NONINTERLEAVED;
        fDirectBufferInfo->orientation = B_BUFFER_TOP_TO_BOTTOM;
        
        // Should be the number of rects in the clipping region
        fDirectBufferInfo->clip_list_count = 0;
        fDirectBufferInfo->window_bounds = to_clipping_rect(fFrame);
        fDirectBufferInfo->clip_bounds = (clipping_rect){ 0, 0, -1, -1 }; 
//TODO: fix this
        
        for (uint32 i = 0; i < fDirectBufferInfo->clip_list_count; i++) {
                // TODO: Should get the real clipping region
                fDirectBufferInfo->clip_list[i] = (clipping_rect){ 0, 0, -1, -1 
};
        }
        
        // Releasing this let the BDirectWindow::DirectConnected() 
        // method do its work
        release_sem(fDisableSem);
        
        // TODO: We block here for 'kDirectWindowTimeout' microseconds.
        // If the app still does not release this sem, we should kill it.
        status_t status;
        do {
                status = acquire_sem_etc(fDisableAckSem, 1, B_RELATIVE_TIMEOUT, 
kDirectWindowTimeout);  
        } while (status == B_INTERRUPTED);      
        
        return status;
}



And the following three members to ServerWindow.h:

private:

                        direct_buffer_info      *fDirectBufferInfo;
                        sem_id                          fDisableSem;
                        sem_id                          fDisableAckSem;

As you can see, nothing extraordinary, but then I'll need some way to get the 
info to fill the direct_buffer_struct, at least a pointer to the frame buffer 
(which will be a pointer to a BBitmap Bits() in case we're drawing on a "fake" 
surface, as we are now), for now.

As BDirectWindow needs very little help from the app_server , I think we can 
implement it in short time, and I hope we can show something very soon :)

BTW, that change I'm going to do won't break or interfere with anything in the 
current
Opinions ?
Adi, still around ? I know you're slaving away at writing BView, but I won't 
bother you much :)


P.S: What's the point of committing this non working WIP ? Well, I'm sure that 
if it's there, I'll force myself to finish it :)




Other related posts: