Esempio n. 1
0
void CheckLayers(struct Screen *screen, struct IntuitionBase *IntuitionBase)
{
    struct Layer *L;

    LOCK_REFRESH(screen);

    for (L = screen->LayerInfo.top_layer; L; L = L->back)
    {
        if (L->Flags & LAYERREFRESH)
        {
            CheckLayerRefresh(L, screen, IntuitionBase);
        }
    }

    UNLOCK_REFRESH(screen);
}
Esempio n. 2
0
/* This function must never be called with the layer/layerinfo locked,
 * otherwise a deadlock with ObtainGIRPort can happen.
 */
IPTR Locked_DoMethodA (struct Window *w, struct Gadget *g, Msg message, struct IntuitionBase *IntuitionBase)
{
    IPTR rc;
    BOOL lock = w && (g->GadgetType & GTYP_SYSGADGET &&
            ((g->GadgetType & GTYP_SYSTYPEMASK) == GTYP_WDRAGGING ||
             (g->GadgetType & GTYP_SYSTYPEMASK) == GTYP_SIZING));

    if (lock)
    {
        LOCK_REFRESH(w->WScreen);
    }
    
    LOCKGADGET
    rc = Custom_DoMethodA(g, message);   
    UNLOCKGADGET

    if (lock)
    {
        UNLOCK_REFRESH(w->WScreen);
    }

    return rc;
}
Esempio n. 3
0
void DoMoveSizeWindow(struct Window *targetwindow, LONG NewLeftEdge, LONG NewTopEdge,
                      LONG NewWidth, LONG NewHeight, BOOL send_newsize, struct IntuitionBase *IntuitionBase)
{
    struct IIHData  	*iihdata = (struct IIHData *)GetPrivIBase(IntuitionBase)->InputHandler->is_Data;
  //struct IntWindow  	*w       = (struct IntWindow *)targetwindow;
    struct Layer    	*targetlayer = WLAYER(targetwindow)/*, *L*/;
    struct Requester    *req;
    struct InputEvent   *ie;
    LONG            	 OldLeftEdge  = targetwindow->LeftEdge;
    LONG            	 OldTopEdge   = targetwindow->TopEdge;
    LONG            	 OldWidth     = targetwindow->Width;
    LONG            	 OldHeight    = targetwindow->Height;
    LONG            	 pos_dx, pos_dy, size_dx, size_dy;

    /* correct new window coords if necessary */

    FixWindowCoords(targetwindow, &NewLeftEdge, &NewTopEdge, &NewWidth, &NewHeight,IntuitionBase);

    D(bug("DoMoveSizeWindow to %d,%d %d x %d\n", NewLeftEdge, NewTopEdge, NewWidth, NewHeight));

    pos_dx  = NewLeftEdge - OldLeftEdge;
    pos_dy  = NewTopEdge  - OldTopEdge;
    size_dx = NewWidth    - OldWidth;
    size_dy = NewHeight   - OldHeight;

    LOCK_REFRESH(targetwindow->WScreen);

/* jDc: intuition 68k doesn't care about that */
//    if (pos_dx || pos_dy || size_dx || size_dy)
//    {

        if (size_dx || size_dy)
        {
            WindowSizeWillChange(targetwindow, size_dx, size_dy, IntuitionBase);
        }

        targetwindow->LeftEdge    += pos_dx;
        targetwindow->TopEdge     += pos_dy;
#ifndef __MORPHOS__
        targetwindow->RelLeftEdge += pos_dx;
        targetwindow->RelTopEdge  += pos_dy;
#endif

        targetwindow->Width     = NewWidth;
        targetwindow->Height    = NewHeight;
        targetwindow->GZZWidth  = targetwindow->Width  - targetwindow->BorderLeft - targetwindow->BorderRight;
        targetwindow->GZZHeight = targetwindow->Height - targetwindow->BorderTop  - targetwindow->BorderBottom;

        /* check for GZZ window */
        if (BLAYER(targetwindow))
        {
            /* move outer window first */
            MoveSizeLayer(BLAYER(targetwindow), pos_dx, pos_dy, size_dx, size_dy);
        }

        MoveSizeLayer(targetlayer, pos_dx, pos_dy, size_dx, size_dy);

        for (req = targetwindow->FirstRequest; req; req = req->OlderRequest)
        {
            struct Layer *layer = req->ReqLayer;

            if (layer)
            {
                int dx, dy, dw, dh;
                int left, top, right, bottom;

                left = NewLeftEdge + req->LeftEdge;
                top = NewTopEdge + req->TopEdge;
                right = left + req->Width - 1;
                bottom = top + req->Height - 1;

                if (left > NewLeftEdge + NewWidth - 1)
                    left = NewLeftEdge + NewWidth - 1;

                if (top > NewTopEdge + NewHeight - 1)
                    top = NewTopEdge + NewHeight - 1;

                if (right > NewLeftEdge + NewWidth - 1)
                    right = NewLeftEdge + NewWidth - 1;

                if (bottom > NewTopEdge + NewHeight - 1)
                    bottom = NewTopEdge + NewHeight - 1;

                dx = left - layer->bounds.MinX;
                dy = top - layer->bounds.MinY;
                dw = right - left - layer->bounds.MaxX + layer->bounds.MinX;
                dh = bottom - top - layer->bounds.MaxY + layer->bounds.MinY;

                MoveSizeLayer(layer, dx, dy, dw, dh);
            }
        }

#if 0
        if (w->ZipLeftEdge != ~0) w->ZipLeftEdge = OldLeftEdge;
        if (w->ZipTopEdge  != ~0) w->ZipTopEdge  = OldTopEdge;
        if (w->ZipWidth    != ~0) w->ZipWidth    = OldWidth;
        if (w->ZipHeight   != ~0) w->ZipHeight   = OldHeight;
#endif

        if (pos_dx || pos_dy)
        {
            UpdateMouseCoords(targetwindow);
#ifndef __MORPHOS__
            if (HAS_CHILDREN(targetwindow))
                move_family(targetwindow, pos_dx, pos_dy);
#endif
        }

//    } /* if (pos_dx || pos_dy || size_dx || size_dy) */

    if (size_dx || size_dy)
    {
        WindowSizeHasChanged(targetwindow, size_dx, size_dy, FALSE, IntuitionBase);
    }

    ih_fire_intuimessage(targetwindow,
                 IDCMP_CHANGEWINDOW,
                 CWCODE_MOVESIZE,
                 targetwindow,
                 IntuitionBase);

    if (send_newsize)
    {
        /* Send IDCMP_NEWSIZE and IDCMP_CHANGEWINDOW to resized window, even
           if there was no resizing/position change at all. BGUI for example
           relies on this! */

        ih_fire_intuimessage(targetwindow,
                     IDCMP_NEWSIZE,
                     0,
                     targetwindow,
                     IntuitionBase);

        if ((ie = AllocInputEvent(iihdata)))
        {
            ie->ie_Class = IECLASS_EVENT;
            ie->ie_Code = IECODE_NEWSIZE;
            ie->ie_EventAddress = targetwindow;
            CurrentTime(&ie->ie_TimeStamp.tv_secs, &ie->ie_TimeStamp.tv_micro);
        }
    }

    // jDc: CheckLayers calls LOCK_REFRESH, so there's no reason to UNLOCK here!
    //    UNLOCK_REFRESH(targetwindow->WScreen);

    CheckLayers(targetwindow->WScreen, IntuitionBase);

    UNLOCK_REFRESH(targetwindow->WScreen);
    
#if 0    
    if (size_dx || size_dy)
    {
        if (!(((struct IntWindow *)targetwindow)->CustomShape))
        {
            struct wdpWindowShape       shapemsg;
            struct Region               *shape;
            shapemsg.MethodID           = WDM_WINDOWSHAPE;
            shapemsg.wdp_Width      = targetwindow->Width;
            shapemsg.wdp_Height     = targetwindow->Height;
            shapemsg.wdp_Window = targetwindow;
            shapemsg.wdp_TrueColor      = (((struct IntScreen *)targetwindow->WScreen)->DInfo.dri.dri_Flags & DRIF_DIRECTCOLOR);
            shapemsg.wdp_UserBuffer     = ((struct IntWindow *)targetwindow)->DecorUserBuffer;
            shape = DoMethodA(((struct IntScreen *)(targetwindow->WScreen))->WinDecorObj, (Msg)&shapemsg);	

            if (((struct IntWindow *)targetwindow)->OutlineShape) DisposeRegion(((struct IntWindow *)targetwindow)->OutlineShape);
            ((struct IntWindow *)targetwindow)->OutlineShape = shape;
            ChangeWindowShape(targetwindow, shape, NULL);
            ((struct IntWindow *)targetwindow)->CustomShape = FALSE;
        }
    }
#endif
    
}