Example #1
0
static void CallChangeManaged(
    register Widget		widget)
{
    register Cardinal		i;
    XtWidgetProc		change_managed;
    register WidgetList		children;
    int    			managed_children = 0;

    register CompositePtr cpPtr;
    register CompositePartPtr clPtr;

    if (XtIsComposite (widget)) {
        cpPtr = (CompositePtr)&((CompositeWidget) widget)->composite;
        clPtr = (CompositePartPtr)&((CompositeWidgetClass)
                                    widget->core.widget_class)->composite_class;
    } else return;

    children = cpPtr->children;
    LOCK_PROCESS;
    change_managed = clPtr->change_managed;
    UNLOCK_PROCESS;

    /* CallChangeManaged for all children */
    for (i = cpPtr->num_children; i != 0; --i) {
        CallChangeManaged (children[i-1]);
        if (XtIsManaged(children[i-1])) managed_children++;
    }

    if (change_managed != NULL && managed_children != 0) {
        CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s changemanaged\n",
                               XtName(widget),
                               widget->core.width, widget->core.height));
        (*change_managed) (widget);
    }
} /* CallChangeManaged */
Example #2
0
static void UnmanageChildren(
    WidgetList children,
    Cardinal num_children,
    Widget parent,
    Cardinal* num_unique_children,
    Boolean call_change_managed,
    String caller_func)
{
    Widget		child;
    Cardinal		i;
    XtWidgetProc	change_managed = NULL;
    Bool		parent_realized = False;

    *num_unique_children = 0;

    if (XtIsComposite((Widget) parent)) {
	LOCK_PROCESS;
        change_managed = ((CompositeWidgetClass) parent->core.widget_class)
		    ->composite_class.change_managed;
	UNLOCK_PROCESS;
	parent_realized = XtIsRealized((Widget)parent);
    } else {
        XtAppErrorMsg(XtWidgetToApplicationContext((Widget)parent),
		      "invalidParent",caller_func, XtCXtToolkitError,
		   "Attempt to unmanage a child when parent is not Composite",
		      (String *) NULL, (Cardinal *) NULL);
    }

    for (i = 0; i < num_children; i++) {
	child = children[i];
	if (child == NULL) {
	    XtAppWarningMsg(XtWidgetToApplicationContext(parent),
		  XtNinvalidChild,caller_func,XtCXtToolkitError,
                  "Null child passed to XtUnmanageChildren",
		  (String *)NULL, (Cardinal *)NULL);
	    return;
	}
        if (child->core.parent != parent) {
	   XtAppWarningMsg(XtWidgetToApplicationContext(parent),
		   "ambiguousParent",caller_func,XtCXtToolkitError,
           "Not all children have same parent in UnmanageChildren",
             (String *)NULL, (Cardinal *)NULL);
	} else
        if (child->core.managed) {
            (*num_unique_children)++;
	    CALLGEOTAT(_XtGeoTrace(child,"Child \"%s\" is marked unmanaged\n", 
			   XtName(child)));
	    child->core.managed = FALSE;
            if (XtIsWidget(child)
		&& XtIsRealized(child)
		&& child->core.mapped_when_managed)
                    XtUnmapWidget(child);
            else
	    { /* RectObj child */
		Widget pw = child->core.parent;
		RectObj r = (RectObj) child;
		while ((pw!=NULL) && (!XtIsWidget(pw))) pw = pw->core.parent;
		if ((pw!=NULL) && XtIsRealized (pw))
		    XClearArea (XtDisplay (pw), XtWindow (pw),
			r->rectangle.x, r->rectangle.y,
			r->rectangle.width + (r->rectangle.border_width << 1),
			r->rectangle.height + (r->rectangle.border_width << 1),
			TRUE);
	    }

        }
    }
    if (call_change_managed && *num_unique_children != 0 &&
	change_managed != NULL && parent_realized) {
	CALLGEOTAT(_XtGeoTrace((Widget)parent,
		       "Call parent: \"%s\"[%d,%d]'s changemanaged proc\n", 
		       XtName((Widget)parent),
		       parent->core.width,parent->core.height));
	(*change_managed) (parent);
    }
} /* UnmanageChildren */
Example #3
0
static void RealizeWidget(
    Widget			widget)
{
    XtValueMask			value_mask;
    XSetWindowAttributes	values;
    XtRealizeProc		realize;
    Window			window;
    Display*			display;
    String			class_name;
    Widget			hookobj;

    if (!XtIsWidget(widget) || XtIsRealized(widget)) return;
    display = XtDisplay(widget);
    _XtInstallTranslations(widget);

    ComputeWindowAttributes (widget, &value_mask, &values);
    LOCK_PROCESS;
    realize = widget->core.widget_class->core_class.realize;
    class_name = widget->core.widget_class->core_class.class_name;
    UNLOCK_PROCESS;
    if (realize == NULL)
        XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                      "invalidProcedure","realizeProc",XtCXtToolkitError,
                      "No realize class procedure defined",
                      (String *)NULL, (Cardinal *)NULL);
    else {
        CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s realize proc\n",
                               XtName(widget),
                               widget->core.width, widget->core.height));
        (*realize) (widget, &value_mask, &values);
    }
    window = XtWindow(widget);
    hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
    if (XtHasCallbacks(hookobj,XtNchangeHook) == XtCallbackHasSome) {
        XtChangeHookDataRec call_data;

        call_data.type = XtHrealizeWidget;
        call_data.widget = widget;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.changehook_callbacks,
                           (XtPointer)&call_data);
    }
