2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "workbench_intern.h"
7 #include <workbench/workbench.h>
9 /*****************************************************************************
13 #include <proto/workbench.h>
15 AROS_LH1(BOOL
, RegisterWorkbench
,
18 AROS_LHA(struct MsgPort
*, messageport
, A0
),
21 struct WorkbenchBase
*, WorkbenchBase
, 23, Workbench
)
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:
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.
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
45 Request to open the specified drawer.
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.
54 messageport - The message port to send the to.
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.
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()!
76 ******************************************************************************/
82 if (messageport
!= NULL
)
84 ObtainSemaphore(&(WorkbenchBase
->wb_WorkbenchPortSemaphore
));
86 if (WorkbenchBase
->wb_WorkbenchPort
== NULL
)
88 WorkbenchBase
->wb_WorkbenchPort
= messageport
;
92 ReleaseSemaphore(&(WorkbenchBase
->wb_WorkbenchPortSemaphore
));
98 } /* RegisterWorkbench() */