Hello,
i just try to unterstand how to create an window. I started with comparing
different examples, which included windows.
After that i started to write this code. When i try to start the application,
it always shows me an "Caught signal 11"-error, so i
tried to debug. Then i found out, that the
printf("================================================="); still works,
but at DFBCHECK(window->GetSurface( window, &window_surface) ); // PROBLEM it
shows me the "Caught signal 11"-error.
I hope you can help ne.
Greetings from Dresden : )
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <directfb.h>
static IDirectFB *dfb;
static IDirectFBDisplayLayer *layer;
static IDirectFBImageProvider *provider;
static IDirectFBSurface *primary;
static IDirectFBWindow *window;
static IDirectFBSurface *window_surface;
/* macro for a safe call to DirectFB functions */
#define DFBCHECK(x...) \
{ \
err = x; \
if (err != DFB_OK) { \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
int main( int argc, char *argv[] )
{
// IDirectFBEventBuffer *buffer;
DFBDisplayLayerConfig layer_config;
// DFBWindowID id1;
int err;
// int quit = 0;
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.caps = DWCAPS_ALPHACHANNEL;
desc.flags = ( DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT
| DWDESC_CAPS);
desc.posx = 20;
desc.posy = 120;
desc.width = sdsc.width;
desc.height = sdsc.height;
DFBCHECK(dfb->CreateSurface( dfb, &sdsc, &window_surface ) );
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
DFBCHECK(dfb->CreateImageProvider( dfb,"dfblogo.png",&provider ));
printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
provider->RenderTo( provider, window_surface, NULL );
DFBCHECK(layer->CreateWindow( layer, &desc, &window ) );
printf("=================================================");
DFBCHECK(window->GetSurface( window, &window_surface) ); // PROBLEM
printf(".......................................................................");
window_surface->Flip( window_surface, NULL, 0 );
provider->Release( provider );
sleep (100);
// buffer->Release( buffer );
window_surface->Release( window_surface );
window->Release( window );
layer->Release( layer );
primary->Release( primary );
dfb->Release( dfb );
return 42;
}
THE TERMINAL-OUTPUT
(*) Direct/Interface: Loaded 'PNG' implementation of 'IDirectFBImageProvider'.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$=================================================(!)
[31424: 0.000] --> Caught signal 11 (sent by the kernel) <--
(!!!) *** WARNING [still objects in 'Window Pool'] *** [object.c:241 in
fusion_object_pool_destroy()]
(!!!) *** WARNING [still objects in 'Layer Region Pool'] *** [object.c:241 in
fusion_object_pool_destroy()]
(!!!) *** WARNING [still objects in 'Layer Context Pool'] *** [object.c:241
in fusion_object_pool_destroy()]
(!!!) *** WARNING [still objects in 'Surface Pool'] *** [object.c:241 in
fusion_object_pool_destroy()]
Aborted
____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users