#ifndef NO_IDENTIFY_WINDOWS
    if (_XtGetPerDisplay(display)->appContext->identify_windows) {
        int len_nm, len_cl;
        char *s;

        len_nm = widget->core.name ? strlen(widget->core.name) : 0;
        len_cl = strlen(class_name);
        s = __XtMalloc((unsigned) (len_nm + len_cl + 2));
        s[0] = '\0';
        if (len_nm)
            strcpy(s, widget->core.name);
        strcpy(s + len_nm + 1, class_name);
        XChangeProperty(display, window,
                        XInternAtom(display, "_MIT_OBJ_CLASS",
                                    False),
                        XA_STRING, 8, PropModeReplace, (unsigned char *) s,
                        len_nm + len_cl + 2);
        XtFree(s);
    }
#endif
#ifdef notdef
    _XtRegisterAsyncHandlers(widget);
#endif
    /* (re)register any grabs extant in the translations */
    _XtRegisterGrabs(widget);
    /* reregister any grabs added with XtGrab{Button,Key} */
    _XtRegisterPassiveGrabs(widget);
    XtRegisterDrawable (display, window, widget);
    _XtExtensionSelect(widget);

    if (XtIsComposite (widget)) {
        Cardinal		i;
        CompositePart *cwp = &(((CompositeWidget)widget)->composite);
        WidgetList children = cwp->children;
        /* Realize all children */
        for (i = cwp->num_children; i != 0; --i) {
            RealizeWidget (children[i-1]);
        }
        /* Map children that are managed and mapped_when_managed */

        if (cwp->num_children != 0) {
            if (ShouldMapAllChildren(cwp)) {
                XMapSubwindows (display, window);
            } else {
                MapChildren(cwp);
            }
        }
    }

    /* If this is the application's popup shell, map it */
    if (widget->core.parent == NULL && widget->core.mapped_when_managed) {
        XtMapWidget (widget);
    }
} /* RealizeWidget */
Example #4
0
static void ManageChildren(
    WidgetList  children,
    Cardinal    num_children,
    Widget	parent,
    Boolean	call_change_managed,
    String	caller_func)
{
#define MAXCHILDREN 100
    Widget		child;
    Cardinal		num_unique_children, i;
    XtWidgetProc	change_managed = NULL;
    WidgetList		unique_children;
    Widget		cache[MAXCHILDREN];
    Bool		parent_realized = False;

    if (XtIsComposite((Widget) parent)) {
	LOCK_PROCESS;
        change_managed = ((CompositeWidgetClass) parent->core.widget_class)
		    ->composite_class.change_managed;
	UNLOCK_PROCESS;
	parent_realized = XtIsRealized((Widget)parent);
    } else {
	XtAppErrorMsg(XtWidgetToApplicationContext((Widget)parent),
		"invalidParent",caller_func, XtCXtToolkitError,
	    "Attempt to manage a child when parent is not Composite",
	    (String *) NULL, (Cardinal *) NULL);
    }

    /* Construct new list of children that really need to be operated upon. */
    if (num_children <= MAXCHILDREN) {
	unique_children = cache;
    } else {
	unique_children = (WidgetList) __XtMalloc(num_children * sizeof(Widget));
    }
    num_unique_children = 0;
    for (i = 0; i < num_children; i++) {
	child = children[i];
	if (child == NULL) {
	    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
		XtNinvalidChild,caller_func,XtCXtToolkitError,
		"null child passed to ManageChildren",
		(String *)NULL, (Cardinal *)NULL);
	    if (unique_children != cache) XtFree((char *) unique_children);
	    return;
	}
#ifdef DEBUG
	if (!XtIsRectObj(child)) {
	    String params[2];
	    Cardinal num_params = 2;
	    params[0] = XtName(child);
	    params[1] = child->core.widget_class->core_class.class_name;
	    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
			    "notRectObj",caller_func,XtCXtToolkitError,
			    "child \"%s\", class %s is not a RectObj",
			    params, &num_params);
	    continue;
	}
