// Render an object to the main window void backdrop_render_object( BackdropInfo *info, BackdropObject *object, UWORD flags) { // Lock window GetSemaphore(&info->window_lock,SEMF_EXCLUSIVE,0); // Window open? if (info->window) { // Install clip? if (flags&BRENDERF_CLIP && info->clip_region) InstallClipRegion(info->window->WLayer,info->clip_region); // Draw object backdrop_draw_object( info, object, flags|BRENDERF_REAL, &info->rp, object->pos.Left, object->pos.Top); // Remove clip region if (flags&BRENDERF_CLIP && info->clip_region) InstallClipRegion(info->window->WLayer,0); } // Unlock window FreeSemaphore(&info->window_lock); }
// Start dragging an object BOOL backdrop_drag_object( BackdropInfo *info, BackdropObject *object) { struct Image *image; ULONG flags=0; // Is object already being dragged? if (object->drag_info) return 1; // Is there a select image? if (object->icon->do_Gadget.SelectRender && (object->icon->do_Gadget.Flags&GFLG_GADGHIMAGE)) { image=(struct Image *)object->icon->do_Gadget.SelectRender; } // No else image=(struct Image *)object->icon->do_Gadget.GadgetRender; // Get flags if (info->flags&BDIF_CUSTOM_DRAG) { // Custom drag flags=DRAGF_CUSTOM; // Opaque? if (environment->env->desktop_flags&DESKTOPF_QUICK_DRAG) flags|=DRAGF_NO_MASK; } // Get drag info if (!(object->drag_info= GetDragInfo( info->window, &GUI->drag_screen_rp, (image->Width<object->pos.Width)?object->pos.Width:image->Width, (image->Height<object->pos.Height)?object->pos.Height:image->Height, flags))) return 0; // Get image to drag backdrop_draw_object(info,object,0,&object->drag_info->drag_rp,0,0); // Get mask if (environment->env->desktop_flags&DESKTOPF_QUICK_DRAG) object->drag_info->flags|=DRAGF_OPAQUE; else if (environment->env->desktop_flags&DESKTOPF_TRANSPARENCY) object->drag_info->flags|=DRAGF_TRANSPARENT; else object->drag_info->flags|=DRAGF_TRANSPARENT|DRAGF_OPAQUE; GetDragMask(object->drag_info); return 1; }
// Show the backdrop objects void backdrop_show_objects(BackdropInfo *info,UWORD flags) { BackdropObject *object; // Lock backdrop list lock_listlock(&info->objects,0); // Lock window GetSemaphore(&info->window_lock,SEMF_EXCLUSIVE,0); // Window open? if (info->window) { // Are we in a refresh? if (flags&BDSF_IN_REFRESH) { // Lock layers #ifdef LOCKLAYER_OK LockScreenLayer(info->window->WScreen); #else Forbid(); #endif // End refresh temporarily EndRefresh(info->window,FALSE); // Install new clip region if we have it if (info->clip_region) InstallClipRegion(info->window->WLayer,info->clip_region); // Continue refresh BeginRefresh(info->window); } // Or, are we meant to be refreshing? else if (flags&BDSF_REFRESH) { // Start refresh here? if ((flags&BDSF_REFRESH_DONE)==BDSF_REFRESH_DONE) { // Lock layers #ifdef LOCKLAYER_OK LockScreenLayer(info->window->WScreen); #else Forbid(); #endif } // And our region with damagelist if (info->clip_region) AndRegionRegion(info->clip_region,info->window->WLayer->DamageList); // Begin the refresh BeginRefresh(info->window); } // Install clip region if we have it else if (!(flags&BDSF_NO_CLIP) && info->clip_region) InstallClipRegion(info->window->WLayer,info->clip_region); // Clear backdrop window if (flags&BDSF_CLEAR) { EraseRect(&info->rp, info->size.MinX, info->size.MinY, info->size.MaxX, info->size.MaxY); } // Not just clearing? if ((flags&BDSF_CLEAR_ONLY)!=BDSF_CLEAR_ONLY) { // Go through backdrop list (backwards) for (object=(BackdropObject *)info->objects.list.lh_TailPred; object->node.ln_Pred; object=(BackdropObject *)object->node.ln_Pred) { // Reset? if (flags&BDSF_RESET) { // Need to get masks? if (!backdrop_icon_border(object) && !object->image_mask[0]) { // Get masks for this icon backdrop_get_masks(object); } } // Valid position? if (!(object->flags&BDOF_NO_POSITION)) { // Render this object backdrop_draw_object( info, object, BRENDERF_REAL, &info->rp, object->pos.Left, object->pos.Top); } } } // Refresh? if (flags&BDSF_REFRESH) { EndRefresh(info->window,((flags&BDSF_REFRESH_DONE)==BDSF_REFRESH_DONE)?TRUE:FALSE); // End refresh here? if ((flags&BDSF_REFRESH_DONE)==BDSF_REFRESH_DONE) { // Unlock layers #ifdef LOCKLAYER_OK UnlockScreenLayer(info->window->WScreen); #else Permit(); #endif } } // In refresh? else if (flags&BDSF_IN_REFRESH) { // End refresh temporarily EndRefresh(info->window,FALSE); // Remove clip region if (info->clip_region) InstallClipRegion(info->window->WLayer,0); // Continue refresh BeginRefresh(info->window); // Unlock layers #ifdef LOCKLAYER_OK UnlockScreenLayer(info->window->WScreen); #else Permit(); #endif } // Remove clip region else if (!(flags&BDSF_NO_CLIP) && info->clip_region) InstallClipRegion(info->window->WLayer,0); // Update virtual size if (flags&BDSF_RECALC) backdrop_calc_virtual(info); } // Unlock window FreeSemaphore(&info->window_lock); // Unlock backdrop list unlock_listlock(&info->objects); }