static void handle_expose( const XExposeEvent *expose ) { CoreLayer *layer = 0; const DisplayLayerFuncs *funcs = 0; CoreLayerContext *context; int i; /* find the correct layer */ for( i=0; i<dfb_layer_num(); i++ ) { X11LayerData *lds; layer = dfb_layer_at( i ); lds = (X11LayerData*)(layer->layer_data); if( lds->xw && (lds->xw->window == expose->window) ) break; } /* layer not found? */ if( i==dfb_layer_num() ) return; funcs = layer->funcs; D_ASSERT( funcs != NULL ); D_ASSERT( funcs->UpdateRegion != NULL ); /* Get the currently active context. */ if (dfb_layer_get_active_context( layer, &context ) == DFB_OK) { CoreLayerRegion *region; /* Get the first region. */ if (dfb_layer_context_get_primary_region( context, false, ®ion ) == DFB_OK) { /* Lock the region to avoid tearing due to concurrent updates. */ dfb_layer_region_lock( region ); /* Get the surface of the region. */ if (region->surface && region->left_buffer_lock.buffer) { DFBRegion update = { expose->x, expose->y, expose->x + expose->width - 1, expose->y + expose->height - 1 }; funcs->UpdateRegion( layer, layer->driver_data, layer->layer_data, region->region_data, region->surface, &update, ®ion->left_buffer_lock, NULL, NULL ); } /* Unlock the region. */ dfb_layer_region_unlock( region ); /* Release the region. */ dfb_layer_region_unref( region ); } /* Release the context. */ dfb_layer_context_unref( context ); } }
static void handle_expose_Async( void *ctx, void *ctx2 ) { DFBX11 *x11 = ctx; DFBX11Shared *shared = x11->shared; const XExposeEvent *expose = ctx2; CoreLayer *layer; CoreLayerContext *context; int i; X11LayerData *lds; D_DEBUG_AT( X11_Input, "%s( %d,%d-%dx%d )\n", __FUNCTION__, expose->x, expose->y, expose->width, expose->height ); //D_INFO_LINE_MSG("handle_expose %d,%d-%dx%d", expose->x, expose->y, expose->width, expose->height); /* find the correct layer */ for (i=0; i<shared->outputs; i++) { if (shared->output[i].xw && (shared->output[i].xw->window == expose->window)) break; } /* layer not found? */ if (i == shared->outputs) return; lds = shared->output[i].layers[0]; layer = dfb_layer_at( lds->layer_id ); D_ASSERT( layer != NULL ); /* Get the currently active context. */ if (dfb_layer_get_active_context( layer, &context ) == DFB_OK) { CoreLayerRegion *region; /* Get the first region. */ if (dfb_layer_context_get_primary_region( context, false, ®ion ) == DFB_OK) { /* Lock the region. */ dfb_layer_region_lock( region ); /* Get the surface of the region. */ if (region->surface && D_FLAGS_ARE_SET( region->state, CLRSF_REALIZED )) { if (dfb_config->task_manager) { DFBRegion update = { expose->x, expose->y, expose->x + expose->width - 1, expose->y + expose->height - 1 }; /* Tell the driver about the update if the region is realized. */ D_DEBUG_AT( X11_Input, " -> Issuing display task...\n" ); dfb_surface_lock( region->surface ); DisplayTask_Generate( region, &update, &update, DSFLIP_NONE, -1, NULL ); dfb_surface_unlock( region->surface ); } else { //if (lds->lock_left.buffer) { DFBRegion update = { expose->x, expose->y, expose->x + expose->width - 1, expose->y + expose->height - 1 }; // dfb_x11_update_screen( x11, lds, &update, &update, &lds->lock_left, &lds->lock_right ); //} dfb_x11_update_screen( x11, lds, &update, &update, NULL, NULL ); } } /* Unlock the region. */ dfb_layer_region_unlock( region ); /* Release the region. */ dfb_layer_region_unref( region ); } /* Release the context. */ dfb_layer_context_unref( context ); } }