1*a5061eceSAdrien DestuguesDesktop module 2*a5061eceSAdrien Destugues############## 3*a5061eceSAdrien Destugues 4*a5061eceSAdrien DestuguesThere are no globally accessible objects in this section of code, but 5*a5061eceSAdrien Destuguesmany function definitions to work with workspaces, screen attributes, 6*a5061eceSAdrien Destuguesand other such things. These functions work with the private desktop 7*a5061eceSAdrien Destuguesclasses Screen and Workspace. 8*a5061eceSAdrien Destugues 9*a5061eceSAdrien DestuguesGlobal Functions 10*a5061eceSAdrien Destugues================ 11*a5061eceSAdrien Destugues 12*a5061eceSAdrien Destuguesvoid InitDesktop(void) 13*a5061eceSAdrien Destugues---------------------- 14*a5061eceSAdrien Destugues 15*a5061eceSAdrien DestuguesSets up all the stuff necessary for the system's desktop. 16*a5061eceSAdrien Destugues 17*a5061eceSAdrien Destugues1. Create a graphics module list by looping through allocation and 18*a5061eceSAdrien Destugues initialization of display modules until failure is returned. If 19*a5061eceSAdrien Destugues app_server exists, just create a ViewDriver module 20*a5061eceSAdrien Destugues2. Create and populate Screen list, pointing each Screen instance to its 21*a5061eceSAdrien Destugues Driver instance 22*a5061eceSAdrien Destugues3. Create layer and workspace locks 23*a5061eceSAdrien Destugues4. Set screen 0 to active 24*a5061eceSAdrien Destugues5. Create the desktop_private::draglock semaphore 25*a5061eceSAdrien Destugues 26*a5061eceSAdrien Destuguesvoid ShutdownDesktop(void) 27*a5061eceSAdrien Destugues-------------------------- 28*a5061eceSAdrien Destugues 29*a5061eceSAdrien DestuguesUndoes everything done in InitDesktop(). 30*a5061eceSAdrien Destugues 31*a5061eceSAdrien Destugues1. Delete all locks 32*a5061eceSAdrien Destugues2. Delete all screens in the list 33*a5061eceSAdrien Destugues3. Delete the desktop_private::draglock semaphore 34*a5061eceSAdrien Destugues4. If desktop_private::dragmessage is non-NULL, delete it. 35*a5061eceSAdrien Destugues 36*a5061eceSAdrien Destuguesvoid AddWorkspace(int32 index=-1) 37*a5061eceSAdrien Destugues--------------------------------- 38*a5061eceSAdrien Destugues 39*a5061eceSAdrien Destuguesvoid DeleteWorkspace(int32 index) 40*a5061eceSAdrien Destugues--------------------------------- 41*a5061eceSAdrien Destugues 42*a5061eceSAdrien Destuguesint32 CountWorkspaces(void) 43*a5061eceSAdrien Destugues--------------------------- 44*a5061eceSAdrien Destugues 45*a5061eceSAdrien Destuguesvoid SetWorkspaceCount(int32 count) 46*a5061eceSAdrien Destugues----------------------------------- 47*a5061eceSAdrien Destugues 48*a5061eceSAdrien Destuguesint32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID) 49*a5061eceSAdrien Destugues--------------------------------------------------------- 50*a5061eceSAdrien Destugues 51*a5061eceSAdrien Destuguesvoid SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID) 52*a5061eceSAdrien Destugues--------------------------------------------------------------------- 53*a5061eceSAdrien Destugues 54*a5061eceSAdrien DestuguesEach of these calls the appropriate method in the Screen class. Add 55*a5061eceSAdrien Destuguesand Delete workspace functions operate on all screens. 56*a5061eceSAdrien Destugues 57*a5061eceSAdrien Destuguesvoid SetScreen(screen_id id) 58*a5061eceSAdrien Destugues---------------------------- 59*a5061eceSAdrien Destugues 60*a5061eceSAdrien Destuguesint32 CountScreens(void) 61*a5061eceSAdrien Destugues------------------------ 62*a5061eceSAdrien Destugues 63*a5061eceSAdrien Destuguesscreen_id ActiveScreen(void) 64*a5061eceSAdrien Destugues---------------------------- 65*a5061eceSAdrien Destugues 66*a5061eceSAdrien DestuguesDisplayDriver \*GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID) 67*a5061eceSAdrien Destugues--------------------------------------------------------------- 68*a5061eceSAdrien Destugues 69*a5061eceSAdrien Destuguesstatus_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID) 70*a5061eceSAdrien Destugues--------------------------------------------------------------------------------------------- 71*a5061eceSAdrien Destugues 72*a5061eceSAdrien DestuguesEach of these calls operate on the objects in the Screen list, calling 73*a5061eceSAdrien Destuguesmethods as appropriate. 74*a5061eceSAdrien Destugues 75*a5061eceSAdrien Destuguesvoid AddWindowToDesktop(ServerWindow \*win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID) 76*a5061eceSAdrien Destugues------------------------------------------------------------------------------------------------------------------- 77*a5061eceSAdrien Destugues 78*a5061eceSAdrien Destuguesvoid RemoveWindowFromDesktop(ServerWindow \*win) 79*a5061eceSAdrien Destugues------------------------------------------------ 80*a5061eceSAdrien Destugues 81*a5061eceSAdrien DestuguesServerWindow \*GetActiveWindow(void) 82*a5061eceSAdrien Destugues------------------------------------ 83*a5061eceSAdrien Destugues 84*a5061eceSAdrien Destuguesvoid SetActiveWindow(ServerWindow \*win) 85*a5061eceSAdrien Destugues---------------------------------------- 86*a5061eceSAdrien Destugues 87*a5061eceSAdrien DestuguesLayer \*GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID) 88*a5061eceSAdrien Destugues-------------------------------------------------------------------------------------------- 89*a5061eceSAdrien Destugues 90*a5061eceSAdrien DestuguesThese operate on the layer structure in the active Screen object, 91*a5061eceSAdrien Destuguescalling methods as appropriate. 92*a5061eceSAdrien Destugues 93*a5061eceSAdrien Destuguesvoid set_drag_message(int32 size, int8 \*flattened) 94*a5061eceSAdrien Destugues--------------------------------------------------- 95*a5061eceSAdrien Destugues 96*a5061eceSAdrien DestuguesThis assigns a BMessage in its flattened state to the internal 97*a5061eceSAdrien Destuguesstorage. Only one message can be stored at a time. Once an assignment 98*a5061eceSAdrien Destuguesis made, another cannot be made until the current one is emptied. If 99*a5061eceSAdrien Destuguesadditional calls are made while there is a drag message assigned, the 100*a5061eceSAdrien Destuguesnew assignment will not be made. Note that this merely passes a 101*a5061eceSAdrien Destuguespointer around. No copies are made and the caller is responsible for 102*a5061eceSAdrien Destuguesfreeing any allocated objects from the heap. 103*a5061eceSAdrien Destugues 104*a5061eceSAdrien Destugues1. Acquire the draglock 105*a5061eceSAdrien Destugues2. release the lock and return if winborder_private::dragmessage is 106*a5061eceSAdrien Destugues non-NULL 107*a5061eceSAdrien Destugues3. Assign parameters to the private variables 108*a5061eceSAdrien Destugues4. Release the draglock 109*a5061eceSAdrien Destugues 110*a5061eceSAdrien Destuguesint8\* get_drag_message(int32 \*size) 111*a5061eceSAdrien Destugues------------------------------------- 112*a5061eceSAdrien Destugues 113*a5061eceSAdrien DestuguesRetrieve the current drag message in use. This function will fail if a 114*a5061eceSAdrien DestuguesNULL pointer is passed to it. Note that this does not free the current 115*a5061eceSAdrien Destuguesdrag message from use. The size of the flattened message is stored in 116*a5061eceSAdrien Destuguesthe size parameter. Note that if there is no message in use, it will 117*a5061eceSAdrien Destuguesreturn NULL and set size to 0. 118*a5061eceSAdrien Destugues 119*a5061eceSAdrien Destugues 120*a5061eceSAdrien Destugues1. return NULL if size pointer is NULL 121*a5061eceSAdrien Destugues2. acquire the draglock 122*a5061eceSAdrien Destugues3. set value of size parameter to winborder_private::dragmessagesize 123*a5061eceSAdrien Destugues4. assign a temporary pointer the value of desktop_private::dragmessage 124*a5061eceSAdrien Destugues5. release the draglock 125*a5061eceSAdrien Destugues6. return the temporary pointer 126*a5061eceSAdrien Destugues 127*a5061eceSAdrien Destuguesvoid empty_drag\_ message(void) 128*a5061eceSAdrien Destugues------------------------------- 129*a5061eceSAdrien Destugues 130*a5061eceSAdrien DestuguesThis empties the current drag message from use and allows for other 131*a5061eceSAdrien Destuguesmessages to be assigned. 132*a5061eceSAdrien Destugues 133*a5061eceSAdrien Destugues 134*a5061eceSAdrien Destugues1. acquire draglock 135*a5061eceSAdrien Destugues2. assign 0 to desktop_private::dragmessagesize and set 136*a5061eceSAdrien Destugues desktop_private::dragmessage to NULL 137*a5061eceSAdrien Destugues3. release draglock 138*a5061eceSAdrien Destugues 139*a5061eceSAdrien DestuguesNamespaces 140*a5061eceSAdrien Destugues========== 141*a5061eceSAdrien Destugues 142*a5061eceSAdrien Destuguesdesktop_private 143*a5061eceSAdrien Destugues--------------- 144*a5061eceSAdrien Destugues 145*a5061eceSAdrien Destugues- int8 \*dragmessage 146*a5061eceSAdrien Destugues- int32 dragmessagesize 147*a5061eceSAdrien Destugues- sem_id draglock 148