mikew@wyse.wyse.com (Mike Wexler) (02/21/89)
Submitted-by: kmw@ardent (Ken Wallich) Posting-number: Volume 3, Issue 23 Archive-name: awm2/part07 #! /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 7 (of 12)." # Contents: Cursors.c Icons.c Makefile.rtl RubberBand.c # menus/rtlmenu.c # Wrapped by mikew@wyse on Fri Feb 17 10:50:27 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Cursors.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Cursors.c'\" else echo shar: Extracting \"'Cursors.c'\" \(4232 characters\) sed "s/^X//" >'Cursors.c' <<'END_OF_FILE' X X X X#ifndef lint Xstatic char *rcsid_StoreCursors_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Cursors.c,v 1.1 89/01/23 15:34:10 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 -- M. Gancarz, DEC Ultrix Engineering Group X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group X * Convert to X11 X * 1.2 -- Gumby cursor added (This was a major revision). X */ X X#ifndef lint Xstatic char *sccsid = "@(#)StoreCursors.c 3.8 1/24/86"; X#endif X X#include "awm.h" X#include "X11/cursorfont.h" X X/* X * Store all the cursors into global variables. X */ XStoreCursors() X{ X Entry("StoreCursors") X X /* X * Main awm cursor and movement cursor. X */ X ArrowCrossCursor = XCreateFontCursor(dpy, XC_fleur); X if (ArrowCrossCursor == FAILURE) { X Error("StoreCursors -> Unable to store ArrowCrossCursor."); X } X X /* X * Text cursor used in icons. X */ X TextCursor = XCreateFontCursor(dpy, XC_xterm); X if (TextCursor == FAILURE) { X Error("StoreCursors -> Unable to store TextCursor."); X } X X /* X * Icon cursor used to iconify windows. X */ X IconCursor = XCreateFontCursor(dpy, XC_icon); X if (IconCursor == FAILURE) { X Error("StoreCursors -> Unable to store IconCursor."); X } X X /* X * Left button main cursor. X */ X LeftButtonCursor = XCreateFontCursor(dpy, XC_leftbutton); X if (LeftButtonCursor == FAILURE) { X Error("StoreCursors -> Unable to store LeftButtonCursor."); X } X X /* X * Middle button main cursor. X */ X MiddleButtonCursor = XCreateFontCursor(dpy, XC_middlebutton); X if (MiddleButtonCursor == FAILURE) { X Error("StoreCursors -> Unable to store MiddleButtonCursor."); X } X X /* X * Right button main cursor. X */ X RightButtonCursor = XCreateFontCursor(dpy, XC_rightbutton); X if (RightButtonCursor == FAILURE) { X Error("StoreCursors -> Unable to store RightButtonCursor."); X } X X /* X * Targer cursor used to identify a window for an action. X */ X TargetCursor = XCreateFontCursor(dpy, XC_circle); X if (TargetCursor == FAILURE) { X Error("StoreCursors -> Unable to store TargetCursor."); X } X /* X * Gumby cursor used in icons if icon is not a typein icon X * (otherwise use textcursor X */ X GumbyCursor = XCreateFontCursor(dpy, XC_gumby); X if (GumbyCursor == FAILURE) { X Error("StoreCursors -> Unable to store GumbyCursor."); X } X Leave(0) X} X END_OF_FILE if test 4232 -ne `wc -c <'Cursors.c'`; then echo shar: \"'Cursors.c'\" unpacked with wrong size! fi # end of 'Cursors.c' fi if test -f 'Icons.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Icons.c'\" else echo shar: Extracting \"'Icons.c'\" \(14575 characters\) sed "s/^X//" >'Icons.c' <<'END_OF_FILE' X X X X#ifndef lint Xstatic char *rcsid_Icons_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Icons.c,v 1.2 89/02/07 20:05:21 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 * 1.4 -- Isaac J. Salzman, RAND Corp. X * reworked the way icons are handled - if IconsLabels is set, icons X * with pixmaps are labled at bottom & icons w/o pixmaps use a default X * pixmap w/a label instead of just a solid bg tile (i.e. twm style), X * otherwise old uwm style icons are used (typin and all). X * 1.5 -- Modified Isaac's changes to allow wm_option.icon.labels to X * work. This allows individual clients/classes to determine their X * icon style. -jkh X */ X X#include "awm.h" X#include "X11/Xutil.h" X Xextern XContext AwmContext; X extern void Warning(); 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; X unsigned int 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 (unsigned) 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, X (unsigned long) 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 unsigned char *name; X Status status; X unsigned 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, 0L, 256L, 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, 0L, NAME_LEN, X False, XA_STRING, &a_type, &a_form, &len, X &after, &name); X if (status != Success) X Leave( DEF_NAME ) /* use default name */ 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((char *) 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 (awi->iconPixmap != IDefPixmap)) X XFreePixmap(dpy, awi->iconPixmap); X } X awi->icon = (Drawable)NULL; X awi->state ^= ST_ICON; X awi->state |= ST_WINDOW; X#ifdef WMSTATE X awi->wm_state.icon=0; X awi->wm_state.state=NormalState; X XChangeProperty(dpy,awi->client,wm_state_atom,wm_state_atom,32, X PropModeReplace,(char *) &awi->wm_state,2); X#endif /* WMSTATE */ 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 = 0; /* set to zilch if bogus name! */ 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 int icon_x, icon_y; /* Icon U. L. X and Y coordinates. */ X unsigned int icon_w, icon_h; /* Icon width and height. */ X unsigned int icon_bdr; /* Icon border width. */ X long mask; /* Icon event mask */ 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 AwmInfoPtr awi; X int junk; X X Entry("MakeIcon") X X awi = GetAwmInfo(window); X X if (awi->attrs & AT_ICONLABEL) { /* check for iconLables - twm style */ X iconValues.background_pixmap = IDefPixmap; X mask = StructureNotifyMask; X } X else { /* uwm style */ X iconValues.background_pixmap = IBackPixmap; X mask = (ExposureMask | StructureNotifyMask | KeyPressMask); X } X 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 X 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 } X } X } X X /* X * we now have a pixmap of some sort - either a background X * tile or an actual image - get the dimensions... X */ X X if (!XGetGeometry(dpy, iconValues.background_pixmap, X &junk, &junk, &junk, X &icon_w, &icon_h, &junk, &junk )) { X Warning( "can't get geom of pixmap in MakeIcon" ); X Leave( NULL ); X } X X if (awi->attrs & AT_ICONLABEL) { X char *s; X Pixmap p; X unsigned int nw, nh; X int tw, th, hoff, voff; X X if (s = GetIconName(window)) { X nw = icon_w; X nh = icon_h; X X /* find out dimensions of text, add padding */ X tw = XTextWidth(IFontInfo, s, strlen(s)) + HIconPad; X th = IFontInfo->ascent + IFontInfo->descent + VIconPad; X X X /* calculate the size including the icon label */ X if (nw < tw) /* width >= text width */ X nw = tw; X X /* always tack on extra for the label height */ X nh += th; X X /* now that we have dimensions, create the pixmap X we want to eventually use as the icon window X */ X X if (!(p = XCreatePixmap(dpy, RootWindow(dpy, scr), nw, nh, X (unsigned) DefaultDepth(dpy, scr)))) { X Warning("can't create pixmap in MakeIcon."); X Leave( NULL ) X } X X /* calculate horizontal offset of pixmap (center it!) */ X if (hoff = (nw - icon_w)) X hoff = (hoff+1)/2; X X /* if the label goes at the top, push the thing to the bottom X * otherwise leave it at the top X */ X X voff = ILabelTop ? (th - (VIconPad+1)/2) : (VIconPad+1)/2; X X XCopyArea(dpy, iconValues.background_pixmap, p, X IconGC, 0, 0, icon_w, icon_h, X hoff, voff); X X /* now that we have a centered pixmap draw X * some text on it.... X */ X X if (hoff = (nw - tw)) X hoff = (hoff+1)/2; X else X hoff = (HIconPad ? (HIconPad+1)/2 : 1); X X /* see if string goes to top or bottom */ X if (ILabelTop) X voff = th - (IFontInfo->descent-((VIconPad+1)/2)); X else X voff = nh-(IFontInfo->descent+((VIconPad+1)/2)); X X XDrawImageString(dpy, p, IconGC, hoff, voff, s, strlen(s)); X X /* X * Now free up original pixmap and replace X * with this new one. X */ X X icon_h = nh; X icon_w = nw; X X if ((iconValues.background_pixmap != IBackPixmap) && X (iconValues.background_pixmap != IDefPixmap)) X XFreePixmap(dpy, iconValues.background_pixmap); X iconValues.background_pixmap = p; X } X } X else { /* do it the old way.... */ X int h, w; X X if (!wmhints || !(wmhints->flags & IconPixmapHint)) { X GetDefaultSize(window, &w, &h); X X if ((w==0) || (h==0)) { /* no label, use IDefPixmap */ X iconValues.background_pixmap = IDefPixmap; X X /* get geom of ipixmap */ X if (!XGetGeometry(dpy, iconValues.background_pixmap, X &junk, &junk, &junk, X &icon_w, &icon_h, &junk, &junk)) { X Warning("can't get geom of pixmap in MakeIcon"); X Leave(NULL) X } X } X else { /* use small label icon + some padding */ X icon_h = h+VIconPad; X icon_w = w+HIconPad; X } 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 * Determine icon position.... 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 XWindow AddIcon(window, icon, own, mask, background) XWindow window, icon; XBoolean own; Xlong mask; XPixmap background; X{ 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, if X * it's a typein icon, otherwise use gumby.... X */ X X if (background == IBackPixmap) X XDefineCursor(dpy, icon, TextCursor); X else X XDefineCursor(dpy, icon, GumbyCursor); 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#ifdef WMSTATE X awi->wm_state.icon=icon; X XChangeProperty(dpy,awi->client,wm_state_atom,wm_state_atom,32, X PropModeReplace,(char *) &awi->wm_state,2); X#endif /* WMSTATE */ X XSaveContext(dpy, icon, AwmContext, (caddr_t) awi); X Leave(icon) X} END_OF_FILE if test 14575 -ne `wc -c <'Icons.c'`; then echo shar: \"'Icons.c'\" unpacked with wrong size! fi # end of 'Icons.c' fi if test -f 'Makefile.rtl' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile.rtl'\" else echo shar: Extracting \"'Makefile.rtl'\" \(10660 characters\) sed "s/^X//" >'Makefile.rtl' <<'END_OF_FILE' 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_FILE if test 10660 -ne `wc -c <'Makefile.rtl'`; then echo shar: \"'Makefile.rtl'\" unpacked with wrong size! fi # end of 'Makefile.rtl' fi if test -f 'RubberBand.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'RubberBand.c'\" else echo shar: Extracting \"'RubberBand.c'\" \(12196 characters\) sed "s/^X//" >'RubberBand.c' <<'END_OF_FILE' X X X X#ifndef lint Xstatic char *rcsid_RubberBand_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/RubberBand.c,v 1.2 89/02/07 21:23:46 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, transient) XDisplay *dpy; Xint scr; XWindow window; Xint *x, *y; Xunsigned int *width, *height; XXSizeHints *hints; XWindow transient; 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 unsigned 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; X unsigned int mask; /* for XQueryPointer */ X Window root, subw; /* for XQueryPointer */ X int xa = -1, ya = -1, xb = -1, yb = -1; X int xinc, yinc; X unsigned int minwidth, minheight; X unsigned int maxwidth, maxheight; X unsigned 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 int ijunk; 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 unsigned int events; /* what events we want. */ X Window pop, wjunk; /* 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 (transient) { X XGetGeometry( dpy, window, &wjunk, x, y, width, height, X &ijunk, &ijunk); X Leave_void 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 if (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 12196 -ne `wc -c <'RubberBand.c'`; then echo shar: \"'RubberBand.c'\" unpacked with wrong size! fi # end of 'RubberBand.c' fi if test -f 'menus/rtlmenu.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'menus/rtlmenu.c'\" else echo shar: Extracting \"'menus/rtlmenu.c'\" \(9335 characters\) sed "s/^X//" >'menus/rtlmenu.c' <<'END_OF_FILE' X X#ifndef lint X static char sccs_id[] = "@(#)rtlmenu.c 2.1 12/16/87 Siemens Corporate Research and Support, Inc."; X#endif X X X/* X RTL Menu Package Version 1.0 X by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987 X X rtlmenu.c: interface level for menu package X */ 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 X Copyright 1987 by X Siemens Corporate Research and Support, Inc., Princeton, New Jersey X X Permission to use, copy, modify, and distribute this software X and its documentation for any purpose and without fee is X hereby granted, provided that the above copyright notice X appear in all copies and that both that copyright notice and X this permission notice appear in supporting documentation, and X that the name of Siemens not be used in advertising or X publicity pertaining to distribution of the software without X specific, written prior permission. Siemens makes no X representations about the suitability of this software for any X purpose. It is provided "as is" without express or implied X warranty. X X */ X X#include <stdio.h> X#include "X11/Xlib.h" X X#include "menu.h" X#include "menu.def.h" X#include "menu.ext.h" X#include "rtlmenu.h" X#include "dbug.h" X Xextern Display *dpy; Xextern int scr; X Xstatic RTLPoint menu_pos; Xstatic int initialized = 0; X Xvoid RTLMenu_Initialize (options_mask) XMenuOptionsMask options_mask; X{ X Entry("RTLMenu_Initialize") X X if (initialized) X return; X initialized = 1; X InitMenu ("awm", options_mask); X Leave_void X} X X/* ------------------------------------------------------------ */ XRTLMenu RTLMenu_Create() X{ X Entry("RTLMenu_Create") X /* Create a menu with no name, not in inverse video. */ X X Leave((RTLMenu)NewMenu()) X} X X/* ------------------------------------------------------------ */ Xvoid RTLMenu_Destroy( menu ) XRTLMenu menu; X{ X Entry("RTLMenu_Destroy") X DisposeMenu ((Menu*) menu); X Leave_void X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X Xpointer RTLMenu_Data( menu, item ) X/*ARGSUSED*/ XRTLMenu menu; XRTLMenuItem item; X{ X Entry("RTLMenu_Data") X Leave(ItemData((MenuItem*)item)) X} X X/* ------------------------------------------------------------ */ X XRTLMenu RTLMenu_Get_Submenu( menu, str ) XRTLMenu menu; Xchar *str; X{ X MenuItem *item = MenuItemByName ((Menu*) menu, str); X X Entry("RTLMenu_Get_Submenu") X X if (!ItemIsNull(item)) X Leave((RTLMenu)ItemSubmenu(item)) X Leave(0) X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X X/*ARGSUSED*/ Xstatic void RTLMenu_Client_Send( menu, item ) XRTLMenu menu; XRTLMenuItem item; X{ X Entry("RTLMenu_Client_Send") X X printf ("RTLMenu_Client_Send not yet implemented for X, string = \"%s\"\n", X (char*) item); X Leave_void X} X X/* ------------------------------------------------------------ */ X XRTLMenuItem RTLMenu_Append_String( menu, str, strval ) XRTLMenu menu; Xchar *str; Xchar *strval; X{ X MenuItem *item = AddMenuItem((Menu*)menu, str, (char *)NULL); X X Entry("RTLMenu_Append_String") X X ItemCallback(item) = (Callback)RTLMenu_Client_Send; X ItemData(item) = (pointer) strval; X Leave((RTLMenuItem)item) X} X X/* ------------------------------------------------------------ */ X XRTLMenuItem RTLMenu_Append_Callback( menu, backproc ) XRTLMenu menu; XVoidFunc backproc; X{ X MenuItem *item = AddMenuItem((Menu*)menu, "", (char *)NULL); X X Entry("RTLMenu_Append_Callback") X X ItemGenerator(item) = (Callback)backproc; X X Leave((RTLMenuItem)item) X} X X/* ------------------------------------------------------------ */ X XRTLMenuItem RTLMenu_Append_Call( menu, str, pix, proc, ptrval ) XRTLMenu menu; Xchar *str; Xchar *pix; XVoidFunc proc; Xpointer ptrval; X{ X MenuItem *item = AddMenuItem((Menu*)menu, str, pix); X X Entry("RTLMenu_Append_Call") X X ItemCallback(item) = proc; X ItemData(item) = ptrval; X X Leave((RTLMenuItem)item) X} X X/* ------------------------------------------------------------ */ X XRTLMenuItem RTLMenu_Append_Checkback( menu, str, pix, checkproc, proc, ptrval ) XRTLMenu menu; Xchar *str; /* Menu string */ Xchar *pix; XBoolean (*checkproc) (); /* Boolean function called when menu entry X is about to be displayed. If true, then X the item appears checked; if false, then X it does not */ XVoidFunc proc; /* function to be called when the item X is selected */ Xpointer ptrval; /* data associated with this item */ X{ X MenuItem *item = AddMenuItem((Menu*)menu, str, pix); X X Entry("RTLMenu_Append_Checkback") X X ItemCallback(item) = proc; X ItemData(item) = ptrval; X ItemCheckproc(item) = checkproc; X X Leave((RTLMenuItem)item) X} X/* ------------------------------------------------------------ */ X XRTLMenuItem RTLMenu_Append_Submenu( menu, str, pix, submenu ) XRTLMenu menu; Xchar *str; Xchar *pix; XRTLMenu submenu; X{ X MenuItem *item = AddMenuItem((Menu*)menu, str, pix); X X Entry("RTLMenu_Append_Submenu") X X ItemSubmenu(item) = (Menu*)submenu; X X Leave((RTLMenuItem)item) X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X Xvoid RTLMenu_Replace_Data_Keyed_String( menu, data, str ) XRTLMenu menu; Xpointer data; Xchar *str; X{ X MenuItem *item = MenuItemByName((Menu*) menu, str); X X Entry("RTLMenu_Replace_Keyed_String") X X if (!ItemIsNull(item)) X ItemData(item) = data; X Leave_void X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X Xvoid RTLMenu_Activate_Entry( menu, item ) XRTLMenu menu; XRTLMenuItem item; X{ X Entry("RTLMenu_Activate_Entry") X X (void)SetItemDisable((Menu*)menu, (MenuItem*)item, FALSE); X Leave_void X} X X/* ------------------------------------------------------------ */ X Xvoid RTLMenu_Inactivate_Entry( menu, item ) XRTLMenu menu; XRTLMenuItem item; X{ X Entry("RTLMenu_Inactivate_Entry") X X (void)SetItemDisable((Menu*)menu, (MenuItem*)item, TRUE); X Leave_void X} X Xvoid RTLMenu_Label_Entry( menu, item ) XRTLMenu menu; XRTLMenuItem item; X{ X Entry("RTLMenu_Label_Entry") X X (void)SetItemDeaf((Menu*)menu, (MenuItem*)item, TRUE); X Leave_void X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X XBoolean RTLMenu_Has_Data( menu, val ) XRTLMenu menu; Xpointer val; X{ X MenuItem *item = MenuItemByData((Menu*)menu, val); X Entry("RTLMenu_Has_Data") X X Leave(!ItemIsNull(item)) X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X Xvoid RTLMenu_Delete_Entries( menu ) XRTLMenu menu; X{ X Entry("RTLMenu_Delete_Entries") X X while (DisposeItem((Menu*)menu, MenuItems((Menu*)menu))); X Leave_void X} X X/* ------------------------------------------------------------ */ X Xvoid RTLMenu_Delete_String( menu, str ) XRTLMenu menu; Xchar *str; X{ X MenuItem *item = MenuItemByName((Menu*) menu, str); X X Entry("RTLMenu_Delete_String"); X X if (!ItemIsNull(item)) X (void) DisposeItem ((Menu*)menu, item); X Leave_void X} X X/* ------------------------------------------------------------ */ X Xvoid RTLMenu_Delete_Data( menu, val ) XRTLMenu menu; Xpointer val; X{ X MenuItem *item = MenuItemByData((Menu*)menu, val); X X Entry("RTLMenu_Delete_Data"); X X if (!ItemIsNull(item)) X (void) DisposeItem((Menu*)menu, item); X Leave_void X} X X/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ X X/*ARGSUSED*/ Xvoid RTLMenu_Box( menu ) XRTLMenu menu; X{ X /* Commented out */ X} X X/* ------------------------------------------------------------ */ X X/*ARGSUSED*/ Xvoid RTLMenu_Enter( menu, butnum, buttime, base_window, pos ) XRTLMenu menu; Xint butnum; XTime buttime; XWindow base_window; XRTLPoint pos; X{ X MenuItem *selected; X X Entry("RTLMenu_Enter") X X menu_pos = pos; X selected = TrackMenu ((Menu*) menu, menu_pos.x, menu_pos.y, X butnum, base_window, buttime); X if (!ItemIsNull(selected)) X (ItemCallback(selected)) (menu, selected, base_window); X Leave_void X} X/* ------------------------------------------------------------ */ X XRTLPoint RTLMenu_Entry_Pos() X{ X Entry("RTLMenu_Entry_Pos") X /* menu_pos is a global static that gets set by the call to */ X /* XQueryPointer that is used by the TrackMenu call. */ X X Leave(menu_pos) X} X X Xvoid RTLMenu_Generate_Items(menu, proc) X/* apply VoidFunc proc to each item in the menu, with */ X/* arguments menu and menuItem */ XRTLMenu menu; XVoidFunc proc; X{ X MenuItem *item; X X Entry("RTLMenu_Generate_Items") X X for (item = MenuItems((Menu*)menu); X !ItemIsNull(item); item = ItemNext(item)) X { X (proc)((RTLMenu)menu, (RTLMenuItem)item); X } X Leave_void X} END_OF_FILE if test 9335 -ne `wc -c <'menus/rtlmenu.c'`; then echo shar: \"'menus/rtlmenu.c'\" unpacked with wrong size! fi # end of 'menus/rtlmenu.c' fi echo shar: End of archive 7 \(of 12\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 12 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 Moderator of comp.sources.x