Some fix for scrolling with lasso.
[tangerine.git] / rom / workbench / registerworkbench.c
blob7bbf256a500505686437db924142d9da79ec25de
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "workbench_intern.h"
7 #include <workbench/workbench.h>
9 /*****************************************************************************
11 NAME */
13 #include <proto/workbench.h>
15 AROS_LH1(BOOL, RegisterWorkbench,
17 /* SYNOPSIS */
18 AROS_LHA(struct MsgPort *, messageport, A0),
20 /* LOCATION */
21 struct WorkbenchBase *, WorkbenchBase, 23, Workbench)
23 /* FUNCTION
24 The workbench application uses this function to register itself with
25 the library. When it has done this, the library send messages to this
26 port about actions the application is supposed to carry out.
28 All messages sent to the message port are of struct WBHandlerMessage,
29 which is specified in <workbench/handler.h>. The wbhm_Type field
30 identifies the type of message and which part of the wbhm_Data union
31 is relevant. The following types are currently defined:
33 WBHM_TYPE_SHOW
34 Intuition has (re)opened the Workbench Screen, and request that
35 you open all your windows. When the message is replied, Intuition
36 assumes that the windows have been opened.
38 WBHM_TYPE_HIDE
39 Intuition is about to close the Workbench Screen, and request that
40 you close all your windows. When the message is replied, Intuition
41 assumes that the windows have been closed and will try to close the
42 screen.
44 WBHM_TYPE_OPEN
45 Request to open the specified drawer.
47 WBHM_TYPE_UPDATE
48 The state of the specified disk object has changed, and this
49 message serves as a notification and suggestion that you should
50 update it's visual representation to the user. For example, it
51 might have been deleted or renamed.
53 INPUTS
54 messageport - The message port to send the to.
56 RESULT
57 TRUE if the message port was successfully registered, FALSE otherwise.
58 The registration will fail if an other message port has already been
59 registered earlier or if a NULL pointer was passed in.
61 NOTES
62 As you can read above, only one workbench application can be registered
63 at a time. This is intentional. Note that "workbench application" in
64 this context means the program that is the file manager and handles
65 the GUI, not a program that is started using OpenWorkbenchObjectA()!
67 EXAMPLE
69 BUGS
71 SEE ALSO
72 UnregisterWorkbench()
74 INTERNALS
76 ******************************************************************************/
78 AROS_LIBFUNC_INIT
80 BOOL success = FALSE;
82 if (messageport != NULL)
84 ObtainSemaphore(&(WorkbenchBase->wb_WorkbenchPortSemaphore));
86 if (WorkbenchBase->wb_WorkbenchPort == NULL)
88 WorkbenchBase->wb_WorkbenchPort = messageport;
89 success = TRUE;
92 ReleaseSemaphore(&(WorkbenchBase->wb_WorkbenchPortSemaphore));
95 return success;
97 AROS_LIBFUNC_EXIT
98 } /* RegisterWorkbench() */