[comp.sys.amiga] Window movement between screens

daemon@rutgers.UUCP (03/25/87)

From: Richard Conner <bilbo.conner@CS.UCLA.EDU>

Hey all you screen/window experts out there:

Here's a puzzle for you-

I want to move a window from one screen to another.
So I unlink the window from the source screen's linked list
starting off SourceScreen->FirstWindow.  I then proceed
to link it into the destination screen's linked list of windows.
I also point the window's back pointer to its Screen at the
destination screen.  All this sorounded by Forbid()/Permit().

Unfortunately the window doesn't move to the destination screen
(Although parts of it does...really strange...).  It appears as
though I'm not re-arranging enough information somewhere, but I
sure can't think or see what I'm missing.  Code looks something
like the following:

Setup:

	p_prevFromWindow <---- pointer: Previous Window in from Screen
	p_fromWindow     <---- pointer: Window in from Screen
	p_fromScreen     <---- pointer: From Screen
	p_toScreen       <---- pointer: Destination Screen

Code (Basically):

	Forbid();
	p_fromScreen->FirstWindow = p_fromScreen->FirstWindow->NextWindow;
	p_prevFromWindow->NextWindow = p_fromWindow->NextWindow;
	p_fromWindow->NextWindow = p_toScreen->FirstWindow;
	p_toScreen->FirstWindow = p_fromWindow;
	p_fromWindow->WScreen = p_toScreen;
	Permit();

Any and all suggestions/solutions welcome!

Thanx,

Richard Conner
Locus Computing Corporation		       lcc.richard@LOCUS.UCLA.EDU
					       lcc.richard@UCLA-CS
				 {ihnp4,trwrb}!lcc!richard
       {randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!richard

danny@convext.UUCP (03/27/87)

I haven't tried bouncing windows around like that but you should throw a
RethinkDisplay() after you call Permit() which will tell Intuition to have
a look around and notice that you moved your window.  Also, when you are doing
this, are you copying the bitmap?  If your window doesn't have a custom bitmap,
there would be a small headache for you...

Hope I could be of service.

Dan Wallach
...!ihnp4!convex!danny

Krogt - n. (chemical symbol: Kr) The metallic silver coating found
on fast-food game cards.

dillon@CORY.BERKELEY.EDU.UUCP (03/29/87)

>Here's a puzzle for you-
>
>I want to move a window from one screen to another.
>So I unlink the window from the source screen's linked list
>starting off SourceScreen->FirstWindow.  I then proceed
>to link it into the destination screen's linked list of windows.
>I also point the window's back pointer to its Screen at the
>destination screen.  All this sorounded by Forbid()/Permit().

	Any visible portions of the window use the screen's memory
rather than a separate region (thus, having a window as big as the 
screen in the screen does not use any more memory than a screen without
a window... unless it gets obscured by other windows).

	In anycase, this is why your window didn't move.  It simply is
not as simple as that.  Also, although you might have surrounded it with
Forbid() and Permit(), you would also have to get an exclusive lock on both
screens, their layer list, etc.... (I'm not sure how to do this myself).

				-Matt