This commit does three thing: 1. Sets appropriate bits on source files 2. Tells imake to build them as script files, not data files 3. Remove broken examples based on unused code
156 lines
5.4 KiB
Plaintext
156 lines
5.4 KiB
Plaintext
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
|
XCOMM $XConsortium: DtWsTest1.src /main/3 1996/04/23 20:18:06 drk $
|
|
|
|
XCOMM #########################################################################
|
|
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
|
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
|
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
|
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
|
XCOMM Novell, Inc.
|
|
XCOMM #########################################################################
|
|
|
|
|
|
XCOMM
|
|
XCOMM This sample shell script demonstrates how to interact with the workspace
|
|
XCOMM manager. It demonstrates the following capabilities:
|
|
XCOMM
|
|
XCOMM 1) How to query which workspaces the widgets currently reside it.
|
|
XCOMM 2) How to set the current workspace.
|
|
XCOMM 3) How to be notified when the current workspace changes.
|
|
XCOMM
|
|
|
|
|
|
integer wsCount
|
|
|
|
XCOMM Pushbutton Callback: This function asks the workspace manager to change
|
|
XCOMM to the workspace indicated by $1; $1 is an X atom
|
|
XCOMM which identifies the new workspace. At some point
|
|
XCOMM after our request to the workspace manager, the
|
|
XCOMM workspace manager will activate our WsCB function,
|
|
XCOMM letting us know that the change has actually taken
|
|
XCOMM place.
|
|
SetWorkspace()
|
|
{
|
|
echo
|
|
if DtWsmSetCurrentWorkspace $TOPLEVEL $1; then
|
|
echo "Changing to new workspace"
|
|
else
|
|
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $1
|
|
echo "Unable to Change to workspace " $NAME
|
|
fi
|
|
}
|
|
|
|
XCOMM Workspace Changed Callback: This function is invoked whenever the workspace
|
|
XCOMM manager changes workspaces. It will simply
|
|
XCOMM query the 'name' of the new workspace, and
|
|
XCOMM echo it outl
|
|
WsCB()
|
|
{
|
|
DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
|
NEW_ATOM
|
|
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $NEW_ATOM
|
|
echo "Change to workspace complete " $NAME "("$NEW_ATOM")"
|
|
}
|
|
|
|
XCOMM ###################### Create the Main UI ###############################
|
|
|
|
XtInitialize TOPLEVEL dtWsTest DtWsTest "$0" "$@"
|
|
XtSetValues $TOPLEVEL allowShellResize:True
|
|
|
|
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
|
|
XtSetValues $DA height:200 width:200
|
|
|
|
XtRealizeWidget $TOPLEVEL
|
|
XSync $(XtDisplay "-" $TOPLEVEL) False
|
|
|
|
XtCreateApplicationShell TOPLEVEL2 DtWsTesta TopLevelShell
|
|
|
|
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
|
orientation:HORIZONTAL \
|
|
packing:PACK_COLUMN
|
|
|
|
XCOMM Get a list of all of the workspaces, and create a pushbutton for each one.
|
|
XCOMM When a pushbutton is activated, it will ask the workspace manager to
|
|
XCOMM change to the indicated workspace.
|
|
oldIF=$IFS
|
|
if DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
|
WS_LIST;
|
|
then
|
|
IFS=,
|
|
wsCount=0
|
|
for item in $WS_LIST;
|
|
do
|
|
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
|
label="Set Current Workspace to "$NAME
|
|
XtCreateManagedWidget ITEM $item XmPushButton $RC \
|
|
labelString:$label
|
|
XtAddCallback $ITEM activateCallback "SetWorkspace $item"
|
|
wsCount=$wsCount+1
|
|
done
|
|
IFS=$oldIFS
|
|
else
|
|
echo "Unable to get workspace list"
|
|
exit -1
|
|
fi
|
|
|
|
XtSetValues $RC numColumns:$wsCount
|
|
XtRealizeWidget $TOPLEVEL2
|
|
XSync $(XtDisplay "-" $TOPLEVEL) False
|
|
|
|
XCOMM The following block queries the initial set of workspaces occupied by
|
|
XCOMM this shell script; this list is printed out. Next, it will ask the
|
|
XCOMM workspace manager to move the shell script windows into all workspaces.
|
|
XCOMM Lastly, it will again ask the workspace manager for the list of
|
|
XCOMM workspaces occupied by the shell script windows, and will again print
|
|
XCOMM out the list.
|
|
if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XtWindow "-" $TOPLEVEL) \
|
|
CURRENT_WS_LIST ;
|
|
then
|
|
echo "Initial workspaces occupied:"
|
|
for item in $CURRENT_WS_LIST;
|
|
do
|
|
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
|
echo " "$NAME
|
|
done
|
|
|
|
DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
|
WS_LIST
|
|
|
|
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XtWindow "-" $TOPLEVEL) \
|
|
$WS_LIST
|
|
|
|
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL2) \
|
|
$(XtWindow "-" $TOPLEVEL2) \
|
|
$WS_LIST
|
|
else
|
|
echo "Unable to get current list of occupied workspaces"
|
|
echo -2
|
|
fi
|
|
|
|
XSync $(XtDisplay "-" $TOPLEVEL) False
|
|
|
|
XCOMM Print the new list of workspaces occupied
|
|
DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
|
$(XtWindow "-" $TOPLEVEL) \
|
|
CURRENT_WS_LIST
|
|
|
|
echo "After modification, workspaces occupied:"
|
|
IFS=,
|
|
for item in $CURRENT_WS_LIST;
|
|
do
|
|
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
|
echo " "$NAME
|
|
done
|
|
IFS=$oldIFS
|
|
echo ""
|
|
|
|
XCOMM Add a callback to be notified whenever the workspace changes.
|
|
DtWsmAddCurrentWorkspaceCallback HANDLE1 $TOPLEVEL WsCB
|
|
|
|
XtMainLoop
|