_screen is only valid between show/hide.
[AROS.git] / rom / intuition / getdefaultpubscreen.c
blobfc300b6cf8d541543ef640d2e8e56c53192ac9cb
1 /*
2 Copyright © 1995-2013, 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_LH1(struct Screen *, GetDefaultPubScreen,
17 /* SYNOPSIS */
18 AROS_LHA(UBYTE *, nameBuffer, A0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 97, Intuition)
23 /* FUNCTION
24 Returns the name of the current default public screen. This will be
25 "Workbench" if there is no default public screen.
27 INPUTS
28 nameBuffer - A buffer of length MAXPUBSCREENNAME
30 RESULT
31 None.
33 NOTES
34 Only Public Screen Manager utilities want to use this function
35 since it is easy to open a window on the default public screen
36 without specifying a name.
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 SetDefaultPubScreen(), OpenWindow()
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct Screen *defscreen;
52 STRPTR name;
54 DEBUG_GETDEFAULTPUBSCREEN(dprintf("GetDefaultPubScreen(%s)\n",nameBuffer));
56 LockPubScreenList();
58 defscreen = GetPrivIBase(IntuitionBase)->DefaultPubScreen;
60 if (defscreen)
62 name = GetPrivScreen(defscreen)->pubScrNode->psn_Node.ln_Name;
64 else
66 name = "Workbench";
69 if (nameBuffer)
71 strcpy(nameBuffer, name);
74 UnlockPubScreenList();
76 return defscreen;
78 AROS_LIBFUNC_EXIT
79 } /* GetDefaultPubScreen */