jkh@ardent.UUCP (Jordan K. Hubbard) (06/16/88)
#! /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 8 (of 17)." # Contents: awm/Makefile.rtl awm/NewIconify.c awm/RubberBand.c # Wrapped by jkh@ardent on Thu Jun 16 00:44:15 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'awm/Makefile.rtl' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'awm/Makefile.rtl'\" else echo shar: Extracting \"'awm/Makefile.rtl'\" \(10660 characters\) sed "s/^X//" >'awm/Makefile.rtl' <<'END_OF_FILE' X# makefile generated by mkold X XXDIR = /usr/src/X.V11R2 X COM.00 = $(XDIR)/lib DIR.00 = $(COM.00)/oldX DIR.01 = $(COM.00)/X X NEATENOBJS = \ 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 neaten.a: $(NEATENOBJS) X ar qcv neaten.a $(NEATENOBJS) X ranlib neaten.a X check_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 check_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 check_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 commit_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 goal.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 gravity.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 mem.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 state.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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 tilwin_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 trial_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 trial_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 trial_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 trial_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 tilwin_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 trial_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 win.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 tilwin_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 init_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 pieces_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 pieces_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 pieces_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 pieces_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 tile_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 tile_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 tile_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 tile_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 tile_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 tile_panic.o : tile_panic.c copyright.h X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tile_panic.c X tile_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 tileopts.o : tileopts.c tileopts.h basetype.h std_defs.h copyright.h X $(CC) $(CFLAGS) -g -DNEATEN -DWM_DEBUG -c tileopts.c X userglobals.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 neaten.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_FILE if test 10660 -ne `wc -c <'awm/Makefile.rtl'`; then echo shar: \"'awm/Makefile.rtl'\" unpacked with wrong size! fi # end of 'awm/Makefile.rtl' fi if test -f 'awm/NewIconify.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'awm/NewIconify.c'\" else echo shar: Extracting \"'awm/NewIconify.c'\" \(11112 characters\) sed "s/^X//" >'awm/NewIconify.c' <<'END_OF_FILE' X#ident "%W% %G%" X X#ifndef lint static char *rcsid_NewIconify_c = "$Header: NewIconify.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 -- 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 Boolean NewIconify(window, mask, button, x, y) Window window; /* Event window. */ int mask; /* Button/key mask. */ int button; /* Button event detail. */ int 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 == ICON) { X from = awi->icon; X to = (awi->frame) ? awi->frame : awi->client; X } X else if (awi->state == 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 == 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 == WINDOW) || (NWindow && awi->state == 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 == ICON) { X awi->state = WINDOW; X awi->placed = TRUE; X if (!awi->title) X XRemoveFromSaveSet(dpy, awi->client); X } X else if (awi->state == WINDOW) { X awi->state = 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_FILE if test 11112 -ne `wc -c <'awm/NewIconify.c'`; then echo shar: \"'awm/NewIconify.c'\" unpacked with wrong size! fi # end of 'awm/NewIconify.c' fi if test -f 'awm/RubberBand.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'awm/RubberBand.c'\" else echo shar: Extracting \"'awm/RubberBand.c'\" \(11953 characters\) sed "s/^X//" >'awm/RubberBand.c' <<'END_OF_FILE' X#ident "%W% %G%" X X#ifndef lint static 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 AskUser(dpy, scr, window, x, y, width, height, hints) Display *dpy; int scr; Window window; int *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_FILE if test 11953 -ne `wc -c <'awm/RubberBand.c'`; then echo shar: \"'awm/RubberBand.c'\" unpacked with wrong size! fi # end of 'awm/RubberBand.c' fi echo shar: End of archive 8 \(of 17\). cp /dev/null ark8isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 17 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