|
|
1.1 root 1: /* $Header: Geometry.c,v 1.1 87/09/11 07:57:54 toddb Exp $ */
2: #ifndef lint
3: static char *sccsid = "@(#)Geometry.c 1.7 2/25/87";
4: #endif lint
5:
6: /*
7: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
8: *
9: * All Rights Reserved
10: *
11: * Permission to use, copy, modify, and distribute this software and its
12: * documentation for any purpose and without fee is hereby granted,
13: * provided that the above copyright notice appear in all copies and that
14: * both that copyright notice and this permission notice appear in
15: * supporting documentation, and that the name of Digital Equipment
16: * Corporation not be used in advertising or publicity pertaining to
17: * distribution of the software without specific, written prior permission.
18: *
19: *
20: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
21: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
22: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
24: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26: * SOFTWARE.
27: */
28:
29:
30: /* File: Geometry.c */
31:
32: #include "Xlib.h"
33: #include "Intrinsic.h"
34:
35: /* Private Definitions */
36:
37: static XContext geometryContext;
38:
39: static Boolean initialized = FALSE;
40:
41: extern void GeometryInitialize()
42: {
43: if (initialized)
44: return;
45: initialized = TRUE;
46:
47: geometryContext = XUniqueContext();
48: }
49:
50: /* Public routines */
51:
52: /*
53: * The "normal" case is for the geometry manager to be associated with a
54: * windows parent. This code currently looks for an association on the passed
55: * window then it's parent. In the real version of this code the request
56: * should propagate up the tree. Note that parent windows may not be in the
57: * requesting windows address space and the propagation will require a server
58: * dialog.
59: */
60:
61: XtGeometryReturnCode XtMakeGeometryRequest
62: (dpy, window, request, requestBox, replyBox)
63: Display *dpy;
64: Window window;
65: XtGeometryRequest request;
66: WindowBox *requestBox, *replyBox;
67: {
68: XtGeometryHandler proc;
69: int error;
70:
71: error = XFindContext (dpy, window, geometryContext, (caddr_t *) &proc);
72: if (error == XCNOENT)
73: return(XtgeometryNoManager);
74: return ((*(proc)) (dpy, window, request, requestBox, replyBox));
75: }
76:
77: /*
78: * Register a geometry routine with the toolkit dispatcher.
79: */
80:
81: XtStatus XtSetGeometryHandler (dpy, w, proc)
82: Display *dpy;
83: Window w;
84: XtGeometryHandler proc;
85: {
86: return (XSaveContext (dpy, w, geometryContext, (caddr_t) proc));
87: }
88:
89: /*
90: * Return the geometry procedure associated with a widget.
91: */
92:
93: XtStatus XtGetGeometryHandler (dpy, w, proc)
94: Display *dpy;
95: Window w;
96: XtGeometryHandler *proc;
97: {
98: return (XFindContext(dpy, w, geometryContext, (caddr_t *) proc));
99: }
100:
101: /*
102: * Delete the geometry routine's entry in the toolkit dispatcher.
103: */
104:
105: XtStatus XtClearGeometryHandler (dpy, w)
106: Display *dpy;
107: Window w;
108: {
109: return(XDeleteContext (dpy, w, geometryContext));
110: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.