2002-09-20 03:56:12 +04:00
< HTML >
< HEAD >
< TITLE > Desktop.htm< / TITLE >
< style type = "text/css" >
<!--
.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
.Text-Background {background-color: rgb(255,255,255)}
.GR-Default {}
.Body {margin: 0px}
.Footer {margin: 0px}
.Header {margin: 0px}
.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
-->
< / style >
< / HEAD >
< BODY BGCOLOR = "#ffffff" >
< DIV class = "sheet" id = "Sheet 1" >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Title" > Desktop module< / span > < span style = "color: rgb(0,0,0); font-size: 24pt" > < / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
< / P >
< P class = "Body" style = "margin: 0px" > There are no globally accessible objects in this section of code, but many function definitions to work with workspaces, screen attributes, and other such things. These functions work with the private desktop classes Screen and Workspace.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< / P >
< P class = "Body" style = "margin: 0px" >
< HR >
< / P >
< P class = "Body" style = "margin: 0px" > Global Functions< / P >
< P class = "Body" style = "margin: 0px" > < BR >
void InitDesktop(void)< / P >
< P class = "Body" style = "margin: 0px" > void ShutdownDesktop(void)< / P >
< P class = "Body" style = "margin: 0px" > < BR >
void AddWorkspace(int32 index=-1)< / P >
< P class = "Body" style = "margin: 0px" > void DeleteWorkspace(int32 index)< / P >
< P class = "Body" style = "margin: 0px" > int32 CountWorkspaces(void)< / P >
< P class = "Body" style = "margin: 0px" > void SetWorkspaceCount(int32 count)< / P >
< P class = "Body" style = "margin: 0px" > int32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > void SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > < BR >
void SetScreen(screen_id id)< / P >
< P class = "Body" style = "margin: 0px" > int32 CountScreens(void)< / P >
< P class = "Body" style = "margin: 0px" > screen_id ActiveScreen(void)< / P >
< P class = "Body" style = "margin: 0px" > DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > < BR >
void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > void RemoveWindowFromDesktop(ServerWindow *win)< / P >
< P class = "Body" style = "margin: 0px" > ServerWindow *GetActiveWindow(void)< / P >
< P class = "Body" style = "margin: 0px" > void SetActiveWindow(ServerWindow *win)< / P >
2002-12-08 00:39:48 +03:00
< P class = "Body" style = "margin: 0px" > Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id s< / P >
< P class = "Body" style = "margin: 0px" > screen=B_MAIN_SCREEN_ID)< / P >
< P class = "Body" style = "margin: 0px" > < BR >
void set_drag_message(int32 size, int8 *flattened)< / P >
< P class = "Body" style = "margin: 0px" > int8* get_drag_message(int32 *size)< / P >
< P class = "Body" style = "margin: 0px" > void empty_drag_ message(void)< / P >
< P class = "Body" style = "margin: 0px" > < BR >
Namespaces< / P >
< P class = "Body" style = "margin: 0px" > < BR >
desktop_private {< / P >
< P class = "Body" style = "margin: 0px" > int8 *dragmessage< / P >
< P class = "Body" style = "margin: 0px" > int32 dragmessagesize< / P >
< P class = "Body" style = "margin: 0px" > sem_id draglock< / P >
< P class = "Body" style = "margin: 0px" > }< / P >
2002-09-20 03:56:12 +04:00
< P class = "Body" style = "margin: 0px" > < BR >
< HR >
< / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void InitDesktop(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Sets up all the stuff necessary for the system's desktop.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Create a graphics module list by looping through allocation and initialization of display modules until failure is returned. If app_server exists, just create a ViewDriver module< / P >
< P class = "Body" style = "margin: 0px" > 2) Create and populate Screen list, pointing each Screen instance to its Driver instance< / P >
< P class = "Body" style = "margin: 0px" > 3) Create layer and workspace locks< / P >
< P class = "Body" style = "margin: 0px" > 4) Set screen 0 to active< / P >
2002-12-08 00:39:48 +03:00
< P class = "Body" style = "margin: 0px" > 5) Create the desktop_private::draglock semaphore< / P >
2002-09-20 03:56:12 +04:00
< P class = "Body" style = "margin: 0px" > < BR >
2002-12-08 00:39:48 +03:00
< BR >
2002-09-20 03:56:12 +04:00
< span class = "OBOS-Function-Def" > void ShutdownDesktop(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Undoes everything done in InitDesktop().< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Delete all locks< / P >
< P class = "Body" style = "margin: 0px" > 2) Delete all screens in the list< / P >
2002-12-08 00:39:48 +03:00
< P class = "Body" style = "margin: 0px" > 3) Delete the desktop_private::draglock semaphore< / P >
< P class = "Body" style = "margin: 0px" > 4) If desktop_private::dragmessage is non-NULL, delete it.< / P >
2002-09-20 03:56:12 +04:00
< P class = "Body" style = "margin: 0px" > < BR >
2002-12-08 00:39:48 +03:00
< BR >
2002-09-20 03:56:12 +04:00
< span class = "OBOS-Function-Def" > void AddWorkspace(int32 index=-1)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void DeleteWorkspace(int32 index)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > int32 CountWorkspaces(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void SetWorkspaceCount(int32 count)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > int32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Each of these calls the appropriate method in the Screen class. Add and Delete workspace functions operate on all screens.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
2002-12-08 00:39:48 +03:00
< BR >
2002-09-20 03:56:12 +04:00
< span class = "OBOS-Function-Def" > void SetScreen(screen_id id)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > int32 CountScreens(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > screen_id ActiveScreen(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Each of these calls operate on the objects in the Screen list, calling methods as appropriate.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
2002-12-08 00:39:48 +03:00
< BR >
2002-09-20 03:56:12 +04:00
< span class = "OBOS-Function-Def" > void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void RemoveWindowFromDesktop(ServerWindow *win)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > ServerWindow *GetActiveWindow(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > void SetActiveWindow(ServerWindow *win)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < span class = "OBOS-Function-Def" > Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
These operate on the layer structure in the active Screen object, calling methods as appropriate.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
2002-12-08 00:39:48 +03:00
< BR >
< span class = "OBOS-Function-Def" > void set_drag_message(int32 size, int8 *flattened)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
This assigns a BMessage in its flattened state to the internal storage. Only one message can be stored at a time. Once an assignment is made, another cannot be made until the current one is emptied. If additional calls are made while there is a drag message assigned, the new assignment will not be made. Note that this merely passes a pointer around. No copies are made and the caller is responsible for freeing any allocated objects from the heap.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) Acquire the draglock< / P >
< P class = "Body" style = "margin: 0px" > 2) release the lock and return if winborder_private::dragmessage is non-NULL< / P >
< P class = "Body" style = "margin: 0px" > 3) Assign parameters to the private variables< / P >
< P class = "Body" style = "margin: 0px" > 4) Release the draglock< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > int8* get_drag_message(int32 *size)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
Retrieve the current drag message in use. This function will fail if a NULL pointer is passed to it. Note that this does not free the current drag message from use. The size of the flattened message is stored in the size parameter. Note that if there is no message in use, it will return NULL and set size to 0.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) return NULL if size pointer is NULL< / P >
< P class = "Body" style = "margin: 0px" > 2) acquire the draglock< / P >
< P class = "Body" style = "margin: 0px" > 3) set value of size parameter to winborder_private::dragmessagesize< / P >
< P class = "Body" style = "margin: 0px" > 4) assign a temporary pointer the value of desktop_private::dragmessage< / P >
< P class = "Body" style = "margin: 0px" > 5) release the draglock< / P >
< P class = "Body" style = "margin: 0px" > 6) return the temporary pointer< / P >
< P class = "Body" style = "margin: 0px" > < BR >
< BR >
< span class = "OBOS-Function-Def" > void empty_drag_ message(void)< / span > < / P >
< P class = "Body" style = "margin: 0px" > < BR >
This empties the current drag message from use and allows for other messages to be assigned.< / P >
< P class = "Body" style = "margin: 0px" > < BR >
1) acquire draglock< / P >
< P class = "Body" style = "margin: 0px" > 2) assign 0 to desktop_private::dragmessagesize and set desktop_private::dragmessage to NULL< / P >
< P class = "Body" style = "margin: 0px" > 3) release draglock< / P >
2002-09-20 03:56:12 +04:00
< DIV class = "layer" id = "Layer 1" >
< / DIV >
< / DIV >
< / BODY >
< / HTML >