xref: /haiku/headers/private/app/AppMisc.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
1 /*
2  * Copyright 2002-2007, Ingo Weinhold, bonefish@users.sf.net.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _APP_MISC_H
6 #define _APP_MISC_H
7 
8 #include <Handler.h>
9 #include <Locker.h>
10 #include <OS.h>
11 #include <SupportDefs.h>
12 
13 struct entry_ref;
14 
15 namespace BPrivate {
16 
17 // Global lock that can be used e.g. to initialize singletons.
18 extern BLocker gInitializationLock;
19 
20 status_t get_app_path(team_id team, char *buffer);
21 status_t get_app_path(char *buffer);
22 status_t get_app_ref(team_id team, entry_ref *ref, bool traverse = true);
23 status_t get_app_ref(entry_ref *ref, bool traverse = true);
24 
25 team_id current_team();
26 thread_id main_thread_for(team_id team);
27 
28 bool is_running_on_haiku();
29 
30 bool is_app_showing_modal_window(team_id team);
31 
32 } // namespace BPrivate
33 
34 // _get_object_token_
35 /*!	Return the token of a BHandler.
36 
37 	\param handler The BHandler.
38 	\return the token.
39 
40 */
41 inline int32 _get_object_token_(const BHandler* object)
42 	{ return object->fToken; }
43 
44 #endif	// _APP_MISC_H
45