コード例 #1
0
ファイル: StrToGrav.c プロジェクト: SvenDowideit/clearlinux
/*
 * This function is deprecated as of the addition of
 * XtCvtStringToGravity in R6
 */
void
XmuCvtStringToGravity(XrmValuePtr args, Cardinal *num_args,
		      XrmValuePtr fromVal, XrmValuePtr toVal)
{
  static Boolean haveQuarks = False;
  char name[10];
    XrmQuark q;
    struct _namepair *np;

    if (*num_args != 0)
        XtWarningMsg("wrongParameters","cvtStringToGravity","XtToolkitError",
                  "String to Gravity conversion needs no extra arguments",
		 (String *)NULL, (Cardinal *)NULL);

  if (!haveQuarks)
    {
      for (np = names; np->name; np++)
	np->quark = XrmPermStringToQuark(np->name);
      haveQuarks = True;
    }

  XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
  q = XrmStringToQuark(name);

  for (np = names; np->name; np++)
    {
      if (np->quark == q)
	{
	  done(&np->gravity, XtGravity);
		return;
	    }
	}

  XtStringConversionWarning((char *)fromVal->addr, XtRGravity);
}
コード例 #2
0
ファイル: help.c プロジェクト: idunham/dtextra
/*
 * string->help function type converter
 */
