Page 251 of 336

Re: exxos blog - random goings on

Posted: 03 Jan 2023 20:47
by exxos
This is quickly turning into a small nightmare again :roll:

Even if I close the main GB7 window and only trigger events on the new window, which is a different ID and handle, the previous window routines are still somehow triggering which does not make sense.So I think trying to open two windows even if there is only one open at a time it is going to involve another total rewrite of the GB7 core. But as I don't know what is wrong in the first place...

Really I should reuse the main GB7 window. But the problem is there is that the redraw routines are geared up to draw the results etc. so displaying another bunch of information would then put even more clauses into what to do and what not to draw in the window :roll:

EDIT:

So the AES window handle goes wonky in all this which is why is running the previous drawing routines. The main window handle is normally "3" an additional window is normally "4". however when you close the main window "3". The handle for the now window open also becomes "3". The only way to stop the handles some changing is to keep the window open.. Which then screws up the AES three drawing routines.. So damned if do and damned if don't all the time :roll:

Re: exxos blog - random goings on

Posted: 03 Jan 2023 21:59
by exxos
So what I can gather currently is the main GB7 window content is not updating correctly and the actual content is ending up on the second window :shrug:

I don't really see how that can happen because I have separate AES handles for both Windows.I even recheck the handles and the new one is opened in case they have changed. I don't get it.





I suppose the cheating way is to just redraw the whole window and force it to be on top when the redraw happens.

Obviously I cannot redraw the whole window when it is a background window otherwise it will overwrite the window contents which is on top.

Re: exxos blog - random goings on

Posted: 03 Jan 2023 23:04
by stephen_usher
Surely you need to detach the drawing routines from the window handle before closing the window?

Remember that GEM is a first generation (and very rudimentary) WIMP system and it doesn't do a lot for you underneath. You have to manually clean up before closing windows. This also explains why if you close a window with a low handle number and then open a new window it will reuse that low numbered handle as it will just do a simple search for the first free handle in the list.

Re: exxos blog - random goings on

Posted: 03 Jan 2023 23:21
by exxos
It seems the AES simply didn't process the event at all. So no redraw messages *** . In which case making the window on top and full redraw might be the only way.

*** I output a dump of events to a file. It does actually trigger MOVE event, that works, and 1 REDRAW event, but not sure what its actually redrawing.

Capture.PNG

Re: exxos blog - random goings on

Posted: 03 Jan 2023 23:45
by exxos
OH it does send a redraw event, but only the overlapping section :WTF:

1.PNG
2.PNG
3.PNG

Re: exxos blog - random goings on

Posted: 04 Jan 2023 00:12
by exxos
I did a event dump of the window move below.

Capture.PNG

Code: Select all

 
 EVENT		AES	     X	           Y	 	 W             H
 30            3             0             0             0             0 
 28            3             376           142           628           332 
 20            3             219           141           281           305 
 20            4             216           123           160           327 
 20            4             376           123           120           19 
 30            4             0             0             0             0 
30 = WM_UNTOPPED
28 = WM_MOVED
20 = WM_REDRAW

3 = main window
4 = new window

Will draw a black square on every event next to see what its actually doing...

Re: exxos blog - random goings on

Posted: 04 Jan 2023 00:29
by exxos

Code: Select all

 28            3             375           132           628           332 
 20            3             219           141           281           305 
 20            4             216           123           159           327 
 20            4             375           123           121           9 
So it draws a black square on the new window.. makes no sense as the GB6 window is BEHIND the new window anyway. But that could be just the order things are happening in my debug code..

1.PNG

Next same black square over the GB7 main window...okay I guess..

2.PNG

Then a redraw which is almost right, but still nothing in the big gap on the GB7 main window.

3.PNG

So it seems impossible to redraw a background window... but it does work when only the main GB7 window is open, in respect to desktop windows that is. :crazy:

Re: exxos blog - random goings on

Posted: 04 Jan 2023 09:11
by HigashiJun
It reminds me of a movie called "The NeverEnding story"...

:lol:

The film score was nice, though.

https://www.youtube.com/watch?v=2WN0T-Ee3q4

Cheers.

Re: exxos blog - random goings on

Posted: 04 Jan 2023 10:25
by exxos
HigashiJun wrote: 04 Jan 2023 09:11 It reminds me of a movie called "The NeverEnding story"...
Was on of my favorite films when I was a kid :)

Re: exxos blog - random goings on

Posted: 04 Jan 2023 10:52
by Badwolf
I don't know if this will help at all, @exxos?

This was a little test window program I wrote a while back. Should be compilable with Pure C (there's a PRJ file in there).

All it does it display a single window, so you need desk accessories or a multitasking environment to get the best out of it, but it draws some text and some background fill and everytime it draws a new background rectangle it changes the colour index so you can see what it's done. It doesn't do anythign clever, IIRC. I think it just redraws the whole window with clipping enabled.

In effect, it's explaining the dirty rectangle list visually.

Perhaps disable the text rendering would help further?

Anyway, YMMV, but here you go.

Screenshot_2023-01-04_10-49-09.png

BW

PS: this is probably the most pertinent function

Code: Select all

void redraw_window( int handle, GRECT *dirty ) {
        int wx, wy, ww, wh;
        int pxy[4];
        int clip[4];
        int i;
        GRECT r;        
        
        graf_mouse( M_OFF, 0L );
        

        wind_update( BEG_UPDATE );
        
        wind_set( handle, WF_VSLSIZE, vslidersz, 0,0,0 );
        
        i = 0;
        wind_get( handle, WF_FIRSTXYWH, &r.g_x, &r.g_y, &r.g_w, &r.g_h );
        while( r.g_w > 0 && r.g_h > 0 ) {
                if( rc_intersect( dirty, &r ) ) {
                        set_clip( TRUE, r );
                        draw_window_content( handle );                  
                        set_clip( FALSE, r );
                }
                wind_get( handle, WF_NEXTXYWH, &r.g_x, &r.g_y, &r.g_w, &r.g_h );
        }
        
        wind_update( END_UPDATE );
        graf_mouse( M_ON, 0L );
        
}