Hello,

yes, i've already uncomment it. Now my code looks like this

int main( int argc, char *argv[] )
{
        DFBDisplayLayerConfig         layer_config;
        int err;
        DFBCHECK(DirectFBInit( &argc, &argv ));
        DFBCHECK(DirectFBCreate( &dfb ));
        DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
        layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE );
        layer->GetConfiguration( layer, &layer_config );
        layer->EnableCursor ( layer, 1 );
        DFBSurfaceDescription dsc;
        DFBCHECK(dfb->CreateImageProvider( dfb,"desktop.png",&provider ));
        dsc.flags  = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS;
        dsc.width  = layer_config.width;
        dsc.height = layer_config.height;
        dsc.caps   = DSCAPS_SHARED;
        DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ) );
        provider->RenderTo( provider, primary, NULL );
        layer->SetBackgroundImage( layer, primary );    
        layer->SetBackgroundMode( layer, DLBM_IMAGE );
        DFBSurfaceDescription sdsc;
        DFBWindowDescription  desc;
        sdsc.flags = (DSDESC_WIDTH | DSDESC_HEIGHT );
        sdsc.width  = 300;
        sdsc.height = 200;

        desc.flags = ( DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT 
| DWDESC_CAPS);

        desc.posx   = 200;
        desc.posy   = 200;
        desc.width  = sdsc.width;
        desc.height = sdsc.height;
        desc.caps = DWCAPS_ALPHACHANNEL;

        DFBCHECK(dfb->CreateSurface( dfb, &sdsc, &window_surface ) );
        DFBCHECK(layer->CreateWindow( layer, &desc, &window ) );
        DFBCHECK(window->GetSurface( window, &window_surface) ); // PROBLEM
        DFBCHECK(dfb->CreateImageProvider( dfb,"dfblogo.png",&provider ));
        provider->RenderTo( provider, window_surface, NULL );
        window_surface->Flip( window_surface, NULL, 0 );
        provider->Release( provider );

But the errormessage is the same. There is something, what i'm wondering about. 
In df_window.c they used
window_surface1 and window_surface2, but they were never created. If i comment 
DFBCHECK(dfb->CreateSurface( dfb, &sdsc, &window_surface ) ); i get the message 
 
DirectFBError [window->GetSurface( window, &window_surface)]: Interface was 
released!

Greetings from Dresden : )


> -----Ursprüngliche Nachricht-----
> Von: "Nikita Egorov" <nik...@gmail.com>
> Gesendet: 02.04.09 13:31:38
> An: Tu Duong Manh <tu...@web.de>
> CC: directfb-users@directfb.org
> Betreff: Re: [directfb-users] simple problem with layer,window,surface.  
> especially window->GetSurface


> Did you uncomment the line SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE) ?
> 
> This is a part of df_window.c. I used it many times.
> Replace (or correct) your text by it after the line
> layer->SetBackgroundMode( layer, DLBM_IMAGE );
> 
> DFBWindowDescription desc;
> 
> desc.flags  = ( DWDESC_POSX | DWDESC_POSY |
>                   DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS );
> desc.posx   = 200;
> desc.posy   = 200;
> desc.width  = 512;
> desc.height = 145;
> desc.caps   = DWCAPS_ALPHACHANNEL;
> 
> DFBCHECK(layer->CreateWindow( layer, &desc, &window ) );
> window->GetSurface( window, &window_surface );
> DFBCHECK(dfb->CreateImageProvider( dfb, "/dfblogo.png", &provider ));
> provider->RenderTo( provider, window_surface, NULL );
> window_surface->Flip( window_surface, NULL, 0 );
> provider->Release( provider );
> 
> -- 
> Best Regards
> Nikita Egorov
> nik...@gmail.com
> nik...@varma-el.com
> 


__________________________________________________________________________
Verschicken Sie SMS direkt vom Postfach aus - in alle deutschen und viele 
ausländische Netze zum gleichen Preis! 
https://produkte.web.de/webde_sms/sms



_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to