westeros-compositor.cpp
/**
 * WstCompositorSetDefaultCursor
 *
 * Supplies a default pointer cursor image for the compositor to display.  The
 * data should be supplied in ARGB888 format as an array of 32 bit ARGB samples
 * containing width*height*4 bytes.  To remove a previously set curosr, call
 * with imgData set to NULL.  This should only be called while the 
 * conpositor is running.
 */
WstCompositorSetDefaultCursor
Supplies a default pointer cursor image for the compositor to display.  The
data should be supplied in ARGB888 format as an array of 32 bit ARGB samples
containing width*height*4 bytes.  To remove a previously set curosr, call
with imgData set to NULL.  This should only be called while the
conpositor is running.
WstCompositorSetDefaultCursor Supplies a default pointer cursor image for the compositor to display . The data should be supplied in ARGB888 format as an array of 32 bit ARGB samples containing width * height * 4 bytes . To remove a previously set curosr call with imgData set to NULL . This should only be called while the conpositor is running .
bool WstCompositorSetDefaultCursor( WstCompositor *wctx, unsigned char *imgData,
                                    int width, int height, int hotSpotX, int hotSpotY )
{
   bool result= false;
   if ( wctx && wctx->ctx )
   {
      WstContext *ctx= wctx->ctx;
      if ( wctx->isVirtual )
      {
         sprintf( wctx->lastErrorDetail,
                  "Invalid argument.  Cannot set default cursor for virtual embedded compositor" );
         goto exit;
      }
      if ( !ctx->running )
      {
         sprintf( wctx->lastErrorDetail,
                  "Bad state.  Cannot set default cursor unless the compositor is running" );
         goto exit;
      }
      if ( ctx->isRepeater )
      {
         sprintf( wctx->lastErrorDetail,
                  "Error.  Cannot set default cursor when operating as a repeating nested compositor" );
         goto exit;
      }
      if ( ctx->isNested )
      {
         sprintf( wctx->lastErrorDetail,
                  "Error.  Cannot set default cursor when operating as a nested compositor" );
         goto exit;
      }
      pthread_mutex_lock( &ctx->mutex );
      if ( ctx->dcClient )
      {
         pthread_mutex_unlock( &ctx->mutex );
         wl_client_destroy( ctx->dcClient );
         usleep( 100000 );
         pthread_mutex_lock( &ctx->mutex );
         ctx->dcClient= 0;
         ctx->dcPid= 0;
         ctx->dcDefaultCursor= false;
      }
      else
      {
         wstTerminateDefaultCursor( wctx );
      }
      if ( imgData )
      {
         if ( !wstInitializeDefaultCursor( wctx, imgData, width, height, hotSpotX, hotSpotY ) )
         {
            sprintf( wctx->lastErrorDetail,
                     "Error.  Unable to set default cursor" );
            pthread_mutex_unlock( &ctx->mutex );
            goto exit;
         }
      }
      pthread_mutex_unlock( &ctx->mutex );
      result= true;
   }
exit:
   return result;
}
bool WstCompositorSetDefaultCursor ( WstCompositor * wctx , unsigned char * imgData , int width , int height , int hotSpotX , int hotSpotY ) { bool result = false ; if ( wctx && wctx -> ctx ) { WstContext * ctx = wctx -> ctx ; if ( wctx -> isVirtual ) { sprintf ( wctx -> lastErrorDetail , " " ) ; goto exit ; } if ( ! ctx -> running ) { sprintf ( wctx -> lastErrorDetail , " " ) ; goto exit ; } if ( ctx -> isRepeater ) { sprintf ( wctx -> lastErrorDetail , " " ) ; goto exit ; } if ( ctx -> isNested ) { sprintf ( wctx -> lastErrorDetail , " " ) ; goto exit ; } pthread_mutex_lock ( & ctx -> mutex ) ; if ( ctx -> dcClient ) { pthread_mutex_unlock ( & ctx -> mutex ) ; wl_client_destroy ( ctx -> dcClient ) ; usleep ( 100000 ) ; pthread_mutex_lock ( & ctx -> mutex ) ; ctx -> dcClient = 0 ; ctx -> dcPid = 0 ; ctx -> dcDefaultCursor = false ; } else { wstTerminateDefaultCursor ( wctx ) ; } if ( imgData ) { if ( ! wstInitializeDefaultCursor ( wctx , imgData , width , height , hotSpotX , hotSpotY ) ) { sprintf ( wctx -> lastErrorDetail , " " ) ; pthread_mutex_unlock ( & ctx -> mutex ) ; goto exit ; } } pthread_mutex_unlock ( & ctx -> mutex ) ; result = true ; } exit : return result ; }
WstCompositorSetDefaultCursor
 Supplies a default pointer cursor image for the compositor to display.
WstCompositorSetDefaultCursor Supplies a default pointer cursor image for the compositor to display .