This is part-rant, part-question, so please bear with me.

I seem to be having a hard time getting started with DirectFB due to a general lack of documentation and examples. (Yes, I've looked at all the sample code, tutorials, and docs on the web site) I keep getting hit with undocumented gotchas like the mouse cursor being unavailble if you are in fullscreen mode. (Why?) If the sample code, such as df_window.c, were documented with not just what it is doing, but why it's doing it that way as opposed to another way, I don't know how many days that would have saved me.

My product, Cosmoe, is a GUI front-end to Linux that provided a API very similar to the BeOS. I'm trying to move Cosmoe to use DirectFB as opposed to the raw framebuffer it is using now. Here are the specifics:
1. It needs to use the DirectFB cursor.
2. It is not currently using the DFB window stack (yet). It handles window-drawing/stacking/handling internally and just uses DirectFB for drawing.

When I used SetCooperativeMode(FULLSCREEN) or (EXCLUSIVE), everything drew fine but I had no cursor. When I took that line out, I got a cursor, but the drawing was confined to a 640x480 surface in the middle of the screen regardless of what I size I asked for. I believe this is related to creating the main surface with DSCAPS_PRIMARY. If I remove the DSCAPS_PRIMARY flag from the surface description, then the surface is created at the right size but nothing draws at all to the screen. Aaaargh!

Finally, the question: How do I get both a mouse cursor and a full-screen-size surface on which to draw? This shouldn't be that hard! Here is my current, flawed DirectFB init code:

bool DirectFBDriver::Open( void )
{
DFBResult err;
DFBDisplayLayerConfig config;
DFBSurfaceDescription dsc;

if (DirectFBInit(NULL, NULL) != DFB_OK)
return false;

if (DirectFBCreate( &DFBObject ) != DFB_OK)
return false;

// DFSCL_FULLSCREEN makes all the drawing look right,but I get no cursor
// DFBObject->SetCooperativeLevel( DFBObject, DFSCL_FULLSCREEN );

DFBObject->GetDisplayLayer( DFBObject, DLID_PRIMARY, &mLayer );
err = mLayer->GetConfiguration( mLayer, &config );
if (err != DFB_OK)
{
dbprintf( "DFBDriver: Could not get layer config\n");
}

// See if we can create our primary surface

dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT);
dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_FLIPPING);
dsc.width = config.width;
dsc.height = config.height;

err = DFBObject->CreateSurface( DFBObject, &dsc, &mPrimarySurface );
if (err != DFB_OK)
{
dbprintf( "DFBDriver: Failed creating primary surface\n");
mLayer->Release( mLayer );
DFBObject->Release( DFBObject );
return false;
}

unsigned int width, height;
mPrimarySurface->GetSize( mPrimarySurface, &width, &height );

// *** if I keep the DSCAPS_PRIMARY flags in the call to CreateSurface, the
// *** GetSize calls *always* returns 640x480
// *** However, if I remove DSCAPS_PRIMARY, GetSize returns the correct value
// *** but no drawing shows up on screen.

return( true );
}


Any help will be *greatly* appreciated as this is driving me up the wall.

Thanks,
Bill



--
Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe directfb-users" as subject.

Reply via email to