#endif /*DEBUG*/
        if (child->core.parent != parent) {
	    XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
		    "ambiguousParent",caller_func,XtCXtToolkitError,
		"Not all children have same parent in XtManageChildren",
		(String *)NULL, (Cardinal *)NULL);
	} else if (! child->core.managed && !child->core.being_destroyed) {
	    unique_children[num_unique_children++] = child;
	    CALLGEOTAT(_XtGeoTrace(child,
			   "Child \"%s\"[%d,%d] is marked managed\n",
			   XtName(child),
			   child->core.width,child->core.height));
	    child->core.managed = TRUE;
	}
    }

    if ((call_change_managed || num_unique_children != 0) && parent_realized) {
	/* Compute geometry of new managed set of children. */
	if (change_managed != NULL) {
	    CALLGEOTAT(_XtGeoTrace((Widget)parent,
			   "Call parent: \"%s\"[%d,%d]'s changemanaged\n",
			   XtName((Widget)parent),
			   parent->core.width,parent->core.height));
	    (*change_managed) ((Widget)parent);
	}

	/* Realize each child if necessary, then map if necessary */
	for (i = 0; i < num_unique_children; i++) {
	    child = unique_children[i];
	    if (XtIsWidget(child)) {
		if (! XtIsRealized(child)) XtRealizeWidget(child);
		if (child->core.mapped_when_managed) XtMapWidget(child);
	    } else { /* RectObj child */
		Widget pw = child->core.parent;
		RectObj r = (RectObj) child;
		while ((pw!=NULL) && (!XtIsWidget(pw)))
		    pw = pw->core.parent;
		if (pw != NULL)
		    XClearArea (XtDisplay (pw), XtWindow (pw),
		    r->rectangle.x, r->rectangle.y,
		    r->rectangle.width + (r->rectangle.border_width << 1),
		    r->rectangle.height + (r->rectangle.border_width << 1),
		    TRUE);
            }
        }
    }

    if (unique_children != cache) XtFree((char *) unique_children);
} /* ManageChildren */
Example #5
0
XtGeometryResult
_XtMakeGeometryRequest (
    Widget widget,
    XtWidgetGeometry *request,
    XtWidgetGeometry *reply,
    Boolean * clear_rect_obj)
{
    XtWidgetGeometry    junk;
    XtGeometryHandler manager = (XtGeometryHandler) NULL;
    XtGeometryResult returnCode;
    Widget parent = widget->core.parent;
    Boolean managed, parentRealized, rgm = False;
    XtConfigureHookDataRec req;
    Widget hookobj;

    *clear_rect_obj = FALSE;

    CALLGEOTAT(_XtGeoTrace(widget,
                           "\"%s\" is making a %sgeometry request to its parent \"%s\".\n",
                           XtName(widget),
                           ((request->request_mode & XtCWQueryOnly))? "query only ":"",
                           (XtParent(widget))?XtName(XtParent(widget)):"Root"));
    CALLGEOTAT(_XtGeoTab(1));

    if (XtIsShell(widget)) {
        ShellClassExtension ext;
        LOCK_PROCESS;
        for (ext = (ShellClassExtension)((ShellWidgetClass)XtClass(widget))
                   ->shell_class.extension;
                ext != NULL && ext->record_type != NULLQUARK;
                ext = (ShellClassExtension)ext->next_extension);

        if (ext != NULL) {
            if (  ext->version == XtShellExtensionVersion
                    && ext->record_size == sizeof(ShellClassExtensionRec)) {
                manager = ext->root_geometry_manager;
                rgm = True;
            } else {
                String params[1];
                Cardinal num_params = 1;
                params[0] = XtClass(widget)->core_class.class_name;
                XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                              "invalidExtension", "xtMakeGeometryRequest",
                              XtCXtToolkitError,
                              "widget class %s has invalid ShellClassExtension record",
                              params, &num_params);
            }
        } else {
            XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                          "internalError", "xtMakeGeometryRequest",
                          XtCXtToolkitError,
                          "internal error; ShellClassExtension is NULL",
                          NULL, NULL);
        }
        managed = True;
        parentRealized = TRUE;
        UNLOCK_PROCESS;
    } else { /* not shell */
        if (parent == NULL)
            XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                          "invalidParent","xtMakeGeometryRequest",
                          XtCXtToolkitError,
                          "non-shell has no parent in XtMakeGeometryRequest",
                          (String *)NULL, (Cardinal *)NULL);

        managed = XtIsManaged(widget);
        parentRealized = XtIsRealized(parent);
        if (XtIsComposite(parent))
        {
            LOCK_PROCESS;
            manager = ((CompositeWidgetClass) (parent->core.widget_class))
                      ->composite_class.geometry_manager;
            UNLOCK_PROCESS;
        }
    }

#if 0
    /*
     * The Xt spec says that these conditions must generate
     * error messages (not warnings), but many Xt applications
     * and toolkits (including parts of Xaw, Motif and Netscape)
     * depend on the previous Xt behaviour.  Thus, these tests
     * should probably remain disabled.
     */
    if (parentRealized && managed) {
        if (parent && !XtIsComposite(parent))
        {
            /*
             * This shouldn't ever happen, we only test for this to pass
             * VSW5.  Normally managing the widget will catch this, but VSW5
             * does some really screwy stuff to get here.
             */
            XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                          "invalidParent", "xtMakeGeometryRequest",
                          XtCXtToolkitError,
                          "XtMakeGeometryRequest - parent not composite",
                          (String *)NULL, (Cardinal *)NULL);
        }
        else if (manager == (XtGeometryHandler) NULL)
        {
            XtAppErrorMsg(XtWidgetToApplicationContext(widget),
                          "invalidGeometryManager","xtMakeGeometryRequest",
                          XtCXtToolkitError,
                          "XtMakeGeometryRequest - parent has no geometry manager",
                          (String *)NULL, (Cardinal *)NULL);
        }
    }
#else
    if (!manager)
        managed = False;
#endif

    if (widget->core.being_destroyed) {
        CALLGEOTAT(_XtGeoTab(-1));
        CALLGEOTAT(_XtGeoTrace(widget,
                               "It is being destroyed, just return XtGeometryNo.\n"));
        return XtGeometryNo;
    }

    /* see if requesting anything to change */
    req.changeMask = 0;
    if (request->request_mode & CWStackMode
            && request->stack_mode != XtSMDontChange) {
        req.changeMask |= CWStackMode;
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for a change in StackMode!\n"));
        if (request->request_mode & CWSibling) {
            XtCheckSubclass(request->sibling, rectObjClass,
                            "XtMakeGeometryRequest");
            req.changeMask |= CWSibling;
        }
    }
    if (request->request_mode & CWX
            && widget->core.x != request->x) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for a change in x: from %d to %d.\n",
                               widget->core.x, request->x));
        req.changeMask |= CWX;
    }
    if (request->request_mode & CWY
            && widget->core.y != request->y) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for a change in y: from %d to %d.\n",
                               widget->core.y, request->y));
        req.changeMask |= CWY;
    }
    if (request->request_mode & CWWidth
            && widget->core.width != request->width) {
        CALLGEOTAT(_XtGeoTrace(widget,"Asking for a change in width: from %d to %d.\n",
                               widget->core.width, request->width));
        req.changeMask |= CWWidth;
    }
    if (request->request_mode & CWHeight
            && widget->core.height != request->height) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for a change in height: from %d to %d.\n",
                               widget->core.height, request->height));
        req.changeMask |= CWHeight;
    }
    if (request->request_mode & CWBorderWidth
            && widget->core.border_width != request->border_width) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for a change in border_width: from %d to %d.\n",
                               widget->core.border_width, request->border_width));
        req.changeMask |= CWBorderWidth;
    }
    if (! req.changeMask) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Asking for nothing new,\n"));
        CALLGEOTAT(_XtGeoTab(-1));
        CALLGEOTAT(_XtGeoTrace(widget,
                               "just return XtGeometryYes.\n"));
        return XtGeometryYes;
    }
    req.changeMask |= (request->request_mode & XtCWQueryOnly);

    if ( !(req.changeMask & XtCWQueryOnly) && XtIsRealized(widget) ) {
        /* keep record of the current geometry so we know what's changed */
        req.changes.x = widget->core.x ;
        req.changes.y = widget->core.y ;
        req.changes.width = widget->core.width ;
        req.changes.height = widget->core.height ;
        req.changes.border_width = widget->core.border_width ;
    }

    if (!managed || !parentRealized) {
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Not Managed or Parent not realized.\n"));
        /* Don't get parent's manager involved--assume the answer is yes */
        if (req.changeMask & XtCWQueryOnly) {
            /* He was just asking, don't change anything, just tell him yes */
            CALLGEOTAT(_XtGeoTrace(widget,"QueryOnly request\n"));
            CALLGEOTAT(_XtGeoTab(-1));
            CALLGEOTAT(_XtGeoTrace(widget,"just return XtGeometryYes.\n"));
            return XtGeometryYes;
        } else {
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "Copy values from request to widget.\n"));
            /* copy values from request to widget */
            if (request->request_mode & CWX)
                widget->core.x = request->x;
            if (request->request_mode & CWY)
                widget->core.y = request->y;
            if (request->request_mode & CWWidth)
                widget->core.width = request->width;
            if (request->request_mode & CWHeight)
                widget->core.height = request->height;
            if (request->request_mode & CWBorderWidth)
                widget->core.border_width = request->border_width;
            if (!parentRealized) {
                CALLGEOTAT(_XtGeoTab(-1));
                CALLGEOTAT(_XtGeoTrace(widget,"and return XtGeometryYes.\n"));
                return XtGeometryYes;
            }
            else returnCode = XtGeometryYes;
        }
    } else {
        /* go ask the widget's geometry manager */
        CALLGEOTAT(_XtGeoTrace(widget,
                               "Go ask the parent geometry manager.\n"));
        if (reply == (XtWidgetGeometry *) NULL) {
            returnCode = (*manager)(widget, request, &junk);
        } else {
            returnCode = (*manager)(widget, request, reply);
        }
    }

    /*
     * If Unrealized, not a XtGeometryYes, or a query-only then we are done.
     */

    if ((returnCode != XtGeometryYes) ||
            (req.changeMask & XtCWQueryOnly) || !XtIsRealized(widget)) {

#ifdef XT_GEO_TATTLER
        switch(returnCode) {
        case XtGeometryNo:
            CALLGEOTAT(_XtGeoTab(-1));
            CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryNo.\n",
                                   (XtParent(widget))?XtName(XtParent(widget)):"Root"));
            /* check for no change */
            break ;
        case XtGeometryDone:
            CALLGEOTAT(_XtGeoTab(-1));
            CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryDone.\n",
                                   (XtParent(widget))?XtName(XtParent(widget)):"Root"));
            /* check for no change in queryonly */
            break ;
        case XtGeometryAlmost:
            CALLGEOTAT(_XtGeoTab(-1));
            CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryAlmost.\n",
                                   (XtParent(widget))?XtName(XtParent(widget)):"Root"));
            CALLGEOTAT(_XtGeoTab(1));
            CALLGEOTAT(_XtGeoTrace(widget,"Proposal: width %d height %d.\n",
                                   (reply)?reply->width:junk.width,
                                   (reply)?reply->height:junk.height));
            CALLGEOTAT(_XtGeoTab(-1));

            /* check for no change */
            break ;
        case XtGeometryYes:
            if (req.changeMask & XtCWQueryOnly) {
                CALLGEOTAT(_XtGeoTrace(widget,
                                       "QueryOnly specified, no configuration.\n"));
            }
            if (!XtIsRealized(widget)) {
                CALLGEOTAT(_XtGeoTrace(widget,
                                       "\"%s\" not realized, no configuration.\n",
                                       XtName(widget)));
            }
            CALLGEOTAT(_XtGeoTab(-1));
            CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryYes.\n",
                                   (XtParent(widget))?XtName(XtParent(widget)):"Root"));
            break ;
        }
#endif
        return returnCode;
    }

    CALLGEOTAT(_XtGeoTab(-1));
    CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryYes.\n",
                           (XtParent(widget))?XtName(XtParent(widget)):"Root"));

    if (XtIsWidget(widget)) {	/* reconfigure the window (if needed) */

        if (rgm) return returnCode;

        if (req.changes.x != widget->core.x) {
            req.changeMask |= CWX;
            req.changes.x = widget->core.x;
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "x changing to %d\n",widget->core.x));
        }
        if (req.changes.y != widget->core.y) {
            req.changeMask |= CWY;
            req.changes.y = widget->core.y;
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "y changing to %d\n",widget->core.y));
        }
        if (req.changes.width != widget->core.width) {
            req.changeMask |= CWWidth;
            req.changes.width = widget->core.width;
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "width changing to %d\n",widget->core.width));
        }
        if (req.changes.height != widget->core.height) {
            req.changeMask |= CWHeight;
            req.changes.height = widget->core.height;
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "height changing to %d\n",widget->core.height));
        }
        if (req.changes.border_width != widget->core.border_width) {
            req.changeMask |= CWBorderWidth;
            req.changes.border_width = widget->core.border_width;
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "border_width changing to %d\n",
                                   widget->core.border_width));
        }
        if (req.changeMask & CWStackMode) {
            req.changes.stack_mode = request->stack_mode;
            CALLGEOTAT(_XtGeoTrace(widget,"stack_mode changing\n"));
            if (req.changeMask & CWSibling) {
                if (XtIsWidget(request->sibling))
                    req.changes.sibling = XtWindow(request->sibling);
                else
                    req.changeMask &= ~(CWStackMode | CWSibling);
            }
        }

#ifdef XT_GEO_TATTLER
        if (req.changeMask) {
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "XConfigure \"%s\"'s window.\n",
                                   XtName(widget)));
        } else {
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "No window configuration needed for \"%s\".\n",
                                   XtName(widget)));
        }
#endif

        XConfigureWindow(XtDisplay(widget), XtWindow(widget),
                         req.changeMask, &req.changes);
    }
    else {			/* RectObj child of realized Widget */
        *clear_rect_obj = TRUE;
        CALLGEOTAT(_XtGeoTrace(widget,
                               "ClearRectObj on \"%s\".\n",XtName(widget)));

        ClearRectObjAreas((RectObj)widget, &req.changes);
    }
    hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));;
    if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
        req.type = XtHconfigure;
        req.widget = widget;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.confighook_callbacks,
                           (XtPointer)&req);
    }

    return returnCode;
} /* _XtMakeGeometryRequest */
Example #6
0
XtGeometryResult XtQueryGeometry(
    Widget widget,
    register XtWidgetGeometry *intended, /* parent's changes; may be NULL */
    XtWidgetGeometry *reply)	/* child's preferred geometry; never NULL */
{
    XtWidgetGeometry null_intended;
    XtGeometryHandler query;
    XtGeometryResult result;
    WIDGET_TO_APPCON(widget);

    CALLGEOTAT(_XtGeoTrace(widget,
                           "\"%s\" is asking its preferred geometry to \"%s\".\n",
                           (XtParent(widget))?XtName(XtParent(widget)):"Root",
                           XtName(widget)));
    CALLGEOTAT(_XtGeoTab(1));

    LOCK_APP(app);
    LOCK_PROCESS;
    query = XtClass(widget)->core_class.query_geometry;
    UNLOCK_PROCESS;
    reply->request_mode = 0;
    if (query != NULL) {
        if (intended == NULL) {
            null_intended.request_mode = 0;
            intended = &null_intended;
#ifdef XT_GEO_TATTLER
            CALLGEOTAT(_XtGeoTrace(widget,"without any constraint.\n"));
        } else {
            CALLGEOTAT(_XtGeoTrace(widget,
                                   "with the following constraints:\n"));

            if (intended->request_mode & CWX) {
                CALLGEOTAT(_XtGeoTrace(widget," x = %d\n",intended->x));
            }
            if (intended->request_mode & CWY) {
                CALLGEOTAT(_XtGeoTrace(widget," y = %d\n",intended->y));
            }
            if (intended->request_mode & CWWidth) {
                CALLGEOTAT(_XtGeoTrace(widget,
                                       " width = %d\n",intended->width));
            }
            if (intended->request_mode & CWHeight) {
                CALLGEOTAT(_XtGeoTrace(widget,
                                       " height = %d\n",intended->height));
            }
            if (intended->request_mode & CWBorderWidth) {
                CALLGEOTAT(_XtGeoTrace(widget,
                                       " border_width = %d\n",intended->border_width));
            }
#endif
        }

        result = (*query) (widget, intended, reply);
    }
    else {
        CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" has no QueryGeometry proc, return the current state\n",XtName(widget)));

        result = XtGeometryYes;
    }

