# Desktop.htm

Desktop module

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.

Global Functions

void InitDesktop(void)

void ShutdownDesktop(void)

void AddWorkspace(int32 index=-1)

void DeleteWorkspace(int32 index)

int32 CountWorkspaces(void)

void SetWorkspaceCount(int32 count)

int32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID)

void SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID)

void SetScreen(screen_id id)

int32 CountScreens(void)

screen_id ActiveScreen(void)

DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)

status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)

void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)

void RemoveWindowFromDesktop(ServerWindow *win)

ServerWindow *GetActiveWindow(void)

void SetActiveWindow(ServerWindow *win)

Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)

void InitDesktop(void)

Sets up all the stuff necessary for the system's desktop.

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

2) Create and populate Screen list, pointing each Screen instance to its Driver instance

3) Create layer and workspace locks

4) Set screen 0 to active

void ShutdownDesktop(void)

Undoes everything done in InitDesktop().

1) Delete all locks

2) Delete all screens in the list

void AddWorkspace(int32 index=-1)

void DeleteWorkspace(int32 index)

int32 CountWorkspaces(void)

void SetWorkspaceCount(int32 count)

int32 CurrentWorkspace(screen_id screen=B_MAIN_SCREEN_ID)

void SetWorkspace(int32 workspace, screen_id screen=B_MAIN_SCREEN_ID)

Each of these calls the appropriate method in the Screen class. Add and Delete workspace functions operate on all screens.

void SetScreen(screen_id id)

int32 CountScreens(void)

screen_id ActiveScreen(void)

DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)

status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)

Each of these calls operate on the objects in the Screen list, calling methods as appropriate.

void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)

void RemoveWindowFromDesktop(ServerWindow *win)

ServerWindow *GetActiveWindow(void)

void SetActiveWindow(ServerWindow *win)

Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)

These operate on the layer structure in the active Screen object, calling methods as appropriate.