Annotation of researchv9/X11/src/X.V11R1/lib/Xtk/Geometry.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char rcsid[] = "$Header: Geometry.c,v 1.15 87/09/11 21:23:59 haynes Rel $";
        !             3: #endif lint
        !             4: 
        !             5: /*
        !             6:  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
        !             7:  * 
        !             8:  *                         All Rights Reserved
        !             9:  * 
        !            10:  * Permission to use, copy, modify, and distribute this software and its 
        !            11:  * documentation for any purpose and without fee is hereby granted, 
        !            12:  * provided that the above copyright notice appear in all copies and that
        !            13:  * both that copyright notice and this permission notice appear in 
        !            14:  * supporting documentation, and that the name of Digital Equipment
        !            15:  * Corporation not be used in advertising or publicity pertaining to
        !            16:  * distribution of the software without specific, written prior permission.  
        !            17:  * 
        !            18:  * 
        !            19:  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
        !            20:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
        !            21:  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
        !            22:  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
        !            23:  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
        !            24:  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
        !            25:  * SOFTWARE.
        !            26:  */
        !            27: /* File: Geometry.c */
        !            28: 
        !            29: #include "Intrinsic.h"
        !            30: 
        !            31: /* Public routines */
        !            32: 
        !            33: void XtResizeWindow(w)
        !            34:     Widget w;
        !            35: {
        !            36:     if (XtIsRealized(w)) {
        !            37:        XWindowChanges changes;
        !            38:        changes.width = w->core.width;
        !            39:        changes.height = w->core.height;
        !            40:        changes.border_width = w->core.border_width;
        !            41:        XConfigureWindow(XtDisplay(w), XtWindow(w),
        !            42:            (unsigned) CWWidth | CWHeight | CWBorderWidth, &changes);
        !            43:     }
        !            44: } /* XtResizeWindow */
        !            45: 
        !            46: 
        !            47: void XtResizeWidget(w, width, height, borderWidth)
        !            48:     Widget w;
        !            49:     Dimension height, width, borderWidth;
        !            50: {
        !            51:     XWindowChanges changes;
        !            52:     Cardinal mask = 0;
        !            53: 
        !            54:     if (w->core.width != width) {
        !            55:        changes.width = w->core.width = width;
        !            56:        mask |= CWWidth;
        !            57:     }
        !            58: 
        !            59:     if (w->core.height != height) {
        !            60:        changes.height = w->core.height = height;
        !            61:        mask |= CWHeight;
        !            62:     }
        !            63: 
        !            64:     if (w->core.border_width != borderWidth) {
        !            65:        changes.border_width = w->core.border_width = borderWidth;
        !            66:        mask |= CWBorderWidth;
        !            67:     }
        !            68: 
        !            69:     if (mask != 0) {
        !            70:        if (XtIsRealized(w))
        !            71:            XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);
        !            72:     if ((mask & (CWWidth | CWHeight)) &&
        !            73:        XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
        !            74:            w->core.widget_class->core_class.resize(w);
        !            75:     }
        !            76: } /* XtResizeWidget */
        !            77: 
        !            78: XtGeometryResult XtMakeGeometryRequest (widget, request, reply)
        !            79:     Widget         widget;
        !            80:     XtWidgetGeometry *request, *reply;
        !            81: {
        !            82:     XtWidgetGeometry    junk;
        !            83:     XtGeometryHandler manager;
        !            84:     XtGeometryResult returnCode;
        !            85: 
        !            86:     if (! XtIsComposite(widget->core.parent)) {
        !            87:        /* Should never happen - XtCreateWidget should have checked */
        !            88:        XtError("XtMakeGeometryRequest - parent not composite");
        !            89:     }
        !            90:     manager = ((CompositeWidgetClass) (widget->core.parent->core.widget_class))
        !            91:                ->composite_class.geometry_manager;
        !            92:     if (manager == (XtGeometryHandler) NULL) {
        !            93:        XtError("XtMakeGeometryRequest - parent has no geometry manger");
        !            94:     }
        !            95:     if ( ! widget->core.managed) {
        !            96:        XtWarning("XtMakeGeometryRequest - widget not managed");
        !            97:        return XtGeometryNo;
        !            98:     }
        !            99:     if (widget->core.being_destroyed) {
        !           100:         return XtGeometryNo;
        !           101:     }
        !           102:     if (reply == (XtWidgetGeometry *) NULL) {
        !           103:         returnCode = (*manager)(widget, request, &junk);
        !           104:     } else {
        !           105:        returnCode = (*manager)(widget, request, reply);
        !           106:     }
        !           107:     /* ||| Right now this is automatic.  However, we may want it to be
        !           108:     explicitely called by geometry manager in order to effect the window resize
        !           109:     (especially to smaller size) before the windows are layed out. */
        !           110:     if (returnCode == XtGeometryYes) {
        !           111:        XtResizeWindow(widget);
        !           112:     }
        !           113:     return returnCode;
        !           114: } /* XtMakeGeometryRequest */
        !           115: 
        !           116: XtGeometryResult XtMakeResizeRequest
        !           117:        (widget, width, height, replyWidth, replyHeight)
        !           118:     Widget     widget;
        !           119:     Dimension  width, height;
        !           120:     Dimension  *replyWidth, *replyHeight;
        !           121: {
        !           122:     XtWidgetGeometry request, reply;
        !           123:     XtGeometryResult r;
        !           124: 
        !           125:     request.request_mode = CWWidth | CWHeight;
        !           126:     request.width = width;
        !           127:     request.height = height;
        !           128:     r = XtMakeGeometryRequest(widget, &request, &reply);
        !           129:     if (replyWidth != NULL)
        !           130:        if (r == XtGeometryAlmost && reply.request_mode & CWWidth)
        !           131:            *replyWidth = reply.width;
        !           132:        else
        !           133:            *replyWidth = width;
        !           134:     if (replyHeight != NULL)
        !           135:        if (r == XtGeometryAlmost && reply.request_mode & CWHeight)
        !           136:            *replyHeight = reply.height;
        !           137:        else
        !           138:            *replyWidth = width;
        !           139:     return r;
        !           140: } /* XtMakeResizeRequest */
        !           141: 
        !           142: void XtMoveWidget(w, x, y)
        !           143:     Widget w;
        !           144:     Position x, y;
        !           145: {
        !           146:     if ((w->core.x != x) || (w->core.y != y)) {
        !           147:        w->core.x = x;
        !           148:        w->core.y = y;
        !           149:        if (XtIsRealized(w)) {
        !           150:            XMoveWindow(XtDisplay(w), XtWindow(w), w->core.x, w->core.y);
        !           151:         }
        !           152:     }
        !           153: } /* XtMoveWidget */
        !           154: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.