1Desktop module
2##############
3
4There are no globally accessible objects in this section of code, but
5many function definitions to work with workspaces, screen attributes,
6and other such things. These functions work with the private desktop
7classes Screen and Workspace.
8
9Global Functions
10================
11
12void InitDesktop(void)
13----------------------
14
15Sets up all the stuff necessary for the system's desktop.
16
171. Create a graphics module list by looping through allocation and
18   initialization of display modules until failure is returned. If
19   app_server exists, just create a ViewDriver module
202. Create and populate Screen list, pointing each Screen instance to its
21   Driver instance
223. Create layer and workspace locks
234. Set screen 0 to active
245. Create the desktop_private::draglock semaphore
25
26void ShutdownDesktop(void)
27--------------------------
28
29Undoes everything done in InitDesktop().
30
311. Delete all locks
322. Delete all screens in the list
333. Delete the desktop_private::draglock semaphore
344. If desktop_private::dragmessage is non-NULL, delete it.
35
36void AddWorkspace(int32 index=-1)
37---------------------------------
38
39void DeleteWorkspace(int32 index)
40---------------------------------
41
42int32 CountWorkspaces(void)
43---------------------------
44
45void SetWorkspaceCount(int32 count)
46-----------------------------------
47
48int32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID)
49---------------------------------------------------------
50
51void SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID)
52---------------------------------------------------------------------
53
54Each of these calls the appropriate method in the Screen class. Add
55and Delete workspace functions operate on all screens.
56
57void SetScreen(screen_id id)
58----------------------------
59
60int32 CountScreens(void)
61------------------------
62
63screen_id ActiveScreen(void)
64----------------------------
65
66DisplayDriver \*GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)
67---------------------------------------------------------------
68
69status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)
70---------------------------------------------------------------------------------------------
71
72Each of these calls operate on the objects in the Screen list, calling
73methods as appropriate.
74
75void AddWindowToDesktop(ServerWindow \*win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)
76-------------------------------------------------------------------------------------------------------------------
77
78void RemoveWindowFromDesktop(ServerWindow \*win)
79------------------------------------------------
80
81ServerWindow \*GetActiveWindow(void)
82------------------------------------
83
84void SetActiveWindow(ServerWindow \*win)
85----------------------------------------
86
87Layer \*GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)
88--------------------------------------------------------------------------------------------
89
90These operate on the layer structure in the active Screen object,
91calling methods as appropriate.
92
93void set_drag_message(int32 size, int8 \*flattened)
94---------------------------------------------------
95
96This assigns a BMessage in its flattened state to the internal
97storage. Only one message can be stored at a time. Once an assignment
98is made, another cannot be made until the current one is emptied. If
99additional calls are made while there is a drag message assigned, the
100new assignment will not be made. Note that this merely passes a
101pointer around. No copies are made and the caller is responsible for
102freeing any allocated objects from the heap.
103
1041. Acquire the draglock
1052. release the lock and return if winborder_private::dragmessage is
106   non-NULL
1073. Assign parameters to the private variables
1084. Release the draglock
109
110int8\* get_drag_message(int32 \*size)
111-------------------------------------
112
113Retrieve the current drag message in use. This function will fail if a
114NULL pointer is passed to it. Note that this does not free the current
115drag message from use. The size of the flattened message is stored in
116the size parameter. Note that if there is no message in use, it will
117return NULL and set size to 0.
118
119
1201. return NULL if size pointer is NULL
1212. acquire the draglock
1223. set value of size parameter to winborder_private::dragmessagesize
1234. assign a temporary pointer the value of desktop_private::dragmessage
1245. release the draglock
1256. return the temporary pointer
126
127void empty_drag\_ message(void)
128-------------------------------
129
130This empties the current drag message from use and allows for other
131messages to be assigned.
132
133
1341. acquire draglock
1352. assign 0 to desktop_private::dragmessagesize and set
136   desktop_private::dragmessage to NULL
1373. release draglock
138
139Namespaces
140==========
141
142desktop_private
143---------------
144
145- int8 \*dragmessage
146- int32 dragmessagesize
147- sem_id draglock
148