static Boolean
string2help(Display *dpy, XrmValue *a, Cardinal *n, XrmValue *from,
						XrmValue *to, XtPointer *data)
{
	int	i, alloced = FALSE;
	char	*lower, *p;
	USEUP(dpy); USEUP(a); USEUP(n); USEUP(data);

	/*
	 * Sanity.
	 */
	if(*n != 0) {
		XtWarningMsg("wrongParameters", "cvsStringToHelpType",
			"XtToolkitError",
			"String to HelpType conversion needs no extra arguments",
			NULL, NULL);
	}

	if(from->addr == NULL)
		return False;
	if(to->addr != NULL && to->size < sizeof(XtPointer)) {
		to->size = sizeof(XtPointer);
		return False;
	}
	if(to->addr == NULL) {
		to->addr = XtMalloc(sizeof(XtPointer));
		to->size = sizeof(XtPointer);
		alloced  = TRUE;
	}

	lower = XtNewString((String)from->addr);
	for(p = lower; *p != '\0'; ++p)
		*p = tolower(*p);

	for(i = 0; i < N_HELPTYPES; ++i) {
		if(strcmp(lower, helptypes[i].s) != 0)
			continue;
		*(XtPointer *)to->addr = (XtPointer)helptypes[i].f;
		XtFree(lower);
		return True;
	}

	if(alloced) {
		XtFree(to->addr);
		to->addr = NULL;
	}
	XtDisplayStringConversionWarning(dpy, (String)from->addr, XwlRHelpType);

	XtFree(lower);

	return False;
}
コード例 #3
0
ファイル: Resources.c プロジェクト: aosm/X11libs
static void BadSize(
    Cardinal size,
    XrmQuark name)
{
    String params[2];
    Cardinal num_params = 2;

    params[0] = (String)(long) size;
    params[1] = XrmQuarkToString(name);
    XtWarningMsg("invalidSizeOverride", "xtDependencies", XtCXtToolkitError,
	"Representation size %d must match superclass's to override %s",
	params, &num_params);
} /* BadType */
コード例 #4
0
ファイル: Manage.c プロジェクト: aosm/X11libs
void XtUnmanageChildren (
    WidgetList children,
    Cardinal num_children)
{
    Widget parent, hookobj;
    Cardinal ii;
#ifdef XTHREADS
    XtAppContext app;
#endif

    if (num_children == 0) return;
    if (children[0] == NULL) {
	XtWarningMsg(XtNinvalidChild,XtNxtUnmanageChildren,XtCXtToolkitError,
		     "Null child found in argument list to unmanage",
		     (String *)NULL, (Cardinal *)NULL);
	return;
    }
#ifdef XTHREADS
    app = XtWidgetToApplicationContext(children[0]);
#endif
    LOCK_APP(app);
    parent = children[0]->core.parent;
    if (parent->core.being_destroyed) {
	UNLOCK_APP(app);
	return;
    }
    UnmanageChildren(children, num_children, parent, &ii,
		     (Boolean)True, XtNxtUnmanageChildren);
    hookobj = XtHooksOfDisplay(XtDisplayOfObject(children[0]));
    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
	XtChangeHookDataRec call_data;

	call_data.type = XtHunmanageChildren;
	call_data.widget = parent;
	call_data.event_data = (XtPointer) children;
	call_data.num_event_data = num_children;
	XtCallCallbackList(hookobj,
		((HookObject)hookobj)->hooks.changehook_callbacks,
		(XtPointer)&call_data);
    }
    UNLOCK_APP(app);
} /* XtUnmanageChildren */
コード例 #5
0
void
XtInitializeWidgetClass(WidgetClass wc)
{
    XtEnum inited;
    LOCK_PROCESS;
    if (wc->core_class.class_inited) {
	UNLOCK_PROCESS;
	return;
    }
    inited = 0x01;
    {
	WidgetClass pc;
#define LeaveIfClass(c, d) if (pc == c) { inited = d; break; }
	for (pc = wc; pc; pc = pc->core_class.superclass) {
	    LeaveIfClass(rectObjClass, 0x01 |
			 RectObjClassFlag);
	    LeaveIfClass(coreWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag);
	    LeaveIfClass(compositeWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag |
			 CompositeClassFlag);
	    LeaveIfClass(constraintWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag |
			 CompositeClassFlag |
			 ConstraintClassFlag);
	    LeaveIfClass(shellWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag |
			 CompositeClassFlag |
			 ShellClassFlag);
	    LeaveIfClass(wmShellWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag |
			 CompositeClassFlag |
			 ShellClassFlag |
			 WMShellClassFlag);
	    LeaveIfClass(topLevelShellWidgetClass, 0x01 |
			 RectObjClassFlag |
			 WidgetClassFlag |
			 CompositeClassFlag |
			 ShellClassFlag |
			 WMShellClassFlag |
			 TopLevelClassFlag);
	}
#undef LeaveIfClass
    }
    if (wc->core_class.version != XtVersion &&
	wc->core_class.version != XtVersionDontCheck) {
	String param[3];
	String mismatch = "Widget class %s version mismatch (recompilation needed):\n  widget %d vs. intrinsics %d.";
	String recompile = "Widget class %s must be re-compiled.";
	Cardinal num_params;

	param[0] = wc->core_class.class_name;
	param[1] = (String) wc->core_class.version;
	param[2] = (String) XtVersion;

	if (wc->core_class.version == (11 * 1000 + 5) || /* MIT X11R5 */
	    wc->core_class.version == (11 * 1000 + 4)) { /* MIT X11R4 */
	    if ((inited & WMShellClassFlag) &&
		(sizeof(Boolean) != sizeof(char) ||
		 sizeof(Atom) != sizeof(Widget) ||
		 sizeof(Atom) != sizeof(String))) {
		num_params=3;
		XtWarningMsg("versionMismatch","widget",XtCXtToolkitError,
			     mismatch, param, &num_params);
		num_params=1;
		XtErrorMsg("R4orR5versionMismatch","widget",XtCXtToolkitError,
			   recompile, param, &num_params);

	    }
	}
	else if (wc->core_class.version == (11 * 1000 + 3)) { /* MIT X11R3 */
	    if (inited & ShellClassFlag) {
		num_params=1;
		XtWarningMsg("r3versionMismatch","widget",XtCXtToolkitError,
			     "Shell Widget class %s binary compiled for R3",
			     param,&num_params);
		XtErrorMsg("R3versionMismatch","widget",XtCXtToolkitError,
			   recompile, param, &num_params);
	    }
	}
	else {
	    num_params=3;
	    XtWarningMsg("versionMismatch","widget",XtCXtToolkitError,
			 mismatch, param, &num_params);
	    if (wc->core_class.version == (2 * 1000 + 2)) /* MIT X11R2 */ {
		num_params=1;
		XtErrorMsg("r2versionMismatch","widget",XtCXtToolkitError,
			   recompile, param, &num_params);
	    }
	}
    }

    if ((wc->core_class.superclass != NULL)
	    && (!(wc->core_class.superclass->core_class.class_inited)))
 	XtInitializeWidgetClass(wc->core_class.superclass);

    if (wc->core_class.class_initialize != NULL)
	(*(wc->core_class.class_initialize))();
    CallClassPartInit(wc, wc);
    wc->core_class.class_inited = inited;
    UNLOCK_PROCESS;
}