Sun Microsystems Logo
Products and Services
 
Support and Training
 
 

Previous Previous     Contents     Index     Next Next
Chapter 6

Integrating with the Workspace Manager

The Workspace Manager provides the means for an application to manage its windows within the desktop's multiple workspace environment. An application can perform four major tasks by communicating with the Workspace Manager:

  • Place the application's windows in one or more workspaces

  • Identify the workspaces in which the application's windows are located

  • Prevent the application's windows from moving to another workspace

  • Monitor changes to the workspaces, such as when a user switches from one workspace to another

Normally, Session Manager will get your application main window into the right workspace without your intervention. However, if your application has multiple top-level windows, you should use the Workspace Manager API to figure out where your windows are and save this data as part of your session state.

See Chapter 4, Integrating with Session Manager for details on saving application-related information between sessions.

Communicating with the Workspace Manager

An application communicates with the Workspace Manager by using functions provided by the desktop. These functions allow you to quickly and easily perform a variety of tasks associated with workspace management. The following is a list of these functions:

  • DtWsmAddCurrentWorkspaceCallback()

  • DtWsmAddWorkspaceFunctions ()

  • DtWsmAddWorkspaceModifiedCallback ()

  • DtWsmFreeWorkspaceInfo ()

  • DtWsmGetCurrentBackdropWindows ()

  • DtWsmGetCurrentWorkspace ()

  • DtWsmGetWorkspaceInfo ()

  • DtWsmGetWorkspaceList ()

  • DtWsmGetWorkspacesOccupied ()

  • DtWsmOccupyAllWorkspaces ()

  • DtWsmRemoveWorkspaceCallback ()

  • DtWsmRemoveWorkspaceFunctions ()

  • DtWsmSetCurrentWorkspace ()

  • DtWsmSetWorkspacesOccupied()

Segments of code from two demo programs (occupy.c and wsinfo.c) illustrate the use of these functions. Listings for occupy.c, wsinfo.c, and makefiles for several brands of workstations are in the directory /usr/dt/examples/dtwsm. See the applicable man page for more information on each function.

Placing an Application Window in Workspaces

An application can place its windows in any or all of the existing workspaces. DtWsmOccupyAllWorkspaces() places the windows in all currently defined workspaces, while DtWsmSetWorkspacesOccupied() places the windows in all workspaces named in a list that is passed to the function.

ProcedureTo Place an Application Window in All Workspaces

  • Use DtWsmOccupyAllWorkspaces().

    In occupy.c, the callback allWsCB() for the Occupy All Workspaces push button calls this function.

    DtWsmOccupyAllWorkspaces (XtDisplay(toplevel),
                               XtWindow(toplevel));

    where:

    • XtDisplay(toplevel) is the X display.

    • XtWindow(toplevel) is the window to be placed in all workspaces.

See the DtWsmOccupyAllWorkspaces() man page for more information on this function.

Previous Previous     Contents     Index     Next Next
 

Updated: 2003-09-29, 21:43