Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
/* $XConsortium: README /main/2 1996/07/15 14:31:02 drk $ */
==============================================================
File: README
Directory: /usr/lib/X11/dt/examples/Dtwm
Version: $Revision: /main/2 $
==============================================================
The files in this subdirectory are to demonstrate a
variety of Workspace Manager and menu configurations.
vertical.rc - contains dtwm configuration information for
a vertical front panel.
vertical.defs - contains resource definitions for the above.
box.rc - contains dtwm configuration information for
a multi-row, compact front panel.
box.defs - contains resource definitions for the above.
Before experimenting, you may wish to save your current
environment so that you can restore it later.
1. Press the Style Manager button in the front panel
to start the Style Manager (the button in the bottom
row that looks like a color palette).
2. Press the "Startup" button in the Style Manager to
access the "Session Startup" window.
3. Press the "Ask me at Logout" button so that you
have a choice before logging out.
4. Press the "Set Home Session" button to save your
current settings as your home session.
5. Press the "OK" button to continue the operation.
6. When the hourglass pointer disappears, the operation
is completed. Press the "OK" button to dismiss the
"Session Startup" window.
After saving your home session, you can begin experimenting:
1. Merge the desired 'defs' file into your display environment.
For example:
xrdb -merge vertical.defs
2. Check to see if you have a file called 'dtwmrc' in your
.dt directory. If so, save it.
ls $HOME/.dt
cp $HOME/.dt/dtwmrc $HOME/.dt/dtwmrc.sav
3. Copy the 'rc' file into your .dt directory, renaming it
'dtwmrc'. For example:
cp vertical.rc $HOME/.dt/dtwmrc
4. Restart dtwm:
With the pointer over the workspace background,
press mouse button 1 to display the Workspace Menu.
Select "Restart Dtwm..." from the Workspace Menu.
5. To restore your original environment:
a. Remove the dtwmrc file, and copy back the original, if
you saved one.
rm $HOME/.dt/dtwmrc
cp $HOME/.dt/dtwmrc.sav $HOME/.dt/dtwmrc
b. Log out and log back in again using the Home Session
you saved:
- Move the pointer to the front panel and press the
Exit button (the button that has the busy light).
- Select "Restore Home" from the "Logout Confirmation"
window.
- Log back in again.
6. To save one of these Workspace Managers as your own, simply
select "Restart Current" when you log out instead of
"Restore Home".
Note:
------
You may want to change back to your original Style
Manager startup configuration by selecting "Resume current
session" from the Startup dialog.
==============================================================

View File

