Beispiel #1
0
void XtResizeWindow(
    Widget w)
{
    XtConfigureHookDataRec req;
    Widget hookobj;
    WIDGET_TO_APPCON(w);

    LOCK_APP(app);
    if (XtIsRealized(w)) {
        req.changes.width = w->core.width;
        req.changes.height = w->core.height;
        req.changes.border_width = w->core.border_width;
        req.changeMask = CWWidth | CWHeight | CWBorderWidth;
        XConfigureWindow(XtDisplay(w), XtWindow(w),
                         (unsigned) req.changeMask, &req.changes);
        hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));;
        if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
            req.type = XtHconfigure;
            req.widget = w;
            XtCallCallbackList(hookobj,
                               ((HookObject)hookobj)->hooks.confighook_callbacks,
                               (XtPointer)&req);
        }
    }
    UNLOCK_APP(app);
} /* XtResizeWindow */
Beispiel #2
0
Widget
XtVaCreateManagedWidget(
    _Xconst char* name,
    WidgetClass widget_class,
    Widget parent,
    ...)
{
    va_list		var;
    register Widget	widget;
    int			total_count, typed_count;
    WIDGET_TO_APPCON(parent);

    LOCK_APP(app);
    va_start(var,parent);
    _XtCountVaList(var, &total_count, &typed_count);
    va_end(var);

    va_start(var,parent);
    widget = _XtVaCreateWidget((String)name, widget_class, parent, var,
				total_count);
    XtManageChild(widget);
    va_end(var);
    UNLOCK_APP(app);
    return widget;
}
Beispiel #3
0
XtGeometryResult XtMakeGeometryRequest (
    Widget         widget,
    XtWidgetGeometry *request,
    XtWidgetGeometry *reply)
{
    Boolean junk;
    XtGeometryResult r;
    XtGeometryHookDataRec call_data;
    Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
        call_data.type = XtHpreGeometry;
        call_data.widget = widget;
        call_data.request = request;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.geometryhook_callbacks,
                           (XtPointer)&call_data);
        call_data.result = r =
                               _XtMakeGeometryRequest(widget, request, reply, &junk);
        call_data.type = XtHpostGeometry;
        call_data.reply = reply;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.geometryhook_callbacks,
                           (XtPointer)&call_data);
    } else {
        r = _XtMakeGeometryRequest(widget, request, reply, &junk);
    }
    UNLOCK_APP(app);

    return ((r == XtGeometryDone) ? XtGeometryYes : r);
}
Beispiel #4
0
void XtSetSensitive(
    register Widget widget,
    _XtBoolean	    sensitive)
{
    Arg			args[1];
    register Cardinal   i;
    register WidgetList children;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if (widget->core.sensitive == sensitive) {
	UNLOCK_APP(app);
	return;
    }

    XtSetArg(args[0], XtNsensitive, sensitive);
    XtSetValues(widget, args, XtNumber(args));

    /* If widget's ancestor_sensitive is TRUE, propagate new sensitive to
       children's ancestor_sensitive; else do nothing as children's
       ancestor_sensitive is already FALSE */
    
    if (widget->core.ancestor_sensitive && XtIsComposite (widget)) {
	children = ((CompositeWidget) widget)->composite.children;
	for (i = 0; i < ((CompositeWidget)widget)->composite.num_children; i++){
	    SetAncestorSensitive (children[i], sensitive);
	}
    }
    UNLOCK_APP(app);
} /* XtSetSensitive */
Beispiel #5
0
Widget XtNameToWidget(
    Widget root,
    _Xconst char* name)
{
    XrmName *names;
    XrmBinding *bindings;
    int len, depth, found = 10000;
    Widget result;
    WIDGET_TO_APPCON(root);

    len = strlen(name);
    if (len == 0) return NULL;

    LOCK_APP(app);
    names = (XrmName *) ALLOCATE_LOCAL((unsigned) (len+1) * sizeof(XrmName));
    bindings = (XrmBinding *)
               ALLOCATE_LOCAL((unsigned) (len+1) * sizeof(XrmBinding));
    if (names == NULL || bindings == NULL) _XtAllocError(NULL);

    XrmStringToBindingQuarkList(name, bindings, names);
    if (names[0] == NULLQUARK) {
        DEALLOCATE_LOCAL((char *) bindings);
        DEALLOCATE_LOCAL((char *) names);
        UNLOCK_APP(app);
        return NULL;
    }

    result = NameListToWidget(root, names, bindings, 0, &depth, &found);

    DEALLOCATE_LOCAL((char *) bindings);
    DEALLOCATE_LOCAL((char *) names);
    UNLOCK_APP(app);
    return result;
} /* XtNameToWidget */
Beispiel #6
0
void XtCallCallbackList(
    Widget widget,
    XtCallbackList callbacks,
    XtPointer call_data)
{
    register InternalCallbackList icl;
    register XtCallbackList cl;
    register int i;
    char ostate;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if (!callbacks) {
	UNLOCK_APP(app);
	return;
    }
    icl = (InternalCallbackList)callbacks;
    cl = ToList(icl);
    if (icl->count == 1) {
	(*cl->callback) (widget, cl->closure, call_data);
	UNLOCK_APP(app);
	return;
    }
    ostate = icl->call_state;
    icl->call_state = _XtCBCalling;
    for (i = icl->count; --i >= 0; cl++)
	(*cl->callback) (widget, cl->closure, call_data);
    if (ostate)
	icl->call_state |= ostate;
    else if (icl->call_state & _XtCBFreeAfterCalling)
	XtFree((char *)icl);
    else
	icl->call_state = 0;
    UNLOCK_APP(app);
} /* XtCallCallbackList */
Beispiel #7
0
EventMask XtBuildEventMask(
    Widget widget)
{
    XtEventTable ev;
    EventMask	mask = 0L;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    for (ev = widget->core.event_table; ev != NULL; ev = ev->next)
	if (ev->select) {
	    if (!ev->has_type_specifier)
		mask |= ev->mask;
	    else {
		if (EXT_TYPE(ev) < LASTEvent) {
		    Cardinal i;
		    for (i = 0; i < ev->mask; i++)
			if (EXT_SELECT_DATA(ev, i))
			    mask |= *(EventMask*)EXT_SELECT_DATA(ev, i);
		}
	    }
	}
    LOCK_PROCESS;
    if (widget->core.widget_class->core_class.expose != NULL)
	mask |= ExposureMask;
    if (widget->core.widget_class->core_class.visible_interest)
	mask |= VisibilityChangeMask;
    UNLOCK_PROCESS;
    if (widget->core.tm.translations)
	mask |= widget->core.tm.translations->eventMask;

    mask =  mask & ~NonMaskableMask;
    UNLOCK_APP(app);
    return mask;
}
Beispiel #8
0
void XtUnrealizeWidget (
    Widget		widget)
{
    Window window;
    Widget hookobj;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    window = XtWindow(widget);
    if (! XtIsRealized (widget)) {
        UNLOCK_APP(app);
        return;
    }
    if (widget->core.managed && widget->core.parent != NULL)
        XtUnmanageChild(widget);
    UnrealizeWidget(widget);
    if (window != None)
        XDestroyWindow(XtDisplay(widget), window);
    hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
        XtChangeHookDataRec call_data;

        call_data.type = XtHunrealizeWidget;
        call_data.widget = widget;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.changehook_callbacks,
                           (XtPointer)&call_data);
    }
    UNLOCK_APP(app);
} /* XtUnrealizeWidget */
Beispiel #9
0
void   XtUngrabKeyboard(
    Widget	widget,
    Time	time)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    UngrabDevice(widget, time, KEYBOARD);
    UNLOCK_APP(app);
}
Beispiel #10
0
void   XtUngrabPointer(
    Widget	widget,
    Time	time)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    UngrabDevice(widget, time, POINTER);
    UNLOCK_APP(app);
}
Beispiel #11
0
void   XtUngrabButton (
    Widget	widget,
    unsigned int button,
    Modifiers	modifiers)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    UngrabKeyOrButton(widget, (KeyCode)button, modifiers, POINTER);
    UNLOCK_APP(app);
}
Beispiel #12
0
void   XtUngrabKey (
    Widget	widget,
    _XtKeyCode	keycode,
    Modifiers	modifiers)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    UngrabKeyOrButton(widget, (int)keycode, modifiers, KEYBOARD);
    UNLOCK_APP(app);
}
Beispiel #13
0
Boolean XtIsRealized (
    Widget   object)
{
    Boolean retval;
    WIDGET_TO_APPCON(object);

    LOCK_APP(app);
    retval = XtWindowOfObject(object) != None;
    UNLOCK_APP(app);
    return retval;
} /* XtIsRealized */
Beispiel #14
0
XtGeometryResult
XtMakeResizeRequest(
    Widget	widget,
    _XtDimension width,
    _XtDimension height,
    Dimension	*replyWidth,
    Dimension	*replyHeight)
{
    XtWidgetGeometry request, reply;
    XtGeometryResult r;
    XtGeometryHookDataRec call_data;
    Boolean junk;
    Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    request.request_mode = CWWidth | CWHeight;
    request.width = width;
    request.height = height;

    if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
        call_data.type = XtHpreGeometry;
        call_data.widget = widget;
        call_data.request = &request;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.geometryhook_callbacks,
                           (XtPointer)&call_data);
        call_data.result = r =
                               _XtMakeGeometryRequest(widget, &request, &reply, &junk);
        call_data.type = XtHpostGeometry;
        call_data.reply = &reply;
        XtCallCallbackList(hookobj,
                           ((HookObject)hookobj)->hooks.geometryhook_callbacks,
                           (XtPointer)&call_data);
    } else {
        r = _XtMakeGeometryRequest(widget, &request, &reply, &junk);
    }
    if (replyWidth != NULL) {
        if (r == XtGeometryAlmost && reply.request_mode & CWWidth)
            *replyWidth = reply.width;
        else
            *replyWidth = width;
    }
    if (replyHeight != NULL) {
        if (r == XtGeometryAlmost && reply.request_mode & CWHeight)
            *replyHeight = reply.height;
        else
            *replyHeight = height;
    }
    UNLOCK_APP(app);
    return ((r == XtGeometryDone) ? XtGeometryYes : r);
} /* XtMakeResizeRequest */
Beispiel #15
0
void XtAddRawEventHandler(
    Widget	    widget,
    EventMask       eventMask,
    _XtBoolean      other,
    XtEventHandler  proc,
    XtPointer	    closure)
{
    WIDGET_TO_APPCON(widget);
    LOCK_APP(app);
    AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
		    proc, closure, XtListTail, FALSE, TRUE);
    UNLOCK_APP(app);
}
Beispiel #16
0
void XtRemoveEventTypeHandler(
    Widget	    widget,
    int		    type,
    XtPointer	    select_data,
    XtEventHandler  proc,
    XtPointer	    closure)
{
    WIDGET_TO_APPCON(widget);
    LOCK_APP(app);
    RemoveEventHandler(widget, select_data, type, TRUE,
		       FALSE, proc, closure, FALSE);
    UNLOCK_APP(app);
}
Beispiel #17
0
void XtRemoveEventHandler(
    Widget	    widget,
    EventMask       eventMask,
    _XtBoolean	    other,
    XtEventHandler  proc,
    XtPointer	    closure)
{
    WIDGET_TO_APPCON(widget);
    LOCK_APP(app);
    RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE,
		       other, proc, closure, FALSE);
    UNLOCK_APP(app);
}
Beispiel #18
0
Boolean XtIsSensitive(
    Widget	object)
{
    Boolean retval;
    WIDGET_TO_APPCON(object);

    LOCK_APP(app);
    if (XtIsRectObj(object))
        retval = object->core.sensitive && object->core.ancestor_sensitive;
    else
        retval = False;
    UNLOCK_APP(app);
    return retval;
}
Beispiel #19
0
Boolean XtIsManaged(
    Widget object)
{
    Boolean retval;
    WIDGET_TO_APPCON(object);

    LOCK_APP(app);
    if (XtIsRectObj(object))
        retval = object->core.managed;
    else
        retval = False;
    UNLOCK_APP(app);
    return retval;
}
Beispiel #20
0
void XtRealizeWidget (
    Widget		widget)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if (XtIsRealized (widget)) {
        UNLOCK_APP(app);
        return;
    }
    CallChangeManaged(widget);
    RealizeWidget(widget);
    UNLOCK_APP(app);
} /* XtRealizeWidget */
Beispiel #21
0
void XtInsertEventTypeHandler(
    Widget	    widget,
    int		    type,
    XtPointer	    select_data,
    XtEventHandler  proc,
    XtPointer	    closure,
    XtListPosition  position)
{
    WIDGET_TO_APPCON(widget);
    LOCK_APP(app);
    AddEventHandler(widget, select_data, type, TRUE, FALSE,
		    proc, closure, position, TRUE, FALSE);
    UNLOCK_APP(app);
}
Beispiel #22
0
void XtInsertEventHandler(
    Widget	    widget,
    EventMask       eventMask,
    _XtBoolean      other,
    XtEventHandler  proc,
    XtPointer	    closure,
    XtListPosition  position)
{
    WIDGET_TO_APPCON(widget);
    LOCK_APP(app);
    AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
		    proc, closure, position, TRUE, FALSE);
    UNLOCK_APP(app);
}
Beispiel #23
0
void  XtGrabKey (
    Widget	widget,
    _XtKeyCode	keycode,
    Modifiers	modifiers,
    _XtBoolean	owner_events,
    int 	pointer_mode,
    int 	keyboard_mode)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    GrabKeyOrButton(widget, (KeyCode)keycode, modifiers, owner_events,
		    pointer_mode, keyboard_mode,
		    (Mask)0, (Window)None, (Cursor)None, KEYBOARD);
    UNLOCK_APP(app);
}
Beispiel #24
0
/*
 * Active grab of keyboard. clear any client side grabs so we dont lock
 */
