|
|
1.1 ! root 1: #ifndef lint ! 2: static char *rcsid_Push_c = "$Header: Push.c,v 10.3 86/02/01 16:23:34 tony Rel $"; ! 3: #endif lint ! 4: ! 5: /************************************************************************ ! 6: * * ! 7: * Copyright (c) 1986 by * ! 8: * Digital Equipment Corporation, Maynard, MA * ! 9: * All Rights Reserved. * ! 10: * * ! 11: * Permission to use, copy, modify, and distribute this software * ! 12: * and its documentation is hereby granted only to licensees of * ! 13: * The Regents of the University of California pursuant to their * ! 14: * license agreement for the Berkeley Software Distribution * ! 15: * provided that the following appears on all copies. * ! 16: * * ! 17: * "LICENSED FROM DIGITAL EQUIPMENT CORPORATION * ! 18: * COPYRIGHT (C) 1986 * ! 19: * DIGITAL EQUIPMENT CORPORATION * ! 20: * MAYNARD, MA * ! 21: * ALL RIGHTS RESERVED. * ! 22: * * ! 23: * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT * ! 24: * NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL * ! 25: * EQUIPMENT CORPORATION. DIGITAL MAKES NO REPRESENTATIONS * ! 26: * ABOUT SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS * ! 27: * SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * ! 28: * * ! 29: * IF THE UNIVERSITY OF CALIFORNIA OR ITS LICENSEES MODIFY * ! 30: * THE SOFTWARE IN A MANNER CREATING DERIVATIVE COPYRIGHT * ! 31: * RIGHTS APPROPRIATE COPYRIGHT LEGENDS MAY BE PLACED ON THE * ! 32: * DERIVATIVE WORK IN ADDITION TO THAT SET FORTH ABOVE." * ! 33: * * ! 34: ************************************************************************/ ! 35: ! 36: ! 37: /* ! 38: * MODIFICATION HISTORY ! 39: * ! 40: * 000 -- M. Gancarz, DEC Ultrix Engineering Group ! 41: */ ! 42: ! 43: #ifndef lint ! 44: static char *sccsid = "@(#)Push.c 3.8 1/24/86"; ! 45: #endif ! 46: ! 47: #include "uwm.h" ! 48: ! 49: #define PUSH_DOWN 1 ! 50: #define PUSH_UP 2 ! 51: #define PUSH_LEFT 3 ! 52: #define PUSH_RIGHT 4 ! 53: ! 54: extern Bool PushAll(); ! 55: ! 56: Bool PushDown(window, mask, button, x, y) ! 57: Window window; /* Event window. */ ! 58: int mask; /* Button/key mask. */ ! 59: short button; /* Button event detail. */ ! 60: int x, y; /* Event mouse position. */ ! 61: { ! 62: return(PushAll(window, PUSH_DOWN)); ! 63: } ! 64: ! 65: Bool PushUp(window, mask, button, x, y) ! 66: Window window; /* Event window. */ ! 67: int mask; /* Button/key mask. */ ! 68: short button; /* Button event detail. */ ! 69: int x, y; /* Event mouse position. */ ! 70: { ! 71: return(PushAll(window, PUSH_UP)); ! 72: } ! 73: ! 74: Bool PushLeft(window, mask, button, x, y) ! 75: Window window; /* Event window. */ ! 76: int mask; /* Button/key mask. */ ! 77: short button; /* Button event detail. */ ! 78: int x, y; /* Event mouse position. */ ! 79: { ! 80: return(PushAll(window, PUSH_LEFT)); ! 81: } ! 82: ! 83: Bool PushRight(window, mask, button, x, y) ! 84: Window window; /* Event window. */ ! 85: int mask; /* Button/key mask. */ ! 86: short button; /* Button event detail. */ ! 87: int x, y; /* Event mouse position. */ ! 88: { ! 89: return(PushAll(window, PUSH_RIGHT)); ! 90: } ! 91: ! 92: Bool PushAll(w, direction) ! 93: Window w; ! 94: int direction; ! 95: { ! 96: WindowInfo winfo; /* Event window information. */ ! 97: WindowInfo rinfo; /* Root window information. */ ! 98: int xofs, yofs; /* Movement offsets. */ ! 99: int x, y; /* New window position. */ ! 100: ! 101: /* ! 102: * Do not try to move the root window. ! 103: */ ! 104: if (w == RootWindow) ! 105: return(FALSE); ! 106: ! 107: /* ! 108: * Gather info on the event window. ! 109: */ ! 110: status = XQueryWindow(w, &winfo); ! 111: if (status == FAILURE) return(FALSE); ! 112: ! 113: /* ! 114: * Calculate the movement offsets. ! 115: */ ! 116: switch(direction) { ! 117: case PUSH_DOWN: ! 118: xofs = 0; ! 119: yofs = Push ? (winfo.height / Pushval) : Pushval; ! 120: break; ! 121: case PUSH_UP: ! 122: xofs = 0; ! 123: yofs = 0 - (Push ? (winfo.height / Pushval) : Pushval); ! 124: break; ! 125: case PUSH_LEFT: ! 126: xofs = 0 - (Push ? (winfo.width / Pushval) : Pushval); ! 127: yofs = 0; ! 128: break; ! 129: case PUSH_RIGHT: ! 130: xofs = Push ? (winfo.width / Pushval) : Pushval; ! 131: yofs = 0; ! 132: break; ! 133: } ! 134: ! 135: /* ! 136: * Calculate the new window position. ! 137: */ ! 138: x = winfo.x + xofs; ! 139: y = winfo.y + yofs; ! 140: ! 141: /* ! 142: * Normalize the new window coordinates so we don't ! 143: * lose the window off the edge of the screen. ! 144: */ ! 145: if (x < (0 - winfo.width + CURSOR_WIDTH - (winfo.bdrwidth << 1))) ! 146: x = 0 - winfo.width + CURSOR_WIDTH - (winfo.bdrwidth << 1); ! 147: if (y < (0 - winfo.height + CURSOR_HEIGHT - (winfo.bdrwidth << 1))) ! 148: y = 0 - winfo.height + CURSOR_HEIGHT - (winfo.bdrwidth << 1); ! 149: if (x > (ScreenWidth - CURSOR_WIDTH)) ! 150: x = ScreenWidth - CURSOR_WIDTH; ! 151: if (y > (ScreenHeight - CURSOR_HEIGHT)) ! 152: y = ScreenHeight - CURSOR_HEIGHT; ! 153: ! 154: /* ! 155: * Move the window into place. ! 156: */ ! 157: XMoveWindow(w, x, y); ! 158: ! 159: return(FALSE); ! 160: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.