Pat Wisking wrote: > Hi, I've got my DFB application running under X11. I've got a single > surface used for drawing, and I'm trying to enable the cursor on it. > > I've tried this to get access to the display layer (making the > assumption that it would have id 0): > > displayable_dfb->GetDisplayLayer(displayable_dfb, 0, &layer); > layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE ); > layer->EnableCursor(layer, 1); > > The application works, except for this code. It always gives me an > integer divide by zero error when I try to enable the cursor. > > Do I have to explicitly set the cursor shape before enabling the > cursor? Is there an enum defined somewhere that I should be passing > instead of 1 in EnableCursor(layer, 1)? And is there a better way to > access the display layer without assuming it is ID == 0? I checked the > manual entry for EnumDisplayLayers, and googled it, but couldn't find > a very solid example of how to use it. > In principle you should use DLID_PRIMARY, which happens to be 0 anyways. Anyways, for enumerating the displaylayers you should: - create your own DFBDisplayLayerCallback callback function - call EnumDisplayLayers with this callback Now your callback will be called for each existing layer. This callback has to look in the 'desc' field if the layer provides the capabilities you require, and then the passed 'layer_id' is your layer ID for GetDisplayLayer.
Regarding your problem... I assume you are using non-fatal asserts, since there is an assert right in front of the likely culprint. This likely culprint will trigger if you request full screen mode, and that is done by something like : dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); This has to do with the fact that the cursor handling code relies on 'regions' and region management (needed for window overlapping etc.) which is differently handled in full screen mode. hth Niels > Thanks, > Patrick > _______________________________________________ > directfb-users mailing list > directfb-users@directfb.org > http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users > > -- .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------" _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users