v00i007: Ardent Window Manager(X11), Part06/13
Mike Wexler
mikew at wyse.wyse.com
Wed Aug 10 10:17:56 AEST 1988
Submitted-by: jkh at ardent (Jordan Hubbard)
Posting-number: Volume 0, Issue 7
Archive-name: awm/part06
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 6 (of 13)."
# Contents: awm/Icons.c awm/Makefile.rtl awm/NewIconify.c
# awm/RubberBand.c
# Wrapped by mikew at wyse on Mon Aug 8 12:01:44 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f awm/Icons.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"awm/Icons.c\"
else
echo shar: Extracting \"awm/Icons.c\" \(10429 characters\)
sed "s/^X//" >awm/Icons.c <<'END_OF_awm/Icons.c'
X#ident "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_Icons_c = "$Header: Icons.c,v 1.3 88/07/23 17:24:56 jkh Exp $";
X#endif lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X
X
X/*
X * MODIFICATION HISTORY
X *
X * 000 -- L. Guarino Reid, DEC Ultrix Engineering Group
X * 001 -- Jordan Hubbard, Ardent Computer
X * Many modifications for titled windows.
X * 1.2 -- Jordan Hubbard, Ardent Computer.
X * vPad and hPad usage corrected (Chris Thewalt fix).
X * Clipping now set on right GC.
X * 1.3 -- Changed the way icon button events are handled.
X */
X
X#include "awm.h"
X#include "X11/Xutil.h"
X
Xextern XContext AwmContext;
X
X/* the client should pass us a bitmap (single-plane pixmap with background=0
X * and foreground = 1). It is our responsibility to convert it to a pixmap
X * of the appropriate depth for a window tile and also color it with the
X * appropriate background and foreground pixels.
X *
X * we'll use the (global) IconGC for the fore/background pixels.
X */
X
Xstatic Pixmap MakePixmapFromBitmap( bitmap, clipmask, width_return, height_return )
XPixmap bitmap, clipmask;
Xunsigned int *width_return, *height_return;
X{
X Pixmap tile;
X Window junkW;
X int junk, width, height;
X GC iGC;
X XGCValues gcv;
X
X Entry("MakePixmapFromBitmap")
X
X if (!XGetGeometry( dpy, bitmap, &junkW, &junk, &junk,
X &width, &height, &junk, &junk )) {
X Warning( "client passed invalid pixmap for icon." );
X Leave( NULL )
X }
X tile = XCreatePixmap( dpy, RootWindow(dpy, scr), width, height,
X DefaultDepth(dpy, scr) );
X gcv.foreground = ITextForeground;
X gcv.background = ITextBackground;
X iGC = XCreateGC(dpy, RootWindow(dpy, scr), (GCForeground | GCBackground),
X &gcv);
X if (clipmask)
X XSetClipMask(dpy, iGC, clipmask);
X XCopyPlane(dpy, bitmap, tile, iGC, 0, 0, width, height, 0, 0, 1 );
X XFreeGC(dpy, iGC);
X if (width_return)
X *width_return = width;
X if (height_return)
X *height_return = height;
X Leave(tile)
X}
X
Xchar *GetIconName(window)
XWindow window;
X{
X char *name;
X Status status;
X long len, after;
X Atom a_type;
X int a_form;
X
X Entry("GetIconName")
X
X status = XGetWindowProperty(dpy, window, XA_WM_ICON_NAME, 0, 256,
X False, XA_STRING, &a_type, &a_form, &len, &after,
X &name);
X
X if (status != Success) {
X status = XGetWindowProperty(dpy, window, XA_WM_NAME, 0, NAME_LEN,
X False, XA_STRING, &a_type, &a_form, &len,
X &after, &name);
X if (status != Success)
X Leave((char *)NULL)
X }
X if (a_form == 0) /* we have no bananas */
X Leave((char *)NULL)
X if (a_form != 8) {
X Warning("Window has icon_name in wrong format");
X if (name)
X free(name);
X Leave((char *)NULL)
X }
X if (len > NAME_LEN) {
X Warning("Window has icon_name greater than maximum length");
X len = NAME_LEN;
X }
X if (!len)
X Leave((char *)NULL)
X name[len] = 0;
X Leave(name)
X}
X
XBoolean IsIcon(icon, win)
XWindow icon;
XWindow *win;
X{
X AwmInfoPtr awi;
X
X Entry("IsIcon")
X
X if (win)
X *win = 0;
X awi = GetAwmInfo(icon);
X if (!awi)
X Leave(FALSE)
X if (awi->icon == icon) {
X if (win)
X *win = awi->client;
X Leave(TRUE)
X }
X else if (awi->client == icon || awi->frame == icon) {
X if (win)
X *win = awi->icon;
X Leave(FALSE)
X }
X Leave(FALSE)
X}
X
XRemoveIcon(window)
XWindow window;
X{
X AwmInfoPtr awi;
X
X Entry("RemoveIcon")
X
X if ((awi = GetAwmInfo(window)) != NULL) {
X XDeleteContext(dpy, awi->icon, AwmContext);
X if (awi->own) {
X XDestroyWindow(dpy, awi->icon);
X if (awi->iconPixmap != IBackPixmap)
X XFreePixmap(dpy, awi->iconPixmap);
X }
X awi->icon = (Drawable)NULL;
X awi->state ^= ST_ICON;
X awi->state |= ST_WINDOW;
X }
X Leave_void
X}
X
XGetDefaultSize(window, icon_w, icon_h)
XWindow window;
Xint *icon_w, *icon_h;
X{
X char *name; /* Event window name. */
X
X Entry("GetDefaultSize")
X
X /*
X * Determine the size of the icon window.
X */
X name = GetIconName(window);
X *icon_h = IFontInfo->ascent + IFontInfo->descent;
X if (name) {
X *icon_w = XTextWidth(IFontInfo, name, strlen(name));
X if (*icon_w == 0)
X *icon_w = *icon_h;
X }
X else
X *icon_w = *icon_h;
X Leave_void
X}
X
XWindow MakeIcon(window, x, y, mousePositioned)
XWindow window; /* associated window. */
Xint x, y; /* Event mouse position. */
XBoolean mousePositioned;
X{
X Window icon; /* icon window. */
X int icon_x, icon_y; /* Icon U. L. X and Y coordinates. */
X int icon_w, icon_h; /* Icon width and height. */
X int icon_bdr; /* Icon border width. */
X int mask; /* Icon event mask */
X int depth; /* for XGetGeometry */
X XSetWindowAttributes iconValues; /* for icon window creation */
X unsigned long iconValues_mask; /* for above */
X XWMHints *wmhints; /* see if icon position provided */
X XWMHints *XGetWMHints();
X Pixmap clip = 0;
X Window AddIcon();
X
X Entry("MakeIcon")
X
X iconValues.background_pixmap = IBackPixmap;
X mask = (ExposureMask | StructureNotifyMask | KeyPressMask);
X /*
X * Process window manager hints.
X */
X if (wmhints = XGetWMHints(dpy, window)) {
X if (wmhints->flags & IconWindowHint)
X Leave(AddIcon(window, wmhints->icon_window, FALSE,
X (StructureNotifyMask), (Pixmap)NULL))
X else if (wmhints->flags & IconPixmapHint) {
X if (wmhints->flags & IconMaskHint)
X clip = wmhints->icon_mask;
X iconValues.background_pixmap =
X MakePixmapFromBitmap(wmhints->icon_pixmap, clip,
X &icon_w, &icon_h );
X if (iconValues.background_pixmap)
X mask = (StructureNotifyMask);
X else {
X iconValues.background_pixmap = IBackPixmap;
X wmhints->flags &= ~IconPixmapHint;
X GetDefaultSize(window, &icon_w, &icon_h);
X }
X }
X else GetDefaultSize(window, &icon_w, &icon_h);
X }
X else GetDefaultSize(window, &icon_w, &icon_h);
X
X /*
X * Fix up sizes by padding.
X */
X if (!wmhints || !(wmhints->flags & (IconPixmapHint|IconWindowHint))) {
X icon_w += (HIconPad);
X icon_h += (VIconPad);
X }
X
X /*
X * Set the icon border attributes.
X */
X if (!wmhints || !(wmhints->flags & IconWindowHint)) {
X icon_bdr = IBorderWidth;
X iconValues.border_pixel = IBorder;
X }
X
X if (wmhints && (wmhints->flags & IconPositionHint)) {
X icon_x = wmhints->icon_x;
X icon_y = wmhints->icon_y;
X } else {
X if (mousePositioned) {
X /*
X * Determine the coordinates of the icon window;
X * normalize so that we don't lose the icon off the
X * edge of the screen.
X */
X icon_x = x - (icon_w >> 1) + 1;
X if (icon_x < 0) icon_x = 0;
X icon_y = y - (icon_h >> 1) + 1;
X if (icon_y < 0) icon_y = 0;
X if ((icon_x - 1 + icon_w + (icon_bdr << 1)) > ScreenWidth) {
X icon_x = ScreenWidth - icon_w - (icon_bdr << 1) + 1;
X }
X if ((icon_y - 1 + icon_h + (icon_bdr << 1)) > ScreenHeight) {
X icon_y = ScreenHeight - icon_h - (icon_bdr << 1) + 1;
X }
X }
X else {
X icon_x = x + (icon_w >> 1);
X icon_y = y + (icon_y >> 1);
X }
X
X }
X
X /*
X * Create the icon window.
X */
X iconValues_mask = CWBorderPixel | CWBackPixmap;
X /*
X * Here we assume that if they want save unders, they'll also want
X * backing store on the icons. Perhaps a dangerous assumption, but
X * one we have to make at this point.
X */
X if (SaveUnder) {
X iconValues.backing_store = WhenMapped;
X iconValues_mask |= CWBackingStore;
X }
X Leave(AddIcon(window,
X XCreateWindow(
X dpy, RootWindow(dpy, scr),
X icon_x, icon_y,
X icon_w, icon_h,
X icon_bdr, 0, CopyFromParent, CopyFromParent,
X iconValues_mask, &iconValues),
X TRUE, mask, iconValues.background_pixmap))
X
X}
X
XWindow AddIcon(window, icon, own, mask, background)
XWindow window, icon;
XBoolean own;
Xint mask;
XPixmap background;
X{
X Binding *bptr;
X AwmInfoPtr awi;
X
X Entry("AddIcon")
X
X if (icon == NULL)
X Leave(NULL)
X /*
X * Use the text cursor whenever the mouse is in the icon window.
X */
X XDefineCursor(dpy, icon, TextCursor);
X
X /*
X * Select "key pressed", "window exposure" and "unmap window"
X * events for the icon window.
X */
X XSelectInput(dpy, icon, mask | ButtonPressMask | ButtonReleaseMask);
X
X awi = GetAwmInfo(window);
X awi->icon = icon;
X awi->own = own;
X awi->iconPixmap = background;
X XSaveContext(dpy, icon, AwmContext, awi);
X Leave(icon)
X}
END_OF_awm/Icons.c
if test 10429 -ne `wc -c <awm/Icons.c`; then
echo shar: \"awm/Icons.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/Makefile.rtl -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"awm/Makefile.rtl\"
else
echo shar: Extracting \"awm/Makefile.rtl\" \(10660 characters\)
sed "s/^X//" >awm/Makefile.rtl <<'END_OF_awm/Makefile.rtl'
X# makefile generated by mkold
X
XXDIR = /usr/src/X.V11R2
X
XCOM.00 = $(XDIR)/lib
XDIR.00 = $(COM.00)/oldX
XDIR.01 = $(COM.00)/X
X
XNEATENOBJS = \
X check_can_mod.o check_grow.o check_shrink.o \
X commit_op.o goal.o gravity.o mem.o state.o \
X tilwin_close.o tilwin_create.o tilwin_desk.o \
X tilwin_dump.o tilwin_init.o tilwin_list.o tilwin_misc.o \
X tilwin_open.o tilwin_resat.o tilwin_resize.o \
X tilwin_set.o tilwin_tmp.o tilwin_undo.o trial_grow.o \
X trial_place.o trial_satisfy.o trial_slide.o \
X tilwin_slide.o trial_edge_sweep.o win.o tilwin_thread.o \
X init_tws.o pieces_enum.o pieces_merge.o pieces_split.o \
X pieces_update.o tile_create.o tile_delete.o \
X tile_enlarge.o tile_find.o tile_nbrs.o tile_panic.o \
X tile_shrink.o tileopts.o userglobals.o neaten.o
X
Xneaten.a: $(NEATENOBJS)
X ar qcv neaten.a $(NEATENOBJS)
X ranlib neaten.a
X
Xcheck_can_mod.o : check_can_mod.c tilwin.extern.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c check_can_mod.c
X
Xcheck_grow.o : check_grow.c win.extern.h tile.extern.h tile.h \
X basetype.h std_defs.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h tilwin.extern.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c check_grow.c
X
Xcheck_shrink.o : check_shrink.c goal.extern.h tilwin.extern.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h basetype.h std_defs.h tilwin.define.h \
X tileopts.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c check_shrink.c
X
Xcommit_op.o : commit_op.c win.extern.h tile.extern.h tile.h basetype.h \
X std_defs.h state.extern.h state.h tilwin.intern.h \
X tilwin.h tilwinopts.h tilwin.define.h tileopts.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c commit_op.c
X
Xgoal.o : goal.c tilwin.define.h tileopts.h tilwin.intern.h tilwin.h \
X tilwinopts.h basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c goal.c
X
Xgravity.o : gravity.c tilwin.extern.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c gravity.c
X
Xmem.o : mem.c tile.h basetype.h std_defs.h tilwin.intern.h tilwin.h \
X tilwinopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c mem.c
X
Xstate.o : state.c tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h state.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c state.c
X
Xtilwin_close.o : tilwin_close.c state.extern.h state.h tilwin.intern.h \
X tilwin.h tilwinopts.h basetype.h std_defs.h win.extern.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_close.c
X
Xtilwin_create.o : tilwin_create.c mem.extern.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_create.c
X
Xtilwin_desk.o : tilwin_desk.c gravity.extern.h basetype.h std_defs.h \
X tile.extern.h tile.h tilwin.extern.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_desk.c
X
Xtilwin_dump.o : tilwin_dump.c win.extern.h tilwin.extern.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h basetype.h std_defs.h tilwin.define.h \
X tileopts.h tile.extern.h tile.h tile.define.h \
X tile.intern.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_dump.c
X
Xtilwin_init.o : tilwin_init.c tile.intern.h tile.h basetype.h \
X std_defs.h tilwin.intern.h tilwin.h tilwinopts.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_init.c
X
Xtilwin_list.o : tilwin_list.c state.extern.h state.h tilwin.intern.h \
X tilwin.h tilwinopts.h basetype.h std_defs.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_list.c
X
Xtilwin_misc.o : tilwin_misc.c win.extern.h tile.extern.h tile.h \
X basetype.h std_defs.h tile.define.h tile.intern.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_misc.c
X
Xtilwin_open.o : tilwin_open.c win.extern.h gravity.extern.h basetype.h \
X std_defs.h commit.extern.h trial.extern.h trial.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_open.c
X
Xtilwin_resat.o : tilwin_resat.c win.extern.h commit.extern.h \
X trial.extern.h trial.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_resat.c
X
Xtilwin_resize.o : tilwin_resize.c gravity.extern.h basetype.h \
X std_defs.h win.extern.h commit.extern.h trial.extern.h \
X trial.h state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_resize.c
X
Xtilwin_set.o : tilwin_set.c trial.extern.h trial.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_set.c
X
Xtilwin_tmp.o : tilwin_tmp.c trial.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h trial.extern.h tilwin.define.h tileopts.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_tmp.c
X
Xtilwin_undo.o : tilwin_undo.c win.extern.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_undo.c
X
Xtrial_grow.o : trial_grow.c check.extern.h gravity.extern.h basetype.h \
X std_defs.h tilwin.extern.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h tilwin.define.h \
X tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c trial_grow.c
X
Xtrial_place.o : trial_place.c check.extern.h gravity.extern.h \
X basetype.h std_defs.h tilwin.extern.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c trial_place.c
X
Xtrial_satisfy.o : trial_satisfy.c check.extern.h gravity.extern.h \
X basetype.h std_defs.h tilwin.extern.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c trial_satisfy.c
X
Xtrial_slide.o : trial_slide.c trial.extern.h trial.h tilwin.extern.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h basetype.h std_defs.h tilwin.define.h \
X tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c trial_slide.c
X
Xtilwin_slide.o : tilwin_slide.c trial.extern.h trial.h tilwin.extern.h \
X state.extern.h state.h tilwin.intern.h tilwin.h \
X tilwinopts.h basetype.h std_defs.h tilwin.define.h \
X tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_slide.c
X
Xtrial_edge_sweep.o : trial_edge_sweep.c tilwin.extern.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tile.extern.h tile.h tile.define.h \
X tile.intern.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c trial_edge_sweep.c
X
Xwin.o : win.c gravity.extern.h basetype.h std_defs.h state.extern.h \
X state.h tilwin.intern.h tilwin.h tilwinopts.h \
X tile.define.h tile.intern.h tile.h tile.extern.h \
X tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c win.c
X
Xtilwin_thread.o : tilwin_thread.c state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tilwin.define.h tileopts.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tilwin_thread.c
X
Xinit_tws.o : init_tws.c tile-list.h tile.define.h tile.intern.h tile.h \
X basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c init_tws.c
X
Xpieces_enum.o : pieces_enum.c tile.extern.h tile.h basetype.h \
X std_defs.h tile-list.h tile.define.h tile.intern.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c pieces_enum.c
X
Xpieces_merge.o : pieces_merge.c tile-list.h tile.define.h tile.intern.h \
X tile.h basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c pieces_merge.c
X
Xpieces_split.o : pieces_split.c tile.extern.h tile.h basetype.h \
X std_defs.h tile-list.h tile.define.h tile.intern.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c pieces_split.c
X
Xpieces_update.o : pieces_update.c tile-list.h tile.define.h \
X tile.intern.h tile.h basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c pieces_update.c
X
Xtile_create.o : tile_create.c tile.extern.h tile.h basetype.h \
X std_defs.h tile.define.h tile.intern.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_create.c
X
Xtile_delete.o : tile_delete.c tile.extern.h tile.h basetype.h \
X std_defs.h tile-list.h tile.define.h tile.intern.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_delete.c
X
Xtile_enlarge.o : tile_enlarge.c tile.extern.h tile.h basetype.h \
X std_defs.h tile.define.h tile.intern.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_enlarge.c
X
Xtile_find.o : tile_find.c tilwin.extern.h state.extern.h state.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h tile.define.h tile.intern.h tile.h \
X copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_find.c
X
Xtile_nbrs.o : tile_nbrs.c tile-list.h tile.extern.h tile.h basetype.h \
X std_defs.h tile.define.h tile.intern.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_nbrs.c
X
Xtile_panic.o : tile_panic.c copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_panic.c
X
Xtile_shrink.o : tile_shrink.c tile.define.h tile.intern.h tile.h \
X basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_shrink.c
X
Xtileopts.o : tileopts.c tileopts.h basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tileopts.c
X
Xuserglobals.o : userglobals.c explicitopts.h uservals.h useropts.h \
X basetype.h std_defs.h copyright.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c userglobals.c
X
Xneaten.o : neaten.c neaten.define.h tilwin.define.h tileopts.h \
X tilwin.intern.h tilwin.h tilwinopts.h basetype.h \
X std_defs.h userwin.define.h tilwin.extern.h \
X state.extern.h state.h userglobals.define.h userwin.h \
X explicitwinopts.h userwinopts.h
X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c neaten.c
END_OF_awm/Makefile.rtl
if test 10660 -ne `wc -c <awm/Makefile.rtl`; then
echo shar: \"awm/Makefile.rtl\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/NewIconify.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"awm/NewIconify.c\"
else
echo shar: Extracting \"awm/NewIconify.c\" \(11181 characters\)
sed "s/^X//" >awm/NewIconify.c <<'END_OF_awm/NewIconify.c'
X#ident "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_NewIconify_c = "$Header: NewIconify.c,v 1.2 88/07/23 17:24:56 jkh Exp $";
X#endif lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X/*
X * MODIFICATION HISTORY
X *
X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
X * Western Software Lab. Port to X11.
X */
X
X#include "awm.h"
X
XBoolean NewIconify(window, mask, button, x, y)
XWindow window; /* Event window. */
Xint mask; /* Button/key mask. */
Xint button; /* Button event detail. */
Xint x, y; /* Event mouse position. */
X{
X XWindowAttributes fromInfo; /* from window info. */
X XWindowAttributes toInfo; /* to window info. */
X Window from, to;
X char *name; /* Event window name. */
X int mse_x, mse_y; /* Mouse X and Y coordinates. */
X int new_x, new_y; /* To U. L. X and Y coordinates. */
X int new_w, new_h; /* To width and height. */
X int bdw; /* border width */
X int prev_x; /* Previous event window X location. */
X int prev_y; /* Previous event window Y location. */
X int cur_x; /* Current event window X location. */
X int cur_y; /* Current event window Y location. */
X int root_x; /* Root window X location. */
X int root_y; /* Root window Y location. */
X int ulx, uly; /* Event window upper left X and Y. */
X int lrx, lry; /* Event window lower right X and Y. */
X int init_ulx, init_uly; /* Init window upper left X and Y. */
X int init_lrx, init_lry; /* Init window lower right X and Y. */
X int num_vectors; /* Number of vectors in box. */
X int status; /* Routine call return status. */
X int ptrmask; /* pointer query state. */
X Window root; /* Mouse root window. */
X Window icon; /* Icon window. */
X Window sub_win; /* Mouse position sub-window. */
X XEvent button_event; /* Button event packet. */
X XSegment box[MAX_BOX_VECTORS]; /* Box vertex buffer. */
X XSegment zap[MAX_ZAP_VECTORS]; /* Zap effect vertex buffer. */
X int (*storegrid_func)(); /* Function to use for grid */
X int (*storebox_func)(); /* Function to use for box */
X Boolean iconifying; /* Are we iconifying? */
X AwmInfoPtr awi;
X
X Entry("NewIconify")
X
X /*
X * Do not lower or iconify the root window.
X */
X if (window == RootWindow(dpy, scr))
X Leave(FALSE)
X
X /*
X * Change the cursor to the icon cursor.
X */
X grab_pointer();
X
X /*
X * Clear the vector buffers.
X */
X bzero(box, sizeof(box));
X if (Zap)
X bzero(zap, sizeof(zap));
X
X /*
X * Get info on the event window.
X */
X awi = GetAwmInfo(window);
X if (!awi)
X Leave(FALSE)
X /*
X * Are we iconifying or de-iconifying?
X */
X if (awi->state & ST_ICON) {
X from = awi->icon;
X to = (awi->frame) ? awi->frame : awi->client;
X }
X else if (awi->state & ST_WINDOW) {
X from = (awi->frame) ? awi->frame : awi->client;
X to = (awi->icon) ? awi->icon : MakeIcon(window, x, y, FALSE);
X }
X else {
X fprintf(stderr, "NewIconify: Window %x has unknown state '%x'\n",
X awi->client, awi->state);
X Leave(FALSE)
X }
X status = XGetWindowAttributes(dpy, from, &fromInfo);
X if (status == FAILURE)
X Leave(FALSE)
X
X status = XGetWindowAttributes(dpy, to, &toInfo);
X if (status == FAILURE)
X Leave(FALSE)
X
X /*
X * Initialize the movement variables.
X */
X init_ulx = ulx = x - (toInfo.width >> 1) - toInfo.border_width;
X init_uly = uly = y - (toInfo.height >> 1) - toInfo.border_width;
X init_lrx = lrx = x + (toInfo.width >> 1) + toInfo.border_width - 1;
X init_lry = lry = y + (toInfo.height >> 1) + toInfo.border_width - 1;
X prev_x = x;
X prev_y = y;
X
X if (awi->frame && awi->state & ST_ICON) {
X storegrid_func = StoreTitleGridBox;
X storebox_func = StoreTitleBox;
X }
X else {
X storegrid_func = StoreGridBox;
X storebox_func = StoreBox;
X }
X
X /*
X * Store the box.
X */
X if (Grid)
X num_vectors = storegrid_func(box, ulx, uly, lrx, lry);
X else
X num_vectors = storebox_func(box, ulx, uly, lrx, lry);
X
X /*
X * Freeze the server, if requested by the user.
X * This results in a solid box instead of a flickering one.
X */
X if (Freeze)
X XGrabServer(dpy);
X
X /*
X * Process any outstanding events before drawing the box.
X */
X while (QLength(dpy) > 0) {
X XPeekEvent(dpy, &button_event);
X if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
X break;
X GetButton(&button_event);
X }
X
X /*
X * Draw the box.
X */
X DrawBox();
X if (Freeze)
X Frozen = window;
X
X /*
X * We spin our wheels here looking for mouse movement or a change
X * in the status of the buttons.
X */
X Snatched = TRUE;
X while (TRUE) {
X
X /*
X * Check to see if we have a change in mouse button status.
X * This is how we get out of this "while" loop.
X */
X if (XPending(dpy) && !ProcessRequests(box, num_vectors) &&
X GetButton(&button_event)) {
X /*
X * Process the pending events, this sequence is the only
X * way out of the loop and the routine.
X */
X
X if ((button_event.type != ButtonPress) &&
X (button_event.type != ButtonRelease)) {
X continue; /* spurious menu event... */
X }
X
X /*
X * If we froze the server, then erase the last lines drawn.
X */
X if (Freeze) {
X DrawBox();
X Frozen = (Window)0;
X XUngrabServer(dpy);
X }
X
X /*
X * Save the mouse cursor location.
X */
X if (button_event.type == ButtonPress ||
X button_event.type == ButtonRelease) {
X mse_x = ((XButtonEvent *)&button_event)->x;
X mse_y = ((XButtonEvent *)&button_event)->y;
X break;
X }
X }
X else {
X /*
X * Continue to track the mouse until we get a change
X * in button status.
X */
X XQueryPointer(dpy, RootWindow(dpy, scr),
X &root, &sub_win, &root_x, &root_y, &cur_x,
X &cur_y, &ptrmask);
X
X /*
X * If the mouse has moved, then make sure the box follows it.
X */
X if ((cur_x != prev_x) || (cur_y != prev_y)) {
X
X /*
X * If we've frozen the server, then erase the old box first!
X */
X if (Freeze)
X DrawBox();
X
X /*
X * Set the new box position.
X */
X ulx += cur_x - prev_x;
X uly += cur_y - prev_y;
X lrx += cur_x - prev_x;
X lry += cur_y - prev_y;
X
X /*
X * Calculate the vectors for the new box.
X */
X
X if (Grid)
X num_vectors = storegrid_func(box, ulx, uly, lrx,
X lry);
X else
X num_vectors = storebox_func(box, ulx, uly, lrx, lry);
X
X /*
X * Draw the new box.
X */
X if (Freeze)
X DrawBox();
X }
X
X /*
X * Save the old box position.
X */
X prev_x = cur_x;
X prev_y = cur_y;
X
X /*
X * If server is not frozen, then draw the "flicker" box.
X */
X if (!Freeze) {
X DrawBox();
X DrawBox();
X }
X }
X }
X Snatched = FALSE;
X /*
X * If the button is not a button release of the same button pressed,
X * then abort the operation.
X */
X if ((button_event.type != ButtonRelease) ||
X (((XButtonReleasedEvent *)&button_event)->button != button)) {
X ResetCursor(button);
X ungrab_pointer();
X Leave(TRUE)
X }
X
X /*
X * If we are here we have committed to iconifying/deiconifying.
X */
X
X /*
X * Determine the coordinates of the icon or window;
X * normalize the window or icon coordinates if the user so desires.
X */
X new_w = toInfo.width;
X new_h = toInfo.height;
X bdw = toInfo.border_width;
X new_x = mse_x - (new_w >> 1) - bdw;
X new_y = mse_y - (new_h >> 1) - bdw;
X if ((NIcon && awi->state & ST_WINDOW) || (NWindow && awi->state & ST_ICON)) {
X if (new_x < 0) new_x = 0;
X if (new_y < 0) new_y = 0;
X if ((new_x - 1 + new_w + (bdw << 1)) > ScreenWidth) {
X new_x = ScreenWidth - new_w - (bdw << 1) + 1;
X }
X if ((new_y - 1 + new_h + (bdw << 1)) > ScreenHeight) {
X new_y = ScreenHeight - new_h - (bdw << 1) + 1;
X }
X }
X if (awi->state & ST_ICON) {
X awi->state ^= ST_ICON;
X awi->state |= (ST_WINDOW | ST_PLACED);
X if (!awi->frame)
X XRemoveFromSaveSet(dpy, awi->client);
X }
X else if (awi->state & ST_WINDOW) {
X awi->state ^= ST_WINDOW;
X awi->state |= ST_ICON;
X XAddToSaveSet(dpy, awi->client);
X }
X else
X fprintf(stderr, "NewIconify: Window state got trashed!\n");
X
X /*
X * Move the window into place.
X */
X XMoveWindow(dpy, to, new_x, new_y);
X
X /*
X * Map the icon window.
X */
X XMapRaised(dpy, to);
X if (Zap) {
X num_vectors = StoreZap(zap,
X fromInfo.x,
X fromInfo.y,
X fromInfo.x + fromInfo.width
X + (fromInfo.border_width << 1),
X fromInfo.y + fromInfo.height
X + (fromInfo.border_width << 1),
X ulx, uly, lrx, lry);
X DrawZap();
X DrawZap();
X }
X /*
X * Unmap the event window.
X */
X XUnmapWindow(dpy, from);
X XFlush(dpy);
X ungrab_pointer();
X Leave(TRUE)
X}
END_OF_awm/NewIconify.c
if test 11181 -ne `wc -c <awm/NewIconify.c`; then
echo shar: \"awm/NewIconify.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f awm/RubberBand.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"awm/RubberBand.c\"
else
echo shar: Extracting \"awm/RubberBand.c\" \(11955 characters\)
sed "s/^X//" >awm/RubberBand.c <<'END_OF_awm/RubberBand.c'
X#ident "%W% %G%"
X
X
X
X#ifndef lint
Xstatic char *rcsid_RubberBand_c = "$Header: RubberBand.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
X#endif lint
X
X#include "X11/copyright.h"
X/*
X *
X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
X *
X * Copyright 1987 by Jordan Hubbard.
X *
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Ardent Computer
X * Corporation or Jordan Hubbard not be used in advertising or publicity
X * pertaining to distribution of the software without specific, written
X * prior permission.
X *
X */
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X/*
X * MODIFICATION HISTORY
X *
X * 000 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
X * 001 -- Ralph R. Swick, DEC/MIT Project Athena
X * tailor to uwm; use global resources created by uwm
X */
X
X#include "awm.h"
X#include "X11/Xutil.h"
X#include "X11/cursorfont.h"
X
X#define max(a,b) ( (a) > (b) ? (a) : (b) )
X#define min(a,b) ( (a) > (b) ? (b) : (a) )
X#define abs(a) ( (a) > 0 ? (a) : -(a))
X#define makemult(a, b) ((b==1) ? (a) : (((int)((a) / (b))) * (b)) )
X
X#define DCOUNT 2
X#define PCOUNT 1 + (4 * 2 * DCOUNT)
X
X#define BW PBorderWidth /* pop-up window border width */
X#define IBW PPadding /* internal border width for pop-up */
X
XAskUser(dpy, scr, window, x, y, width, height, hints)
XDisplay *dpy;
Xint scr;
XWindow window;
Xint *x, *y, *width, *height;
XXSizeHints *hints;
X{
X Cursor ur, ul, ll, lr; /* cursors for rubber banding */
X int change_cursor = FALSE;
X int current_cursor;
X char *text; /* text for prompt string */
X int nz; /* count where zeros are */
X int popw, poph; /* width and height of prompt window*/
X#define invertGC DrawGC
X int x1, y1; /* location of mouse */
X int x2, y2; /* other corner of box */
X int rootx, rooty, mask; /* for XQueryPointer */
X Window root, subw; /* for XQueryPointer */
X int xa = -1, ya = -1, xb = -1, yb = -1;
X int xinc, yinc;
X int minwidth, minheight;
X int maxwidth, maxheight;
X int defwidth, defheight;
X int chosen = -1;
X int stop = FALSE;
X int changed = TRUE;
X int doit = FALSE;
X int dx, dy;
X int delta;
X XPoint box[PCOUNT];
X int hsize, vsize;
X int zero = '0'; /* zero offset for char conversion */
X XEvent e; /* someplace to put the event */
X int events; /* what events we want. */
X Window pop; /* pop up prompt window */
X int i;
X char *name;
X int width_offset, height_offset; /* to subtract if resize increments */
X
X Entry("AskUser")
X
X if ((hints->flags & USPosition) && (hints->flags & USSize)) {
X *x = hints->x;
X *y = hints->y;
X *width = hints->width;
X *height = hints->height;
X Leave_void
X }
X if (!XFetchName(dpy, window, &name))
X name = "Unnamed Window";
X
X ur = XCreateFontCursor(dpy, XC_ur_angle);
X ul = XCreateFontCursor(dpy, XC_ul_angle);
X ll = XCreateFontCursor(dpy, XC_ll_angle);
X lr = XCreateFontCursor(dpy, XC_lr_angle);
X current_cursor = ul;
X
X events = ButtonPressMask | ButtonReleaseMask;
X
X /*
X * go get the mouse as soon as you can
X */
X
X while (1) {
X int res;
X if ((res = XGrabPointer (dpy, RootWindow(dpy, scr), FALSE, events,
X GrabModeAsync, GrabModeAsync, None, ul,
X CurrentTime )) == GrabSuccess)
X break;
X sleep (1);
X }
X nz = strlen(name); /* compute number of characters */
X text = (char *)malloc( nz + 11 );
X (void) strcpy(text, name);
X (void) strcat(text, ": 000x000");
X nz += 9;
X popw = XTextWidth (PFontInfo, text, nz) + 2 * IBW;
X poph = PFontInfo->ascent+PFontInfo->descent + 2 * IBW;
X
X pop = XCreateSimpleWindow(dpy, RootWindow(dpy, scr),
X 0, 0, popw, poph, BW, PBorder, PBackground);
X XMapWindow (dpy, pop);
X
X if (hints->flags & PMinSize) {
X minwidth = hints->min_width;
X minheight = hints->min_height;
X } else {
X minwidth = 0;
X minheight = 0;
X }
X if (hints->flags & PMaxSize) {
X maxwidth = max(hints->max_width, minwidth);
X maxheight = max(hints->max_height, minheight);
X } else {
X maxwidth = DisplayWidth(dpy, scr);
X maxheight = DisplayHeight(dpy, scr);
X }
X if (hints->flags & PResizeInc) {
X xinc = hints->width_inc;
X yinc = hints->height_inc;
X } else {
X xinc = 1;
X yinc = 1;
X }
X if (hints->flags & PSize || hints->flags & USSize) {
X defwidth = hints->width;
X defheight = hints->height;
X } else if (hints->flags&PMinSize) {
X defwidth = hints->min_width;
X defheight = hints->min_height;
X } else if (hints->flags&PMaxSize) {
X defwidth = hints->max_width;
X defheight = hints->max_height;
X } else {
X long dummy;
X XGetGeometry(dpy, window, &dummy, &dummy, &dummy,
X &defwidth, &defheight, &dummy, &dummy);
X }
X
X /* until there are better WM_HINTS, we'll assume that the client's
X * minimum width and height are the appropriate offsets to subtract
X * when resizing with an explicit resize increment.
X */
X if (hints->flags & PMinSize && hints->flags & PResizeInc) {
X width_offset = hints->min_width;
X height_offset = hints->min_height;
X } else
X width_offset = height_offset = 0;
X
X
X XQueryPointer (dpy, RootWindow(dpy, scr), &root, &subw,
X &rootx, &rooty, &x1, &y1, &mask);
X hsize = minwidth;
X vsize = minheight;
X x2 = x1+hsize;
X y2 = y1+vsize;
X
X while (stop == FALSE) {
X if ( (xb != max (x1, x2)) || (yb != max (y1, y2))
X ||(xa != min (x1, x2)) || (ya != min (y1, y2)) ) {
X xa = min (x1, x2);
X ya = min (y1, y2);
X xb = max (x1, x2);
X yb = max (y1, y2);
X for ( i = 0; i < PCOUNT; i += 4) {
X box[i].x = xa; box[i].y = ya;
X if (i+1 == PCOUNT) break;
X box[i+1].x = xb; box[i+1].y = ya;
X box[i+2].x = xb; box[i+2].y = yb;
X box[i+3].x = xa; box[i+3].y = yb;
X }
X doit = TRUE;
X }
X if (changed) {
X int Hsize = (hsize - width_offset) / xinc;
X int Vsize = (vsize - height_offset) / yinc;
X int pos = 3;
X
X changed = FALSE;
X text[nz - 7] = (Hsize>99) ? (Hsize / 100 + zero) : ' ';
X text[nz - 6] = (Hsize>9) ? ((Hsize / 10) % 10 + zero) : ' ';
X text[nz - 5] = Hsize % 10 + zero;
X if (Vsize>99) text[nz - pos--] = Vsize / 100 + zero;
X if (Vsize>9) text[nz - pos--] = (Vsize / 10) % 10 + zero;
X text[nz - pos--] = Vsize % 10 + zero;
X while (pos>0) text[nz - pos--] = ' ';
X XDrawImageString(dpy, pop, PopGC, IBW, IBW+PFontInfo->ascent,
X text, nz);
X }
X if (doit) {
X XDrawLines(dpy, RootWindow(dpy, scr), invertGC, box, PCOUNT,
X CoordModeOrigin);
X }
X if (XPending(dpy) &&
X XCheckMaskEvent(dpy, ButtonPressMask|ButtonReleaseMask, &e)) {
X if ((chosen < 0) && (e.type == ButtonPress)) {
X x1 = x2 = ((XButtonEvent *)&e)->x;
X y1 = y2 = ((XButtonEvent *)&e)->y;
X chosen = ((XButtonEvent *)&e)->button;
X if (chosen == Button2)
X change_cursor = TRUE;
X }
X else if ((e.type == ButtonRelease) &&
X ((((XButtonEvent *)&e)->button) == chosen)) {
X x2 = ((XButtonEvent *)&e)->x;
X y2 = ((XButtonEvent *)&e)->y;
X stop = TRUE;
X }
X else
X XQueryPointer (dpy, RootWindow(dpy, scr), &root,
X &subw, &rootx, &rooty, &x2, &y2, &mask);
X }
X else XQueryPointer (dpy, RootWindow(dpy, scr), &root,
X &subw, &rootx, &rooty, &x2, &y2, &mask);
X if (change_cursor) {
X if ((x2 >= x1) && (y2 >= y1) &&
X current_cursor != lr) {
X XChangeActivePointerGrab (dpy, events, lr, CurrentTime );
X current_cursor = lr;
X }
X else if ((x2 >= x1) && (y2 < y1) &&
X current_cursor != ur) {
X XChangeActivePointerGrab (dpy, events, ur, CurrentTime );
X current_cursor = ur;
X }
X else if ((x2 < x1) && (y2 >= y1) &&
X current_cursor != ll) {
X XChangeActivePointerGrab (dpy, events, ll, CurrentTime );
X current_cursor = ll;
X }
X else if ((x2 < x1) && (y2 < y1) &&
X (current_cursor != ul)) {
X XChangeActivePointerGrab (dpy, events, ul, CurrentTime );
X current_cursor = ul;
X }
X }
X if (chosen != Button2) {
X x1 = x2;
X y1 = y2;
X if (chosen >= 0) {
X x2 = defwidth;
X if (chosen == Button1)
X y2 = defheight;
X else
X y2 = (DisplayHeight(dpy, scr) - y1);
X x2 = x1 + x2;
X y2 = y1 + y2;
X }
X }
X
X dx = max(min(abs (x2 - x1), maxwidth), minwidth);
X dx = makemult(dx-minwidth, xinc)+minwidth;
X dy = max(min(abs(y2 - y1), maxheight), minheight);
X dy = makemult(dy-minheight, yinc)+minheight;
X
X if (hints->flags & PAspect) {
X if ((dx * hints->max_aspect.y > dy * hints->max_aspect.x)) {
X delta = makemult((dx * hints->max_aspect.y /
X hints->max_aspect.x) - dy, yinc);
X if ((dy + delta) <= maxheight)
X dy += delta;
X else {
X delta = makemult(dx - hints->max_aspect.x
X * dy/hints->max_aspect.y, xinc);
X if ((dx - delta) >= minwidth)
X dx -= delta;
X }
X }
X if (dx * hints->min_aspect.y < dy * hints->min_aspect.x) {
X delta = makemult((hints->min_aspect.x *
X dy/hints->min_aspect.y) - dx, xinc);
X if (dx + delta <= maxwidth)
X dx += delta;
X else {
X delta = makemult(dy - (dx * hints->min_aspect.y /
X hints->min_aspect.x), yinc);
X if ((dy - delta) >= minheight)
X dy -= delta;
X }
X }
X
X }
X
X if (dx != hsize) {
X hsize = dx;
X changed = TRUE;
X }
X if (dy != vsize) {
X vsize = dy;
X changed = TRUE;
X }
X if (x2 < x1)
X x2 = x1 - dx;
X else
X x2 = x1 + dx;
X
X if (y2 < y1)
X y2 = y1 - dy;
X else
X y2 = y1 + dy;
X }
X XUngrabPointer(dpy, CurrentTime);
X
X XDestroyWindow (dpy, pop);
X XFreeCursor (dpy, ur);
X XFreeCursor (dpy, ul);
X XFreeCursor (dpy, lr);
X XFreeCursor (dpy, ll);
X free(name);
X free(text);
X *x = min(x1, x2);
X *y = min(y1, y2);
X *width = hsize;
X *height = vsize;
X XSync(dpy, FALSE);
X Leave_void
X}
END_OF_awm/RubberBand.c
if test 11955 -ne `wc -c <awm/RubberBand.c`; then
echo shar: \"awm/RubberBand.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 6 \(of 13\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 13 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
More information about the Comp.sources.x
mailing list