int XtGrabKeyboard (
    Widget	widget,
    _XtBoolean	owner_events,
    int 	pointer_mode,
    int 	keyboard_mode,
    Time	time)
{
    int retval;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    retval = GrabDevice (widget, owner_events,
			pointer_mode, keyboard_mode,
			(Mask)0, (Window)None, (Cursor)None, time, KEYBOARD);
    UNLOCK_APP(app);
    return retval;
}
Beispiel #25
0
XtCallbackStatus XtHasCallbacks(
     Widget		widget,
     _Xconst char*	callback_name
     )
{
    InternalCallbackList *callbacks;
    XtCallbackStatus retval = XtCallbackHasSome;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    callbacks = FetchInternalList(widget, callback_name);
    if (!callbacks)
	retval = XtCallbackNoList;
    else if (!*callbacks)
	retval = XtCallbackHasNone;
    UNLOCK_APP(app);
    return retval;
} /* XtHasCallbacks */
Beispiel #26
0
void  XtGrabButton(
    Widget	widget,
    int		button,
    Modifiers	modifiers,
    _XtBoolean	owner_events,
    unsigned int event_mask,
    int 	pointer_mode,
    int 	keyboard_mode,
    Window 	confine_to,
    Cursor 	cursor)
{
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    GrabKeyOrButton(widget, (KeyCode)button, modifiers, owner_events,
		    pointer_mode, keyboard_mode,
		    (Mask)event_mask, confine_to, cursor, POINTER);
    UNLOCK_APP(app);
}
Beispiel #27
0
Boolean XtIsSubclass(
    Widget    widget,
    WidgetClass widgetClass)
{
    register WidgetClass w;
    Boolean retval = FALSE;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    LOCK_PROCESS;
    for (w = widget->core.widget_class; w != NULL; w = w->core_class.superclass)
        if (w == widgetClass) {
            retval = TRUE;
            break;
        }
    UNLOCK_PROCESS;
    UNLOCK_APP(app);
    return retval;
} /* XtIsSubclass */
Beispiel #28
0
/*
 * grab the pointer
 */