@@ -0,0 +1,158 @@
!######################################################################
!#
!# File: box.defs
!#
!# Directory: /usr/lib/X11/dt/examples/Dtwm
!#
!# Description: Sample Application Defaults for the
!# HP DT Window Manager
!# (Tuned for HighResHighColor screens)
!#
!# Hewlett-Packard Visual User Environment, Version 2.1
!#
!# Copyright (c) 1990 Hewlett-Packard Company
!#
!# $XConsortium: box.defs /main/2 1996/07/18 15:27:36 drk $
!#
!######################################################################
!#########
!#
!# This dtwm resource file is used in conjunction with the
!# "box.rc" file to create a box-shaped front panel in the upper
!# right corner of the screen.
!#
!# Merge these resources into your display environment
!# using the command:
!#
!# xrdb -merge box.defs
!#
!# Then, restart the window manager for the changes to take effect.
!#
!#########
!#########
!#
!# Specify the name of the front panel description within the RC file.
!#
!#########
dtwm*frontPanel*name: BoxedFrontPanel
!#########
!#
!# The following resources set the desired background pixmaps for
!# the rows in the front panel.
!#
!#########
dtwm*frontPanel*Top*rowBackgroundPixmap: ribbing.l.bm
dtwm*frontPanel*Terminals*rowBackgroundPixmap: ribbing.l.bm
dtwm*frontPanel*Middle*rowBackgroundPixmap: 50_foreground
dtwm*frontPanel*Bottom*rowBackgroundPixmap: 50_foreground
!#########
!#
!# The following resources help create a tightly packed front panel.
!#
!#########
dtwm*frontPanel*wsButtonBorder: 0
dtwm*frontPanel*wsButtonSpacing: 0
dtwm*frontPanel*wsButtonShadowThickness: 3
dtwm*frontPanel*highlightThickness: 0
!#########
!#
!# Here's where the workspace names are specified. The number
!# of workspaces is determined by the number of names.
!#
!#########
dtwm*workspaceList: Main Two Three Four
!#########
!#
!# This resource removes the backdrop from the "Main" workspace
!# to expose the real X root window.
!#
!#########
dtwm*Main*backdrop*image: none
!#########
!#
!# These optional resources simply make the entire front panel a
!# single color (which is the same as the inactive window frame color).
!#
!#########
dtwm*frontPanel*Top*colorSetId: 2
dtwm*frontPanel*Middle*colorSetId: 2
dtwm*frontPanel*Terminals*colorSetId: 2
dtwm*frontPanel*Bottom*colorSetId: 2
!#########
!#
!# This resource puts the front panel in the upper-right corner of the
!# screen.
!#
!#########
dtwm*geometry: -1+1
!#########
!#
!# This resource makes for compact window frames.
!#########
dtwm*resizeBorderWidth: 7
!#########
!#
!# These resources make for a slighly different date display.
!#
!#########
dtwm*dtwmdate*format: @(#) box.defs 1.11@(#)n%b %.1d
dtwm*frontPanel*dtwmdate*fontList1: system16
dtwm*frontPanel*dtwmdate*fontList2: system23
!#########
!#
!# Enable "pointer focus" and "auto raise".
!#
!#########
dtwm*keyboardFocusPolicy: pointer
dtwm*focusAutoRaise: True
!#########
!#
!# This resource must be specified for the customized window menu to
!# be used.
!#
!#########
dtwm*windowMenu: DtWindowMenu
!#########
!#
!# Font to use in the workspace switch
!#
!#########
dtwm*fontList: system17
!#########
!#
!# These names add window and icon title to the terminal windows started
!# from the "Terminals" row of the front panel. (You can also add
!# machine-specific resources like geometry, colors, etc.) Replace the
!# hostnames with the ones you use in the "Terminals" row of the
!# front panel description.
!#
!#########
Host1*Title: hostname1
Host1*iconName: hostname1
Host2*Title: hostname2
Host2*iconName: hostname2
Host3*Title: hostname3
Host3*iconName: hostname3
Host4*Title: hostname4
Host4*iconName: hostname4
Host5*Title: hostname5
Host5*iconName: hostname5
Host6*Title: hostname6
Host6*iconName: hostname6
Console*Title: Console
Console*iconName: Console
!################################# eof ##############################

View File

@@ -0,0 +1,236 @@
#################################################################
#
# File: box.rc
#
# Directory: /usr/lib/X11/dt/examples/Dtwm
#
# Description: Sample configuration file (RC file) for the
# HP DT Window Manager
#
# Hewlett-Packard Visual User Environment, Version 2.1
#
# Copyright (c) 1990 Hewlett-Packard Company
#
# $XConsortium: box.rc /main/2 1996/07/18 15:27:59 drk $
#
######################################################################
#####
#
# Front Panel Specification
#
####
FrontPanel BoxedFrontPanel # Tuned for displays of 1280 pixels by
# 1024 pixels.
{
Row Top
{
Logo [P C Q] @logo.l.bm 120x28 f.next_workspace
Help [P] @help.l.bm 96 f.action BROWSE_HELP
dtstyle [T] @style.l.bm 96 f.action STYLE
Lock [T] @lock.l.bm 96 f.action LOCK_DISPLAY
dtwmbusy [P C] @exit.l.bm @exit02.l.bm =97 =12x8+42+10 f.action EXIT_SESSION
}
##########
#
# This row of toggle buttons create logins to remote hosts. If a window with
# the same name already exists, it is brought into the current workspace
# and raised to the top of the window stack. (Copy the file
# /usr/lib/X11/bitmaps/Dtwm/term.l.bm and create a bitmap file for each
# machine. We simply put the first letter of the machine name in the
# terminal screen portion of the image.) Replace these machine names with
# the actual names of computers that you use regularly.
#
# Note that the "f.exec" dtwm function will NOT cause the busy
# light to blink; only the "f.action" dtwm function causes the
# blinking.
#
##########
Row Terminals
{
Host1 [T] @term.l.bm 65x28 f.exec "hpterm -name Host1 -e rlogin hostname1"
Host2 [T] @term.l.bm 65 f.exec "hpterm -name Host2 -e rlogin hostname2"
Host3 [T] @term.l.bm 65 f.exec "hpterm -name Host3 -e rlogin hostname3"
Host4 [T] @term.l.bm 65 f.exec "hpterm -name Host4 -e rlogin hostname4"
Host5 [T] @term.l.bm 65 f.exec "hpterm -name Host5 -e rlogin hostname5"
Host6 [T] @term.l.bm 65 f.exec "hpterm -name Host6 -e rlogin hostname6"
Console [T] @term.l.bm 107 f.exec "hpterm -name Console -C"
}
Row Middle
{
dtwmswtch 364x65
dtwmclock 67x65+4+4
dtwmdate 82x65+5+5
}
Row Bottom
{
Home [P C] @home.m.bm =72x65+0+5 f.action BROWSE_HOME
Applications [P C] @tools.m.bm =72 f.action BROWSE_TOOLS
Mail [T C I Z] @mail.m.bm @mail02.m.bm 64 f.exec "hpterm -name Mail -e elm" f.action MAIL_A_FILE
Print [P C Z] @print.m.bm 70 f.action PRINTER_INFO f.action PRINT
Trash [P C Z] @trash.l.bm 70 f.action SHOW_TRASH f.action THROW_AWAY
dtload [T C] 153+5+5
}
}
##############################
# Drop Effects (Animation) #
##############################
DropEffects Mail
{
mail.m.bm 80
mail02.m.bm 80
mail.m.bm 80
mail02.m.bm 80
}
DropEffects Print
{
print02.m.bm 30
print03.m.bm
print04.m.bm
print05.m.bm
print06.m.bm
print07.m.bm
print08.m.bm
print09.m.bm
print10.m.bm
print11.m.bm
print12.m.bm
print13.m.bm
print14.m.bm
print.m.bm
print02.m.bm 30
print03.m.bm
print04.m.bm
print05.m.bm
print06.m.bm
print07.m.bm
print08.m.bm
print09.m.bm
print10.m.bm
print11.m.bm
print12.m.bm
print13.m.bm
print14.m.bm
print.m.bm
}
DropEffects Trash
{
trash11.l.bm 10
trash10.l.bm
trash09.l.bm
trash08.l.bm
trash07.l.bm
trash06.l.bm
trash05.l.bm
trash04.l.bm
trash03.l.bm
trash02.l.bm
trash03.l.bm
trash04.l.bm
trash05.l.bm
trash06.l.bm
trash07.l.bm
trash08.l.bm
trash09.l.bm
trash10.l.bm
trash11.l.bm
trash.l.bm
}
#############################
# Root Menu Specification #
#############################
Menu DtRootMenu
{
"Workspace Menu" f.title
"Shuffle Up" f.circle_up
"Shuffle Down" f.circle_down
"Refresh Screen" f.refresh
no-label f.separator
"Toggle Front Panel" f.toggle_frontpanel
"Rename Workspace" f.workspace_rename
"Pack Icons" f.pack_icons
"Restart Dtwm ..." f.restart
no-label f.separator
"Log out..." f.action EXIT_SESSION
}
###############################
# Window Menu Specification #
###############################
Menu DtWindowMenu
{
"Restore" _R Alt<Key>F5 f.normalize
"Move" _M Alt<Key>F7 f.move
"Size" _S Alt<Key>F8 f.resize
"Minimize" _n Alt<Key>F9 f.minimize
"Maximize" _x Alt<Key>F10 f.maximize
"Lower" _L Alt<Key>F3 f.lower
no-label f.separator
"Occupy..." _O Alt<Key>O f.workspace_presence
"Occupy all" _a Alt Shift<Key>O f.occupy_all
no-label f.separator
"Remove from WS" _e Alt Shift <Key>F4 f.remove
"Close" _C Alt<Key>F4 f.kill
}
##############################
# Key Binding Descriptions #
##############################
Keys DtKeyBindings
{
<Key>Menu root f.toggle_frontpanel
Meta<Key>Menu root|icon|window f.toggle_frontpanel
Shift<Key>Escape icon|window f.post_wmenu
Meta<Key>space icon|window f.post_wmenu
Meta<Key>Tab root|icon|window f.next_key
Meta Shift<Key>Tab root|icon|window f.prev_key
Meta<Key>Escape root|icon|window f.next_key
Meta Shift<Key>Escape root|icon|window f.prev_key
Meta Ctrl Shift<Key>exclam root|icon|window f.set_behavior
}
#################################
# Button Binding Descriptions #
#################################
Buttons DtButtonBindings
{
### Button 1 ###
<Btn1Click> root f.circle_up
<Btn1Click> frame|icon f.raise_lower
<Btn1Click2> title f.maximize
# Meta<Btn1Down> icon|window f.move
### Button 2 ###
<Btn2Down> frame|icon f.move
<Btn2Click> root f.next_workspace
Shift<Btn2Click> root f.prev_workspace
Meta<Btn2Down> root f.toggle_frontpanel
Meta<Btn2Down> icon|window f.move
### Button 3 ###
<Btn3Down> root f.menu DtRootMenu
<Btn3Down> frame|icon f.post_wmenu
Meta<Btn3Down> frame|window f.minimize
}
#
# End of dtwm Resource Description File
#
##################### eof #########################

View File

@@ -0,0 +1,48 @@
# $XConsortium: Makefile.hp /main/2 1996/05/13 11:33:03 drk $
##########################################################################
#
# Makefile for occupy.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = occupy
SOURCES = occupy.c
OBJECTS = occupy.o
CFLAGS = +Obb2000 -Aa -D_HPUX_SOURCE
CDEBUGFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/include/X11R5
EXTRA_INCLUDES =
INCLUDES = $(DTINCLUDE) $(X11INCLUDE) $(EXTRA_INCLUDES)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/lib/X11R5 -lXt
X11LIB = -L/usr/lib/X11R5 -lX11
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) $(X11LIB)
LDFLAGS =
.c.o:
cc -c $(CFLAGS) $(CDEBUGFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,47 @@
# $XConsortium: Makefile.ibm /main/2 1996/05/13 11:33:22 drk $
##########################################################################
#
# Makefile for occupy.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = occupy
SOURCES = occupy.c
OBJECTS = occupy.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/include
EXTRA_INCLUDES =
INCLUDES = $(DTINCLUDE) $(X11INCLUDE) $(EXTRA_INCLUDES)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/lib -lXt
X11LIB = -L/usr/lib -lX11
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) $(X11LIB)
LDFLAGS =
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,50 @@
# $XConsortium: Makefile.sun /main/2 1996/05/13 11:33:40 drk $
##########################################################################
#
# Makefile for occupy.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = occupy
SOURCES = occupy.c
OBJECTS = occupy.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/openwin/include
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/openwin/lib -lXt
X11LIB = -L/usr/openwin/lib -lX11
CPLUSPLUS = -L/usr/lib -lC
EXTRA_LIBS = -L/usr/openwin/lib -lgen
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) \
$(X11LIB) $(CPLUSPLUS) $(EXTRA_LIBS)
LDFLAGS = -R$(CDE_INSTALLATION_TOP)/lib:/usr/openwin/lib
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,51 @@
# $XConsortium: Makefile.usl /main/2 1996/05/13 11:33:55 drk $
##########################################################################
#
# Makefile for occupy.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = occupy
SOURCES = occupy.c
OBJECTS = occupy.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
#XMINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/X/include
INCLUDES = $(DTINCLUDE) $(XMINCLUDE) $(X11INCLUDE)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/X/lib -lXt
X11LIB = -L/usr/X/lib -lX11
CPLUSPLUS = -L/usr/add-on/C++/lib -lC
EXTRA_LIBS = -L/usr/lib -lgen -lnsl -lresolv -lsocket -lXIM \
-L/usr/add-on/C++/lib -lC
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) \
$(X11LIB) $(CPLUSPLUS) $(EXTRA_LIBS)
LDFLAGS =
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,458 @@
/* $XConsortium: occupy.c /main/3 1996/11/05 12:17:48 mustafa $ */
/***********************************************************************
* CDE Developer's Conference Sample Program
*
* File: occupy.c
*
* Purpose:
* Demonstrate the CDE Workspace API. This file uses:
*
* DtWsmGetWorkspacesOccupied
* DtWsmSetWorkspacesOccupied
* DtWsmOccupyAllWorkspaces
*
*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
* Novell, Inc.
* ALL RIGHTS RESERVED
*
***********************************************************************/
/*
* include files
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/ToggleB.h>
#include <Xm/TextF.h>
#include <Dt/Wsm.h>
/*
* functions defined in this program
*/
void main();
void quitCB();
void setCB();
void showCB();
void wsCB();
void allWsCB();
void SetupWorkspaceButtons ();
void ShowWorkspaceOccupancy();
void SetWorkspaceOccupancy();
/*
* global variables
*/
XmString xms; /* button label pointer for compound string */
Widget toplevel; /* Shell widget */
Widget wChildren [20];
Widget *wWs;
Atom *paWsSet = NULL;
Boolean *pbOccupy;
unsigned long numWorkspaces;
Atom *paWs;
/*
* button assignments
*/
#define QUIT_BUTTON (wChildren[0])
#define SEPARATOR (wChildren[1])
#define SET_BUTTON (wChildren[2])
#define SHOW_BUTTON (wChildren[3])
#define ALL_WS_BUTTON (wChildren[4])
#define NUM_CHILDREN 5
/*-------------------------------------------------------------
* main - main logic for program
*/
void main (argc,argv)
int argc;
char **argv;
{
Widget form;
Widget top;
XtAppContext app_context;
Arg args[10];
register int n;
register int i;
/*
* initialize toolkit
*/
n = 0;
XtSetArg (args[n], XmNallowShellResize, True); n++;
toplevel = XtAppInitialize (&app_context, "XMDemos", NULL, 0,
&argc, argv, NULL, args, n);
/*
* manager widget
*/
n = 0;
form = XmCreateForm (toplevel, "form", args, n);
XtManageChild (form);
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Quit");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
/*
* create button
*/
top = QUIT_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
/*
* add callback
*/
XtAddCallback (QUIT_BUTTON, XmNactivateCallback, quitCB, NULL);
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Set Occupancy");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create button
*/
top = SET_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
/*
* add callback
*/
XtAddCallback (SET_BUTTON, XmNactivateCallback, setCB, NULL);
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Occupy All Workspaces");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create button
*/
top = ALL_WS_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
/*
* add callback
*/
XtAddCallback (ALL_WS_BUTTON, XmNactivateCallback, allWsCB, NULL);
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Show Occupancy");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create button
*/
top = SHOW_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
/*
* add callback
*/
XtAddCallback (SHOW_BUTTON, XmNactivateCallback, showCB, NULL);
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create separator
*/
top = SEPARATOR = (Widget)
XmCreateSeparatorGadget (form, "separator", args, n);
/*
* set up workspace buttons
*/
SetupWorkspaceButtons (form, top);
/*
* manage children
*/
XtManageChildren (wChildren, NUM_CHILDREN);
XtManageChildren (wWs, numWorkspaces);
/*
* realize widgets
*/
XtRealizeWidget (toplevel);
/*
* set up initial workspace occupancy info
*/
pbOccupy = (Boolean *) XtMalloc (numWorkspaces * sizeof (Boolean));
for (i=0; i<numWorkspaces; i++)
{
pbOccupy[i] = False;
}
ShowWorkspaceOccupancy ();
/*
* process events
*/
XtAppMainLoop (app_context);
}
/*-------------------------------------------------------------
* Create a set of buttons for the current set of workspaces
*/
void SetupWorkspaceButtons (form, top)
Widget form;
Widget top;
{
Window root;
Arg args[10]; /* arg list */
register int n; /* arg count */
register int i;
DtWsmWorkspaceInfo *pWsInfo;
char *pchWs;
Widget left = None;
Widget *pWid;
/*
* get workspace information
*/
root = XRootWindowOfScreen(XtScreen(form));
if (DtWsmGetWorkspaceList (XtDisplay(form), root,
&paWs, (int *)&numWorkspaces) == Success)
{
wWs = (Widget *) XtMalloc (numWorkspaces * sizeof (Widget));
pWid = wWs;
for (i=0; i<numWorkspaces; i++, pWid++)
{
DtWsmGetWorkspaceInfo (XtDisplay(form), root, paWs[i],
&pWsInfo);
pchWs = (char *) XmGetAtomName (XtDisplay(form),
pWsInfo->workspace);
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized(pchWs);
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNindicatorOn, True); n++;
XtSetArg (args[n], XmNindicatorType, XmN_OF_MANY); n++;
if (left == None)
{
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
}
else
{
XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNleftWidget, left); n++;
}
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create button
*/
*pWid = XtCreateWidget ("button", xmToggleButtonWidgetClass,
form, args, n);
/*
* add callback
*/
XtAddCallback (*pWid, XmNvalueChangedCallback, wsCB,
(XtPointer) i);
left = *pWid;
}
}
else
{
fprintf(stderr, "Failed to get workspace info -- dtwm not running!\n");
exit (1);
}
}
/*-------------------------------------------------------------
* Update the workspace buttons with where we are now.
*/
void ShowWorkspaceOccupancy ()
{
Arg args[10]; /* arg list */
register int n; /* arg count */
int i,j;
Atom *paWsIn = NULL;
unsigned long numWsIn;
int rval;
rval = DtWsmGetWorkspacesOccupied(XtDisplay(toplevel),
XtWindow(toplevel), &paWsIn, &numWsIn );
if (rval == Success)
{
for (i = 0; i<numWorkspaces; i++)
{
pbOccupy[i] = False;
for (j=0; j<numWsIn; j++)
{
if (paWs[i] == paWsIn[j])
{
pbOccupy[i] = True;
break;
}
}
}
for (i = 0; i<numWorkspaces; i++)
{
n = 0;
if (pbOccupy[i])
{
XtSetArg (args[n], XmNset, True); n++;
}
else
{
XtSetArg (args[n], XmNset, False); n++;
}
XtSetValues (wWs[i], args, n);
}
if (paWsIn) XFree ((char *) paWsIn);
}
}
/*-------------------------------------------------------------
* quitCB - callback for button
*/
void quitCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
exit (0);
}
/*-------------------------------------------------------------
* showCB - callback for show occupancy button
*/
void showCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
ShowWorkspaceOccupancy();
}
/*-------------------------------------------------------------
* setCB - callback for set occupancy button
*/
void setCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
int numSet;
int i;
if (!paWsSet)
{
paWsSet = (Atom *) XtMalloc (numWorkspaces * sizeof(Atom));
}
for (i=0, numSet=0; i<numWorkspaces; i++)
{
if (pbOccupy[i])
{
paWsSet[numSet++] = paWs[i];
}
}
DtWsmSetWorkspacesOccupied (XtDisplay(toplevel),
XtWindow(toplevel), paWsSet, numSet);
}
/*-------------------------------------------------------------
* wsCB - callback for set occupancy button
*/
void wsCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
int i = (Atom) client_data; /* ws array index */
XmToggleButtonCallbackStruct *ptb =
(XmToggleButtonCallbackStruct *) call_data;
if (ptb->reason == XmCR_VALUE_CHANGED)
{
if (ptb->set)
{
pbOccupy[i] = True;
}
else
{
pbOccupy[i] = False;
}
}
}
/*-------------------------------------------------------------
* allWsCB - callback for occupy all button
*/
void allWsCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
DtWsmOccupyAllWorkspaces (XtDisplay(toplevel), XtWindow(toplevel));
}

View File

@@ -0,0 +1,113 @@
!######################################################################
!#
!# File: vertical.defs
!#
!# Directory: /usr/lib/X11/dt/examples/dtwm
!#
!# Description: Sample Application Defaults for the
!# HP DT Window Manager
!# (Tuned for MedResMedColor screens)
!#
!# Hewlett-Packard Visual User Environment, Version 2.1
!#
!# Copyright (c) 1990 Hewlett-Packard Company
!#
!# $XConsortium: vertical.defs /main/2 1996/07/18 15:28:22 drk $
!#
!######################################################################
!#########
!#
!# This dtwm resource file is used in conjunction with the
!# "vertical.rc" file to create a vertically oriented front panel
!# at the right edge of the screen.
!#
!# Merge these resources into your display environment
!# using the command:
!#
!# xrdb -merge vertical.defs
!#
!# Then, restart the window manager for the changes to take effect.
!#
!#########
!#########
!#
!# Cause dtwm to manage all the screens available on a given display.
!# (Default is to manage only the screen specified by the $DISPLAY
!# environment variable or by the -display command line option.)
!#
!#########
dtwm*multiScreen: True
!#########
!#
!# Specify the name of the front panel description within the RC file.
!#
!#########
dtwm*frontPanel*name: VerticalFrontPanel
!#########
!#
!# This resource puts the front panel at the right edge of the
!# screen.
!#
!#########
dtwm*frontPanel*geometry: -10+10
!#########
!#
!# Enable "pointer focus".
!#
!#########
dtwm*keyboardFocusPolicy: pointer
!#########
!#
!# This resource must be specified for the customized window menu to
!# be used.
!#
!#########
dtwm*windowMenu: DtWindowMenu
!#########
!#
!# Font to use in the workspace switch
!#
!#########
dtwm*fontList: system17
!####
!#
!# Set the number of rows in the workspace switch in the front panel
!#
!# Default is 2
!#
!# Also, set the number and name of workspaces and workspace buttons
!#
!####
dtwm*frontPanel*numberOfSwitchRows: 6
dtwm*workspaceList: A B C D E F
!####
!#
!# Set the background of all the rows to be 50_foreground to give
!# a dithered (shaded) appearance.
!#
!# Default is to let the background color of the individual row
!# to show through
!#
!####
Dtwm*frontPanel*rowBackgroundPixmap: 50_foreground
!####
!#
!# Specify the placement of icons on the root window
!# from left to right, across the bottom of the screen.
!#
!####
dtwm*iconPlacement: Left Bottom
!######################## eof ##############################

View File

@@ -0,0 +1,219 @@
#################################################################
#
# File: vertical.rc
#
# Directory: /usr/lib/X11/dt/examples/Dtwm
#
# Description: Sample configuration file (RC file) for the
# HP DT Window Manager
#
# Hewlett-Packard Visual User Environment, Version 2.1
#
# Copyright (c) 1990 Hewlett-Packard Company
#
# $XConsortium: vertical.rc /main/2 1996/07/18 15:28:40 drk $
#
######################################################################
#####
#
# Front Panel Specification
#
####
FrontPanel VerticalFrontPanel # Tuned for displays of 1024 pixels by
# 768 pixels.
{
Row Top
{
dtwmclock =72x55+2+2
}
Row A
{
dtwmdate =+6+6
}
Row B
{
Mail [T I] @mail.m.bm @mail02.m.bm f.action MAILER
}
Row C
{
dtload =+6+6
}
Row D
{
dtwmswtch =72x160
}
Row E
{
print_medium [Z P] @print.m.bm =72x55 f.action PRINTER_INFO f.action PRINT
}
Row F
{
home [P] @home.m.bm f.action BROWSE_HOME
}
Row G
{
applications [P] @tools.m.bm f.action BROWSE_TOOLS
}
Row H
{
trash_medium [P Z] @trash.m.bm f.action SHOW_TRASH f.action THROW_AWAY
}
}
DropEffects print_medium
{
print02.m.bm 40
print03.m.bm
print04.m.bm
print05.m.bm
print06.m.bm
print07.m.bm
print08.m.bm
print09.m.bm
print10.m.bm
print11.m.bm
print12.m.bm
print13.m.bm
print14.m.bm
print.m.bm
}
DropEffects trash_medium
{
trash09.m.bm 40
trash08.m.bm
trash07.m.bm
trash06.m.bm
trash05.m.bm
trash04.m.bm
trash03.m.bm
trash02.m.bm
trash03.m.bm
trash04.m.bm
trash05.m.bm
trash06.m.bm
trash07.m.bm
trash08.m.bm
trash09.m.bm
trash.m.bm
}
###
#
# Root Menu Description
#
###
Menu DtRootMenu
{
"Workspace Menu" f.title
"Shuffle Up" f.circle_up
"Shuffle Down" f.circle_down
"Refresh" f.refresh
"Toggle Workspace Manager " f.toggle_frontpanel
no-label f.separator
"Restart Dtwm..." f.restart
no-label f.separator
"Log out..." f.action EXIT_SESSION
}
###
#
# Window Menu Description
#
###
Menu DtWindowMenu
{
"Restore" _R Alt<Key>F5 f.normalize
"Move" _M Alt<Key>F7 f.move
"Size" _S Alt<Key>F8 f.resize
"Minimize" _n Alt<Key>F9 f.minimize
"Maximize" _x Alt<Key>F10 f.maximize
"Lower" _L Alt<Key>F3 f.lower
no-label f.separator
"Occupy..." _O Alt<Key>O f.workspace_presence
"Occupy all" _a Alt Shift<Key>O f.occupy_all
no-label f.separator
"Remove from WS" _e Alt Shift <Key>F4 f.remove
"Close" _C Alt<Key>F4 f.kill
}
###
#
# Key Bindings Description
#
###
Keys DtKeyBindings
{
Meta<Key>Menu root|icon|window f.toggle_frontpanel
Shift<Key>Escape icon|window f.post_wmenu
Meta<Key>space icon|window f.post_wmenu
Meta<Key>Tab root|icon|window f.next_key
Meta Shift<Key>Tab root|icon|window f.prev_key
Meta<Key>Escape root|icon|window f.next_key
Meta Shift<Key>Escape root|icon|window f.prev_key
Meta<Key>Down root|icon|window f.circle_down
Meta<Key>Up root|icon|window f.circle_up
Meta Ctrl Shift<Key>exclam root|icon|window f.set_behavior
Meta<Key>F6 window f.next_key transient
}
###
#
# Button Bindings Description
#
###
Buttons DtButtonBindings
{
<Btn1Down> root f.menu DtRootMenu
<Btn3Down> root f.menu DtRootMenu
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
Meta<Btn1Down> icon|window f.move
Meta<Btn3Down> window f.minimize
}
###
#
# Default Descriptions
#
# Note: There is no default root window menu defined.
#
###
Menu DefaultWindowMenu
{
"Restore" _R Alt<Key>F5 f.normalize
"Move" _M Alt<Key>F7 f.move
"Size" _S Alt<Key>F8 f.resize
"Minimize" _n Alt<Key>F9 f.minimize
"Maximize" _x Alt<Key>F10 f.maximize
"Lower" _L Alt<Key>F3 f.lower
no-label f.separator
"Close" _C Alt<Key>F4 f.kill
}
Keys DefaultKeyBindings
{
Shift<Key>Escape icon|window f.post_wmenu
Meta<Key>space icon|window f.post_wmenu
Meta<Key>Tab root|icon|window f.next_key
Meta Shift<Key>Tab root|icon|window f.prev_key
Meta<Key>Escape root|icon|window f.next_key
Meta Shift<Key>Escape root|icon|window f.prev_key
Meta Ctrl Shift<Key>exclam root|icon|window f.set_behavior
# Meta<Key>F6 window f.next_key transient
}
Buttons DefaultButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> icon f.post_wmenu
}
######################## End of the RC File #####################

View File

@@ -0,0 +1,48 @@
# $XConsortium: Makefile.hp /main/2 1996/05/13 11:34:13 drk $
##########################################################################
#
# Makefile for wsinfo.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = wsinfo
SOURCES = wsinfo.c
OBJECTS = wsinfo.o
CFLAGS = +Obb2000 -Aa -D_HPUX_SOURCE
CDEBUGFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/include/X11R5
EXTRA_INCLUDES =
INCLUDES = $(DTINCLUDE) $(X11INCLUDE) $(EXTRA_INCLUDES)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/lib/X11R5 -lXt
X11LIB = -L/usr/lib/X11R5 -lX11
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) $(X11LIB)
LDFLAGS =
.c.o:
cc -c $(CFLAGS) $(CDEBUGFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,47 @@
# $XConsortium: Makefile.ibm /main/2 1996/05/13 11:34:32 drk $
##########################################################################
#
# Makefile for wsinfo.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = wsinfo
SOURCES = wsinfo.c
OBJECTS = wsinfo.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/include
EXTRA_INCLUDES =
INCLUDES = $(DTINCLUDE) $(X11INCLUDE) $(EXTRA_INCLUDES)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/lib -lXt
X11LIB = -L/usr/lib -lX11
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) $(X11LIB)
LDFLAGS =
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,50 @@
# $XConsortium: Makefile.sun /main/2 1996/05/13 11:34:51 drk $
##########################################################################
#
# Makefile for wsinfo.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = wsinfo
SOURCES = wsinfo.c
OBJECTS = wsinfo.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/openwin/include
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/openwin/lib -lXt
X11LIB = -L/usr/openwin/lib -lX11
CPLUSPLUS = -L/usr/lib -lC
EXTRA_LIBS = -L/usr/openwin/lib -lgen
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) \
$(X11LIB) $(CPLUSPLUS) $(EXTRA_LIBS)
LDFLAGS = -R$(CDE_INSTALLATION_TOP)/lib:/usr/openwin/lib
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,51 @@
# $XConsortium: Makefile.usl /main/2 1996/05/13 11:35:08 drk $
##########################################################################
#
# Makefile for wsinfo.c
#
# (c) Copyright 1993, 1994 Hewlett-Packard Company
# (c) Copyright 1993, 1994 International Business Machines Corp.
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
# Novell, Inc.
##########################################################################
#ifndef CDE_INSTALLATION_TOP
CDE_INSTALLATION_TOP = /usr/dt
#endif
PROGRAM = wsinfo
SOURCES = wsinfo.c
OBJECTS = wsinfo.o
OPTIMIZEDFLAGS = -O
DTINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
#XMINCLUDE = -I$(CDE_INSTALLATION_TOP)/include
X11INCLUDE = -I/usr/X/include
INCLUDES = $(DTINCLUDE) $(XMINCLUDE) $(X11INCLUDE)
DTSVCLIB = -L$(CDE_INSTALLATION_TOP)/lib -lDtSvc
TTLIB = -L$(CDE_INSTALLATION_TOP)/lib -ltt
XMLIB = -L$(CDE_INSTALLATION_TOP)/lib -lXm
XTLIB = -L/usr/X/lib -lXt
X11LIB = -L/usr/X/lib -lX11
CPLUSPLUS = -L/usr/add-on/C++/lib -lC
EXTRA_LIBS = -L/usr/lib -lgen -lnsl -lresolv -lsocket -lXIM \
-L/usr/add-on/C++/lib -lC
LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTLIB) \
$(X11LIB) $(CPLUSPLUS) $(EXTRA_LIBS)
LDFLAGS =
.c.o:
cc -c $(OPTIMIZEDFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
cc -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
rm -f $(PROGRAM)
rm -f $(OBJECTS)

View File

@@ -0,0 +1,630 @@
/* $XConsortium: wsinfo.c /main/3 1996/11/05 12:17:59 mustafa $ */
/***********************************************************************
* CDE Developer's Conference Sample Program
*
* File: wsinfo.c
*
* Purpose:
* Demonstrate the CDE Workspace API. This file uses:
*
* DtWsmGetWorkspaceInfo
* DtWsmFreeWorkspaceInfo
* DtWsmGetCurrentWorkspace
* DtWsmAddCurrentWorkspaceCallback
* DtWsmOccupyAllWorkspaces
*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
* Novell, Inc.
***********************************************************************/
/*
* include files
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/AtomMgr.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/Label.h>
#include <Dt/Wsm.h>
/*
* functions defined in this program
*/
void main();
void quitCB();
void updateCB();
void ShowCurrentWorkspaceInfo ();
DtWsmWsChangeProc wschangecb();
void InstallXErrorHandler();
/*
* global variables
*/
Widget toplevel; /* Shell widget */
Widget wChildren [20];
/*
* button assignments
*/
#define QUIT_BUTTON (wChildren[0])
#define UPDATE_BUTTON (wChildren[1])
#define SEPARATOR (wChildren[2])
#define WS_LABEL (wChildren[3])
#define WS_VALUE (wChildren[4])
#define TITLE_LABEL (wChildren[5])
#define TITLE_VALUE (wChildren[6])
#define BACKDROP_LABEL (wChildren[7])
#define BACKDROP_VALUE (wChildren[8])
#define COLORSET_LABEL (wChildren[9])
#define COLORSET_VALUE (wChildren[10])
#define SEPARATOR2 (wChildren[11])
#define NUM_CHILDREN 12
/*-------------------------------------------------------------
* main - main logic for program
*/
void main (argc,argv)
int argc;
char **argv;
{
Widget form;
Widget top;
XtAppContext app_context;
Arg args[10];
register int n;
register int i;
XmString xms, xmsBlank;
/*
* initialize toolkit
*/
n = 0;
XtSetArg (args[n], XmNallowShellResize, True); n++;
toplevel = XtAppInitialize (&app_context, "XMDemos", NULL, 0,
&argc, argv, NULL, args, n);
/*
* Set up X error handling
*/
InstallXErrorHandler ();
/*
* manager widget
*/
n = 0;
form = XmCreateForm (toplevel, "form", args, n);
XtManageChild (form);
/*
* create compound string for blank labels
*/
xmsBlank = XmStringCreateLocalized(" ");
/*******************************************
* QUIT BUTTON
******************************************/
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Quit");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
/*
* create button
*/
top = QUIT_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
XmStringFree (xms);
/*
* add callback
*/
XtAddCallback (QUIT_BUTTON, XmNactivateCallback, quitCB, NULL);
/*******************************************
* UPDATE WORKSPACE INFO BUTTON
******************************************/
/*
* create compound string for the button text
*/
xms = XmStringCreateLocalized("Get workspace info");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create button
*/
top = UPDATE_BUTTON = XtCreateWidget ("button", xmPushButtonWidgetClass,
form, args, n);
XmStringFree (xms);
/*
* add callback
*/
XtAddCallback (UPDATE_BUTTON, XmNactivateCallback, updateCB, NULL);
/*******************************************
* SEPARATOR
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create separator
*/
top = SEPARATOR = (Widget)
XmCreateSeparatorGadget (form, "separator", args, n);
/*******************************************
* LABEL FOR CURRENT WORKSPACE
******************************************/
/*
* NOTE: We assume this is the longest label and lay out the
* other fields based on this assumption.
*/
/*
* create compound string for the label text
*/
xms = XmStringCreateLocalized("Current workspace: ");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create label
*/
WS_LABEL = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
XmStringFree (xms);
/*******************************************
* VALUE FOR CURRENT WORKSPACE
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xmsBlank); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNleftWidget, WS_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create value
*/
top = WS_VALUE = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
/*******************************************
* LABEL FOR WORKSPACE TITLE
******************************************/
/*
* create compound string for the label text
*/
xms = XmStringCreateLocalized(" title: ");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
XtSetArg (args[n], XmNrightWidget, WS_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create label
*/
TITLE_LABEL = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
XmStringFree (xms);
/*******************************************
* VALUE FOR WORKSPACE TITLE
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xmsBlank); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNleftWidget, TITLE_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create value
*/
top = TITLE_VALUE = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
/*******************************************
* LABEL FOR WORKSPACE BACKDROP
******************************************/
/*
* create compound string for the label text
*/
xms = XmStringCreateLocalized(" backdrop: ");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
XtSetArg (args[n], XmNrightWidget, WS_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create label
*/
BACKDROP_LABEL = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
XmStringFree (xms);
/*******************************************
* VALUE FOR WORKSPACE BACKDROP
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xmsBlank); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNleftWidget, BACKDROP_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create value
*/
top = BACKDROP_VALUE = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
/*******************************************
* LABEL FOR WORKSPACE COLORSET ID
******************************************/
/*
* create compound string for the label text
*/
xms = XmStringCreateLocalized(" color set id: ");
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
XtSetArg (args[n], XmNrightWidget, WS_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create label
*/
COLORSET_LABEL = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
XmStringFree (xms);
/*******************************************
* VALUE FOR WORKSPACE COLORSET ID
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNlabelType, XmSTRING); n++;
XtSetArg (args[n], XmNlabelString, xmsBlank); n++;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNleftWidget, COLORSET_LABEL); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create value
*/
top = COLORSET_VALUE = XtCreateWidget ("label", xmLabelWidgetClass,
form, args, n);
/*******************************************
* SEPARATOR
******************************************/
/*
* set up arglist
*/
n = 0;
XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg (args[n], XmNtopWidget, top); n++;
/*
* create separator
*/
top = SEPARATOR2 = (Widget)
XmCreateSeparatorGadget (form, "separator", args, n);
/*
* manage children
*/
XtManageChildren (wChildren, NUM_CHILDREN);
/*
* Show info on current workspace
*/
ShowCurrentWorkspaceInfo ();
/*
* realize widgets
*/
XtRealizeWidget (toplevel);
/*
* Do these calls after the shell is realized.
* They need a window created for the top level shell.
*
* HINT: See XtSetMappedWhenManaged(1) if you want to
* realize a widget to get a window, but need to
* control when the map of the window occurs.
*/
(void) DtWsmAddCurrentWorkspaceCallback (toplevel,
(DtWsmWsChangeProc) wschangecb, NULL);
DtWsmOccupyAllWorkspaces (XtDisplay(toplevel), XtWindow(toplevel));
/*
* process events
*/
XtAppMainLoop (app_context);
}
/*-------------------------------------------------------------
* Update the information for the current workspace
*/
void ShowCurrentWorkspaceInfo ()
{
Arg args[10]; /* arg list */
register int n; /* arg count */
Atom aWs;
int rval;
Display *dpy;
Window root;
DtWsmWorkspaceInfo *pWsInfo;
XmString xms;
char pch[512];
char *pchName;
dpy = XtDisplay(toplevel);
root = XDefaultRootWindow(dpy);
rval = DtWsmGetCurrentWorkspace(dpy, root, &aWs);
if (rval == Success)
{
rval = DtWsmGetWorkspaceInfo (dpy, root, aWs, &pWsInfo);
if (rval == Success)
{
/* workspace name */
pchName = XmGetAtomName (dpy, pWsInfo->workspace);
xms = XmStringCreateLocalized(pchName);
n = 0;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetValues (WS_VALUE, args, n);
XmStringFree (xms);
XtFree (pchName);
/* workspace title */
xms = XmStringCreateLocalized(pWsInfo->pchTitle);
n = 0;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetValues (TITLE_VALUE, args, n);
XmStringFree (xms);
/* workspace backdrop name */
if (pWsInfo->backdropName != None)
pchName = XmGetAtomName (dpy, pWsInfo->backdropName);
else
pchName = "<failed to load!>";
xms = XmStringCreateLocalized(pchName);
n = 0;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetValues (BACKDROP_VALUE, args, n);
XmStringFree (xms);
if (pWsInfo->backdropName != None)
XtFree (pchName);
/* workspace colorset id */
sprintf (pch, "%d", pWsInfo->colorSetId);
xms = XmStringCreateLocalized(pch);
n = 0;
XtSetArg (args[n], XmNlabelString, xms); n++;
XtSetValues (COLORSET_VALUE, args, n);
XmStringFree (xms);
DtWsmFreeWorkspaceInfo (pWsInfo);
}
}
if (rval != Success)
{
fprintf (stderr, "Failed to get workspace information.\n");
fprintf (stderr, "Is dtwm running?\n");
exit (1);
}
}
/*-------------------------------------------------------------
* quitCB - callback for button
*/
void quitCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
exit (0);
}
/*-------------------------------------------------------------
* updateCB - callback for show current workspace info
*/
void updateCB (w, client_data, call_data)
Widget w; /* widget id */
caddr_t client_data; /* data from application */
caddr_t call_data; /* data from widget class */
{
ShowCurrentWorkspaceInfo ();
}
/*-------------------------------------------------------------
** wschangecb - callback for workspace switch
*/
DtWsmWsChangeProc
wschangecb (w, atom, client_data)
Widget w;
Atom atom;
XtPointer client_data;
{
ShowCurrentWorkspaceInfo ();
}
/*-------------------------------------------------------------
** data for X error handler
*/
#define E_MAJOR_CODE 0
#define E_MINOR_CODE 1
#define E_RESOURCE_ID 2
#define E_ERROR_SERIAL 3
#define E_CURRENT_SERIAL 4
#define NUM_E_STRINGS 5
static char *pchErrorFormatNames [NUM_E_STRINGS] = {
"MajorCode",
"MinorCode",
"ResourceID",
"ErrorSerial",
"CurrentSerial"
};
static char *pchErrorFormat [NUM_E_STRINGS];
/*-------------------------------------------------------------
** HandleXErrors - catch X protocol errors
*/
static int
_HandleXErrors (display, errorEvent)
Display *display;
XErrorEvent *errorEvent;
{
char buffer[BUFSIZ];
char message[BUFSIZ];
XGetErrorText (display, errorEvent->error_code, buffer, BUFSIZ);
fprintf (stderr, "\n*** X error occurred ***\n");
fprintf (stderr, "Description = '%s'\n ", buffer);
fprintf (stderr, pchErrorFormat[E_MAJOR_CODE], errorEvent->request_code);
sprintf(message, "%d", errorEvent->request_code);
XGetErrorDatabaseText (display, "XRequest", message, " ", buffer, BUFSIZ);
fprintf (stderr, " (%s)\n ", buffer);
fprintf (stderr, pchErrorFormat[E_MINOR_CODE], errorEvent->minor_code);
fprintf (stderr, "\n ");
fprintf (stderr, pchErrorFormat[E_RESOURCE_ID], errorEvent->resourceid);
fprintf (stderr, "\n ");
fprintf (stderr, pchErrorFormat[E_ERROR_SERIAL], errorEvent->serial);
fprintf (stderr, "\n ");
fprintf (stderr, pchErrorFormat[E_CURRENT_SERIAL],
LastKnownRequestProcessed(display));
fprintf (stderr, "\n");
return (0);
}
/*-------------------------------------------------------------
** Setup the X error handler
*/
void
InstallXErrorHandler ( display )
Display *display;
{
char buffer[BUFSIZ];
int i;
/*
* Fetch the X error format strings from XErrorDB
*/
for (i = 0; i< NUM_E_STRINGS; i++)
{
XGetErrorDatabaseText (display, "XlibMessage",
pchErrorFormatNames[i], " %d ", buffer, BUFSIZ);
pchErrorFormat[i] = (char *) XtMalloc (1+strlen(buffer));
strcpy(pchErrorFormat[i], buffer);
}
XSetErrorHandler (_HandleXErrors);
}