Hi
I don't know about your error, since it seems to occur on a simple
CreateSurface operation, but anyway, this is how you shoud do to change the
cursor image (here with a cursor image from a file).
I think that you need in particular to request at least administrative
privileges on the layer before modifying the cursor (and go back to shared once
you're done).
<snip>
IDirectFB *dfb = NULL;
// Create main directfb administrative interface
DFBCHECK(DirectFBCreate(&dfb));
if (!dfb)
return -1;
// Get a handle on the primary layer
IDirectFBDisplayLayer* layer = NULL;
DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
IDirectFBSurface* cursor;
DFBSurfaceDescription idsc;
IDirectFBImageProvider* iprov = NULL;
/* Acquire cursor image */
if ((dfb->CreateImageProvider(dfb, "/path/to/my/cursor/cursor.png",
&iprov)) == DFB_OK){
/* Create the cursor surface */
DFBCHECK(iprov->GetSurfaceDescription(iprov, &idsc));
idsc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT
|DSDESC_CAPS);
idsc.caps = DFBSurfaceCapabilities(DSCAPS_SYSTEMONLY);
if(dfb->CreateSurface(dfb, &idsc, &cursor) == DFB_OK){
/* Render the cursor onto the image surface */
DFBCHECK(iprov->RenderTo(iprov, cursor, NULL));
}
iprov->Release(iprov);
/* Set cursor shape */
DFBCHECK(layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE));
DFBCHECK(layer->SetCursorShape(layer,cursor, 0,0)); /* 0,0 -> cursor
hotpoint is at 0,0 */
DFBCHECK(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
}
</snip>
Regards
David
PS: please also verify that the no-cursor directive is not specified in your
directfbrc file.
-----Message d'origine-----
De : [email protected]
[mailto:[email protected]] De la part de Dhoti Walla
Envoyé : dimanche 13 mars 2011 16:14
À : Maik Greubel
Cc : [email protected]
Objet : Re: [directfb-dev] question on mouse cursor
Maik,
thanks for your response. I should have mentioned that I'm running this on a
Set Top Box and basic GUI and event handling work fine. Only the mouse does not
work. I'm using DirectFB 1.0
thanks
Dhoti
Maik Greubel wrote:
> Hello,
>
> From: "Dhoti Walla" <[email protected]>
> Sent: Sunday, March 13, 2011 7:04 AM
> To: <[email protected]>
> Subject: [directfb-dev] question on mouse cursor
>
>> err = dfb->CreateSurface(&dfb, &mouseSurfaceDesc, &mouseSurface);
>>
>> Here is where I get a failure. err is always 0x07 which is
>> DFB_ACCESSDENIED, /* Access to the resource is denied. */
>
> Just an idea: Do you try to execute the binary as unprivileged user
> and have no access to /dev/fb*?
>
> Regards
>
> Maik
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev