View Single Post
Old 01 September 2017, 01:09   #20
chocsplease
Registered User

 
Join Date: Dec 2016
Location: london
Posts: 157
Hi,

Many thanks for the explanation, I'll read the link.

At the moment my code sort of works but somehow kills Intuition, or I suspect it does.

Everything is fine the 1st time through and the window displays the correct info and clips correctly.

However the Amiga freezes solid as soon as I try and move the window or resize it. It never gets to the message handler (I've checked with printfs) and its not a Guru, it just locks.

I'm not at all sure how to debug this. This is the code I use to open the window, maybe there is something in this?

Code:
int open_window(int scrnwidth,int scrnheight)
{
    int topleftx=0,toplefty=0;
    int width=200,height=200;
    int tempw=0,temph=0;

    unsigned long maxchars=0;

    struct TextFont *font;
    UWORD font_width=0;

/*calculate 1 quarter of screen width*/

    if (mywindow)
        return 0; /*opened already*/

    tempw=scrnwidth/4;

/*calculate 1 5th screen height*/

    temph=scrnheight/5;

    topleftx=tempw;
    toplefty=temph;

    width=scrnwidth-(tempw*2);
    height=scrnheight-(temph*2);

    mywindow = OpenWindowTags(NULL, WA_Left, topleftx, WA_Top, toplefty,\
         WA_InnerWidth, width,  WA_InnerHeight, height,\
        WA_MinWidth,90,WA_MinHeight, 40, WA_MaxWidth, scrnwidth-20, WA_MaxHeight, scrnheight-20,\
        WA_IDCMP,IDCMP_CLOSEWINDOW  | IDCMP_DISKINSERTED | IDCMP_DISKREMOVED | IDCMP_NEWSIZE | IDCMP_REFRESHWINDOW,\
        WA_Flags, WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE,\
        WA_Title, (ULONG)"Info64", WA_PubScreenName, (ULONG)"WorkBench", TAG_DONE);

    if (mywindow)
    {
        myIText.FrontPen    = myTEXTPEN;
                myIText.BackPen     = myBACKGROUNDPEN;
                myIText.DrawMode    = JAM2;
                myIText.LeftEdge    = MYTEXT_LEFT;
                myIText.TopEdge     = MYTEXT_TOP;
                myIText.ITextFont   = &myTextAttr;
                myIText.IText       = "Hello, World.  ;-)";
                myIText.NextText    = NULL;
        mywindowrastport=mywindow->RPort;

        oldwin_width=mywindow->Width;
        oldwin_height=mywindow->Height;

        /*open line buffers*/

        font=mywindow->RPort->Font;
        font_width=font->tf_XSize;

        maxchars=(scrnwidth/font_width)+1;

        win_buffer=malloc((maxchars+2)*sizeof(char)); /*make memory buffers for line plus null char*/
        win_buffer_part=malloc((maxchars+2)*sizeof(char));
        win_buffer_len=maxchars;

        win_rect.MinX = mywindow->BorderLeft;
        win_rect.MinY = mywindow->BorderTop;
        win_rect.MaxX = mywindow->Width-mywindow->BorderRight-1;
        win_rect.MaxY = mywindow->Height-mywindow->BorderBottom-1;
        if (win_reg = NewRegion()) 
            {
            OrRectRegion(win_reg, &win_rect);
            win_oldreg = InstallClipRegion(mywindow->WLayer, win_reg);
        }    
        return 0;
    }
    else
        return 1;
}
Here's hoping anyway
chocsplease is offline  
 
Page generated in 0.06229 seconds with 10 queries