int XtGrabPointer (
    Widget	widget,
    _XtBoolean	owner_events,
    unsigned int event_mask,
    int 	pointer_mode,
    int 	keyboard_mode,
    Window 	confine_to,
    Cursor 	cursor,
    Time	time)
{
    int retval;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    retval = GrabDevice (widget, owner_events,
			pointer_mode, keyboard_mode,
			(Mask)event_mask, confine_to,
			cursor, time, POINTER);
    UNLOCK_APP(app);
    return retval;
}
Beispiel #29
0
void XtSetMappedWhenManaged(
    Widget widget,
    _XtBoolean mapped_when_managed)
{
    Widget hookobj;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if (widget->core.mapped_when_managed == mapped_when_managed) {
	UNLOCK_APP(app);
	return;
    }
    widget->core.mapped_when_managed = mapped_when_managed;

    hookobj = XtHooksOfDisplay(XtDisplay(widget));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
	XtChangeHookDataRec call_data;

	call_data.type = XtHsetMappedWhenManaged;
	call_data.widget = widget;
	call_data.event_data = (XtPointer) (unsigned long) mapped_when_managed;
	XtCallCallbackList(hookobj,
		((HookObject)hookobj)->hooks.changehook_callbacks,
		(XtPointer)&call_data);
    }

    if (! XtIsManaged(widget)) {
	UNLOCK_APP(app);
	return;
    }

    if (mapped_when_managed) {
	/* Didn't used to be mapped when managed.		*/
	if (XtIsRealized(widget)) XtMapWidget(widget);
    } else {
	/* Used to be mapped when managed.			*/
	if (XtIsRealized(widget)) XtUnmapWidget(widget);
    }
    UNLOCK_APP(app);
} /* XtSetMappedWhenManaged */
Beispiel #30
0
void
XtSetWMColormapWindows(
    Widget widget,
    Widget *list,
    Cardinal count)
{
    Window *data;
    Widget *checked, *top, *temp, hookobj;
    Cardinal i, j, checked_count;
    Boolean match;
    Atom xa_wm_colormap_windows;
    WIDGET_TO_APPCON(widget);

    LOCK_APP(app);
    if ( !XtIsRealized(widget) || (count == 0) ) {
	UNLOCK_APP(app);
	return;
    }

    top = checked = (Widget *) __XtMalloc( (Cardinal) sizeof(Widget) * count);


/*
 * The specification calls for only adding the windows that have unique
 * colormaps to the property to this function, so we will make a pass through
 * the widget list removing all the widgets with non-unique colormaps.
 *
 * We will also remove any unrealized widgets from the list at this time.
 */

    for (checked_count = 0, i = 0; i < count; i++) {
	if (!XtIsRealized(list[i])) continue;

	*checked = list[i];
	match = FALSE;

/*
 * Don't check first element for matching colormap since there is nothing
 * to check it against.
 */

	if (checked != top)
	    for (j = 0, temp = top; j < checked_count ; j++, temp++)
		if ( (*temp)->core.colormap == (*checked)->core.colormap) {
		    match = TRUE;
		    break;
		}

/*
 * If no colormap was found to match then add this widget to the linked list.
 */

	if (!match) {
	    checked++;
	    checked_count++;
	}
    }

/*
 * Now that we have the list of widgets we need to convert it to a list of
 * windows and set the property.
 */

    data = (Window *) __XtMalloc( (Cardinal) sizeof(Window) * checked_count);

    for ( i = 0 ; i < checked_count ; i++)
	data[i] = XtWindow(top[i]);

    xa_wm_colormap_windows = XInternAtom(XtDisplay(widget),
					 "WM_COLORMAP_WINDOWS", FALSE);

    XChangeProperty(XtDisplay(widget), XtWindow(widget),
		    xa_wm_colormap_windows, XA_WINDOW, 32,
		    PropModeReplace, (unsigned char *) data, (int) i);

    hookobj = XtHooksOfDisplay(XtDisplay(widget));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
	XtChangeHookDataRec call_data;

	call_data.type = XtHsetWMColormapWindows;
	call_data.widget = widget;
	call_data.event_data = (XtPointer) list;
	call_data.num_event_data = count;
	XtCallCallbackList(hookobj,
		((HookObject)hookobj)->hooks.changehook_callbacks,
		(XtPointer)&call_data);
    }

    XtFree( (char *) data);
    XtFree( (char *) top);
    UNLOCK_APP(app);
}