#ifdef XT_GEO_TATTLER
#define FillIn(mask, field) \
	if (!(reply->request_mode & mask)) {\
	      reply->field = widget->core.field;\
	      _XtGeoTrace(widget," using core %s = %d.\n","field",\
			                               widget->core.field);\
	} else {\
	      _XtGeoTrace(widget," replied %s = %d\n","field",\
			                           reply->field);\
	}
#else
#define FillIn(mask, field) \
	if (!(reply->request_mode & mask)) reply->field = widget->core.field;
#endif

    FillIn(CWX, x);
    FillIn(CWY, y);
    FillIn(CWWidth, width);
    FillIn(CWHeight, height);
    FillIn(CWBorderWidth, border_width);

    CALLGEOTAT(_XtGeoTab(-1));
#undef FillIn

    if (!(reply->request_mode & CWStackMode))
        reply->stack_mode = XtSMDontChange;
    UNLOCK_APP(app);
    return result;
}
Example #7
0
void XtConfigureWidget(
    Widget w,
    _XtPosition x,
    _XtPosition y,
    _XtDimension width,
    _XtDimension height,
    _XtDimension borderWidth)
{
    XtConfigureHookDataRec req;
    Widget hookobj;
    XWindowChanges old;
    WIDGET_TO_APPCON(w);

    CALLGEOTAT(_XtGeoTrace(w,
                           "\"%s\" is being configured by its parent \"%s\"\n",
                           XtName(w),
                           (XtParent(w))?XtName(XtParent(w)):"Root"));
    CALLGEOTAT(_XtGeoTab(1));

    LOCK_APP(app);
    req.changeMask = 0;
    if ((old.x = w->core.x) != x) {
        CALLGEOTAT(_XtGeoTrace(w,"x move from %d to %d\n",w->core.x, x));
        req.changes.x = w->core.x = x;
        req.changeMask |= CWX;
    }

    if ((old.y = w->core.y) != y) {
        CALLGEOTAT(_XtGeoTrace(w,"y move from %d to %d\n",w->core.y, y));
        req.changes.y = w->core.y = y;
        req.changeMask |= CWY;
    }

    if ((old.width = w->core.width) != width) {
        CALLGEOTAT(_XtGeoTrace(w,
                               "width move from %d to %d\n",w->core.width, width));
        req.changes.width = w->core.width = width;
        req.changeMask |= CWWidth;
    }

    if ((old.height = w->core.height) != height) {
        CALLGEOTAT(_XtGeoTrace(w,
                               "height move from %d to %d\n",w->core.height, height));
        req.changes.height = w->core.height = height;
        req.changeMask |= CWHeight;
    }

    if ((old.border_width = w->core.border_width) != borderWidth) {
        CALLGEOTAT(_XtGeoTrace(w,"border_width move from %d to %d\n",
                               w->core.border_width,borderWidth ));
        req.changes.border_width = w->core.border_width = borderWidth;
        req.changeMask |= CWBorderWidth;
    }

    if (req.changeMask != 0) {
        if (XtIsRealized(w)) {
            if (XtIsWidget(w)) {
                CALLGEOTAT(_XtGeoTrace(w,
                                       "XConfigure \"%s\"'s window\n",XtName(w)));
                XConfigureWindow(XtDisplay(w), XtWindow(w),
                                 req.changeMask, &req.changes);
            } else {
                CALLGEOTAT(_XtGeoTrace(w,
                                       "ClearRectObj called on \"%s\"\n",XtName(w)));
                ClearRectObjAreas((RectObj)w, &old);
            }
        }
        hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));;
        if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
            req.type = XtHconfigure;
            req.widget = w;
            XtCallCallbackList(hookobj,
                               ((HookObject)hookobj)->hooks.confighook_callbacks,
                               (XtPointer)&req);
        }
        {
            XtWidgetProc resize;

            LOCK_PROCESS;
            resize = XtClass(w)->core_class.resize;
            UNLOCK_PROCESS;
            if ((req.changeMask & (CWWidth | CWHeight)) &&
                    resize != (XtWidgetProc) NULL) {
                CALLGEOTAT(_XtGeoTrace(w,"Resize proc is called.\n"));
                (*resize)(w);
            }
        }
    } else {
        CALLGEOTAT(_XtGeoTrace(w,"No change in configuration\n"));
    }

    CALLGEOTAT(_XtGeoTab(-1));
    UNLOCK_APP(app);
} /* XtConfigureWidget */