Example #1
0
static void
CoreInputHub_Dispatch( void                  *context,
                       const OnePacketHeader *header,
                       void                  *data,
                       OneThread             *thread )
{
     InputHubAttachRequest *request = data;
     CoreInputHub          *hub     = context;

     D_DEBUG_AT( Core_InputHub, "%s()\n", __FUNCTION__ );

     direct_mutex_lock( &hub->lock );

     // FIXME: replace by own list of devices recorded in CoreInputHub_AddDevice/RemoveDevice calls
     dfb_input_enumerate_devices( CoreInputHub_EnumDevice_Callback, request, DICAPS_ALL );


     InputHubNotification notification;

     memset( &notification, 0, sizeof(notification) );

     notification.type = IHNT_ATTACHED;

     OneQueue_Dispatch( request->listen_qid, &notification, sizeof(notification) );


     OneQueue_Attach( hub->notify_qid, request->listen_qid );

     direct_mutex_unlock( &hub->lock );
}
Example #2
0
/*
 * Allocates and initializes a window stack.
 */
CoreWindowStack*
dfb_windowstack_new( DisplayLayer *layer, int width, int height )
{
     CardCapabilities  caps;
     CoreWindowStack  *stack;

     DFB_ASSERT( layer != NULL );
     DFB_ASSERT( width > 0 );
     DFB_ASSERT( height > 0 );

     /* Allocate window stack data (completely shared) */
     stack = (CoreWindowStack*) shcalloc( 1, sizeof(CoreWindowStack) );

     /* Remember layer id for access to it's local data later */
     stack->layer_id = dfb_layer_id( layer );

     /* Choose window surface policy */
     if (dfb_config->window_policy != -1) {
          /* From configuration */
          stack->wsp_opaque = stack->wsp_alpha = dfb_config->window_policy;
     }
     else {
          /* Examine hardware capabilities */
          caps = dfb_gfxcard_capabilities();

          /* If blitting is supported... */
          if (caps.accel & DFXL_BLIT) {
               /* Auto video policy for opaque windows */
               stack->wsp_opaque = CSP_VIDEOHIGH;

               /* If blending is supported,
                  then use auto video policy for alpha windows */
               if (caps.blitting & DSBLIT_BLEND_ALPHACHANNEL)
                    stack->wsp_alpha = CSP_VIDEOHIGH;
          }
     }

     /* Create the pool of windows. */
     stack->pool = fusion_object_pool_create( "Window Pool",
                                              sizeof(CoreWindow),
                                              sizeof(DFBWindowEvent),
                                              window_destructor );

     /* Initialize the modify/update lock */
     skirmish_init( &stack->lock );

     /* Set default acceleration */
     stack->cursor.numerator   = 2;
     stack->cursor.denominator = 1;
     stack->cursor.threshold   = 4;

     /* Setup size and cursor clipping region */
     dfb_windowstack_resize( stack, width, height );

     /* Attach to all input devices */
     dfb_input_enumerate_devices( stack_attach_devices, stack );

     return stack;
}
Example #3
0
void
dfb_windowstack_destroy( CoreWindowStack *stack )
{
     DFB_ASSERT( stack != NULL );
     
     dfb_input_enumerate_devices( stack_detach_devices, stack );

     fusion_object_pool_destroy( stack->pool );

     skirmish_destroy( &stack->lock );

     if (stack->windows)
          shfree( stack->windows );

     shfree( stack );
}