Don't get OOPBase in this ugly way.
[tangerine.git] / rom / intuition / nextpubscreen.c
blobb65aa9971c0abc674163aaf9f79a3f3ff264f20f
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <string.h>
8 #include "intuition_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/intuition.h>
15 AROS_LH2(UBYTE *, NextPubScreen,
17 /* SYNOPSIS */
18 AROS_LHA(struct Screen *, screen , A0),
19 AROS_LHA(UBYTE * , namebuff, A1),
21 /* LOCATION */
22 struct IntuitionBase *, IntuitionBase, 89, Intuition)
24 /* FUNCTION
26 Gets the next public screen in the system; this allows visitor windows
27 to jump among public screens in a cycle.
29 INPUTS
31 screen -- Pointer to the public screen your window is open in or
32 NULL if you don't have a pointer to a public screen.
33 namebuff -- Pointer to a buffer with (at least) MAXPUBSCREENNAME+1
34 characters to put the name of the next public screen in.
36 RESULT
38 Returns 'namebuff' or NULL if there are no public screens.
40 NOTES
42 We cannot guarantee that the public screen, the name of which you got
43 by using this function, is available when you call for instance
44 LockPubScreen(). Therefore you must be prepared to handle failure of
45 that kind of functions.
46 This function may return the name of a public screen which is in
47 private mode.
48 The cycle order is undefined, so draw no conclusions based on it!
50 EXAMPLE
52 BUGS
54 SEE ALSO
56 OpenScreen(), PubScreenStatus()
58 INTERNALS
60 Maybe we should correct the + 1 stupidity right away?
62 *****************************************************************************/
63 #define GPB(x) GetPrivIBase(x)
66 AROS_LIBFUNC_INIT
67 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
69 struct PubScreenNode *ps;
70 struct IntScreen *scr = (struct IntScreen *)screen;
71 struct List *list;
73 list = LockPubScreenList();
75 if(scr == NULL)
77 ps = (struct PubScreenNode *)list->lh_Head;
78 ASSERT(ps != NULL);
80 else
82 ps = scr->pubScrNode;
83 if (!ps) return NULL;
85 ps = (struct PubScreenNode *)ps->psn_Node.ln_Succ;
86 ASSERT(ps != NULL);
89 /* A "valid" node in a list must have ln_Succ != NULL */
91 if (!ps->psn_Node.ln_Succ) return NULL;
93 if (namebuff) strcpy(namebuff, ps->psn_Node.ln_Name);
95 UnlockPubScreenList();
97 return namebuff;
99 AROS_LIBFUNC_EXIT
100 } /* NextPubScreen */