diff options
author | Matthieu Herrb <matthieu.herrb@laas.fr> | 2005-02-21 21:08:27 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu.herrb@laas.fr> | 2005-02-21 21:08:27 +0000 |
commit | 85eb751e4e1683af6cee3ee9dce29f74911a639d (patch) | |
tree | b40f699ee646462a8f223b919ba68dda1d8fc371 /src | |
parent | 94150cb72d9d641c64325cd70323d93b9a3701a5 (diff) |
Convert lib/Xt to ANSI C (Thomas Dickey). Fixes for a few valgrind warningsXORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1
(Thomas Dickey).
Diffstat (limited to 'src')
50 files changed, 4106 insertions, 4167 deletions
diff --git a/src/ActionHook.c b/src/ActionHook.c index 32aca9c..2845fed 100644 --- a/src/ActionHook.c +++ b/src/ActionHook.c @@ -8,13 +8,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -84,10 +84,10 @@ static void FreeActionHookList( } -XtActionHookId XtAppAddActionHook( app, proc, closure ) - XtAppContext app; - XtActionHookProc proc; - XtPointer closure; +XtActionHookId XtAppAddActionHook( + XtAppContext app, + XtActionHookProc proc, + XtPointer closure) { ActionHook hook = XtNew(ActionHookRec); LOCK_APP(app); @@ -107,8 +107,8 @@ XtActionHookId XtAppAddActionHook( app, proc, closure ) } -void XtRemoveActionHook( id ) - XtActionHookId id; +void XtRemoveActionHook( + XtActionHookId id) { ActionHook *p, hook = (ActionHook)id; XtAppContext app = hook->app; diff --git a/src/Alloc.c b/src/Alloc.c index 42154bc..ebcfdb7 100644 --- a/src/Alloc.c +++ b/src/Alloc.c @@ -78,9 +78,9 @@ in this Software without prior written authorization from The Open Group. #define Xfree(ptr) free(ptr) #ifdef _XNEEDBCOPYFUNC -void _XtBcopy(src, dst, length) - char *src, *dst; - int length; +void _XtBcopy( + char *src, char *dst, + int length) { if (src < dst) { dst += length; @@ -94,8 +94,8 @@ void _XtBcopy(src, dst, length) } #endif -void _XtAllocError(type) - String type; +void _XtAllocError( + String type) { Cardinal num_params = 1; if (type == NULL) type = "local memory allocation"; @@ -103,8 +103,8 @@ void _XtAllocError(type) "Cannot perform %s", &type, &num_params); } -void _XtHeapInit(heap) - Heap* heap; +void _XtHeapInit( + Heap* heap) { heap->start = NULL; heap->bytes_remaining = 0; @@ -112,8 +112,8 @@ void _XtHeapInit(heap) #ifndef XTTRACEMEMORY -char *XtMalloc(size) - unsigned size; +char *XtMalloc( + unsigned size) { char *ptr; @@ -127,9 +127,9 @@ char *XtMalloc(size) return(ptr); } -char *XtRealloc(ptr, size) - char *ptr; - unsigned size; +char *XtRealloc( + char *ptr, + unsigned size) { if (ptr == NULL) { #ifdef MALLOC_0_RETURNS_NULL @@ -146,8 +146,8 @@ char *XtRealloc(ptr, size) return(ptr); } -char *XtCalloc(num, size) - unsigned num, size; +char *XtCalloc( + unsigned num, unsigned size) { char *ptr; @@ -161,14 +161,14 @@ char *XtCalloc(num, size) return(ptr); } -void XtFree(ptr) - char *ptr; +void XtFree( + char *ptr) { if (ptr != NULL) Xfree(ptr); } -char* __XtMalloc(size) - unsigned size; +char* __XtMalloc( + unsigned size) { #ifdef MALLOC_0_RETURNS_NULL if (!size) size = 1; @@ -176,8 +176,8 @@ char* __XtMalloc(size) return XtMalloc (size); } -char* __XtCalloc(num, size) - unsigned num, size; +char* __XtCalloc( + unsigned num, unsigned size) { #ifdef MALLOC_0_RETURNS_NULL if (!size) num = size = 1; @@ -189,9 +189,9 @@ char* __XtCalloc(num, size) #define HEAP_SEGMENT_SIZE 1492 #endif -char* _XtHeapAlloc(heap, bytes) - Heap* heap; - Cardinal bytes; +char* _XtHeapAlloc( + Heap* heap, + Cardinal bytes) { register char* heap_loc; if (heap == NULL) return XtMalloc(bytes); @@ -230,8 +230,8 @@ char* _XtHeapAlloc(heap, bytes) return heap_loc; } -void _XtHeapFree(heap) - Heap* heap; +void _XtHeapFree( + Heap* heap) { char* segment = heap->start; while (segment != NULL) { @@ -291,16 +291,16 @@ static unsigned long XtSeqBreakpoint = ~0; XtSeqId++ /*ARGUSED*/ -static void _XtBreakpoint(mem) - StatsPtr mem; +static void _XtBreakpoint( + StatsPtr mem) { mem->seq = XtSeqId; /* avoid being optimized out of existence */ } -char *_XtMalloc(size, file, line) - unsigned size; - char *file; - int line; +char *_XtMalloc( + unsigned size, + char *file, + int line) { StatsPtr ptr; unsigned newsize; @@ -316,17 +316,17 @@ char *_XtMalloc(size, file, line) return retval; } -char *XtMalloc(size) - unsigned size; +char *XtMalloc( + unsigned size) { return _XtMalloc(size, (char *)NULL, 0); } -char *_XtRealloc(ptr, size, file, line) - char *ptr; - unsigned size; - char *file; - int line; +char *_XtRealloc( + char *ptr, + unsigned size, + char *file, + int line) { char *newptr; @@ -342,17 +342,17 @@ char *_XtRealloc(ptr, size, file, line) return(newptr); } -char *XtRealloc(ptr, size) - char *ptr; - unsigned size; +char *XtRealloc( + char *ptr, + unsigned size) { return _XtRealloc(ptr, size, (char *)NULL, 0); } -char *_XtCalloc(num, size, file, line) - unsigned num, size; - char *file; - int line; +char *_XtCalloc( + unsigned num, unsigned size, + char *file, + int line) { StatsPtr ptr; unsigned total, newsize; @@ -369,14 +369,14 @@ char *_XtCalloc(num, size, file, line) return retval; } -char *XtCalloc(num, size) - unsigned num, size; +char *XtCalloc( + unsigned num, unsigned size) { return _XtCalloc(num, size, (char *)NULL, 0); } -Boolean _XtIsValidPointer(ptr) - char *ptr; +Boolean _XtIsValidPointer( + char *ptr) { register StatsPtr mem; register StatsPtr stp = ToStats(ptr); @@ -394,8 +394,8 @@ Boolean _XtIsValidPointer(ptr) Boolean _XtValidateMemory = False; -void _XtFree(ptr) - char *ptr; +void _XtFree( + char *ptr) { register StatsPtr stp; @@ -417,17 +417,16 @@ void _XtFree(ptr) UNLOCK_PROCESS; } -void XtFree(ptr) - char *ptr; +void XtFree(char *ptr) { _XtFree(ptr); } -char *_XtHeapMalloc(heap, size, file, line) - Heap *heap; - Cardinal size; - char *file; - int line; +char *_XtHeapMalloc( + Heap *heap, + Cardinal size, + char *file, + int line) { StatsPtr ptr; unsigned newsize; @@ -444,8 +443,7 @@ char *_XtHeapMalloc(heap, size, file, line) return retval; } -void _XtHeapFree(heap) - register XtPointer heap; +void _XtHeapFree(register XtPointer heap) { register StatsPtr mem, next; @@ -469,8 +467,7 @@ void _XtHeapFree(heap) #include <stdio.h> -void _XtPrintMemory(filename) -char * filename; +void _XtPrintMemory(char * filename) { register StatsPtr mem; FILE *f; diff --git a/src/ArgList.c b/src/ArgList.c index 5b3e720..f893b9d 100644 --- a/src/ArgList.c +++ b/src/ArgList.c @@ -29,13 +29,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -54,11 +54,11 @@ SOFTWARE. * This routine merges two arglists. It does NOT check for duplicate entries. */ -ArgList XtMergeArgLists(args1, num_args1, args2, num_args2) - ArgList args1; - Cardinal num_args1; - ArgList args2; - Cardinal num_args2; +ArgList XtMergeArgLists( + ArgList args1, + Cardinal num_args1, + ArgList args2, + Cardinal num_args2) { ArgList result, args; @@ -72,5 +72,3 @@ ArgList XtMergeArgLists(args1, num_args1, args2, num_args2) return result; } - - diff --git a/src/Callback.c b/src/Callback.c index a6d6696..d84c115 100644 --- a/src/Callback.c +++ b/src/Callback.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -82,12 +82,12 @@ static InternalCallbackList* FetchInternalList( quark = StringToQuark(name); LOCK_PROCESS; - offsets = (CallbackTable) + offsets = (CallbackTable) widget->core.widget_class->core_class.callback_private; for (n = (int)(long) *(offsets++); --n >= 0; offsets++) if (quark == (*offsets)->xrm_name) { - retval = (InternalCallbackList *) + retval = (InternalCallbackList *) ((char *) widget - (*offsets)->xrm_offset - 1); break; } @@ -96,15 +96,15 @@ static InternalCallbackList* FetchInternalList( } -void _XtAddCallback(callbacks, callback, closure) - InternalCallbackList* callbacks; - XtCallbackProc callback; - XtPointer closure; +void _XtAddCallback( + InternalCallbackList* callbacks, + XtCallbackProc callback, + XtPointer closure) { register InternalCallbackList icl; register XtCallbackList cl; register int count; - + icl = *callbacks; count = icl ? icl->count : 0; @@ -129,14 +129,14 @@ void _XtAddCallback(callbacks, callback, closure) cl->closure = closure; } /* _XtAddCallback */ -void _XtAddCallbackOnce(callbacks, callback, closure) - register InternalCallbackList*callbacks; - XtCallbackProc callback; - XtPointer closure; +void _XtAddCallbackOnce( + register InternalCallbackList*callbacks, + XtCallbackProc callback, + XtPointer closure) { register XtCallbackList cl = ToList(*callbacks); register int i; - + for (i=(*callbacks)->count; --i >= 0; cl++) if (cl->callback == callback && cl->closure == closure) return; @@ -174,8 +174,8 @@ void XtAddCallback( call_data.type = XtHaddCallback; call_data.widget = widget; call_data.event_data = (XtPointer) name; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } } @@ -199,11 +199,11 @@ static void AddCallbacks( icl->call_state |= _XtCBFreeAfterCalling; icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + sizeof(XtCallbackRec) * (i+j)); - (void) memmove((char *)ToList(*callbacks), (char *)ToList(icl), + (void) memmove((char *)ToList(*callbacks), (char *)ToList(icl), sizeof(XtCallbackRec) * i); } else { icl = (InternalCallbackList) XtRealloc((char *) icl, - sizeof(InternalCallbackRec) + + sizeof(InternalCallbackRec) + sizeof(XtCallbackRec) * (i+j)); } *callbacks = icl; @@ -242,18 +242,17 @@ void XtAddCallbacks( call_data.type = XtHaddCallbacks; call_data.widget = widget; call_data.event_data = (XtPointer) name; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtAddCallbacks */ -void _XtRemoveCallback (callbacks, callback, closure) - InternalCallbackList *callbacks; - XtCallbackProc callback; - XtPointer closure; - +void _XtRemoveCallback ( + InternalCallbackList *callbacks, + XtCallbackProc callback, + XtPointer closure) { register InternalCallbackList icl; register int i, j; @@ -334,18 +333,18 @@ void XtRemoveCallback ( call_data.type = XtHremoveCallback; call_data.widget = widget; call_data.event_data = (XtPointer) name; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtRemoveCallback */ -void XtRemoveCallbacks (widget, name, xtcallbacks) - Widget widget; - _Xconst char* name; - XtCallbackList xtcallbacks; +void XtRemoveCallbacks ( + Widget widget, + _Xconst char* name, + XtCallbackList xtcallbacks) { InternalCallbackList *callbacks; Widget hookobj; @@ -409,16 +408,16 @@ void XtRemoveCallbacks (widget, name, xtcallbacks) call_data.type = XtHremoveCallbacks; call_data.widget = widget; call_data.event_data = (XtPointer) name; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtRemoveCallbacks */ -void _XtRemoveAllCallbacks (callbacks) - InternalCallbackList *callbacks; +void _XtRemoveAllCallbacks ( + InternalCallbackList *callbacks) { register InternalCallbackList icl = *callbacks; @@ -431,9 +430,9 @@ void _XtRemoveAllCallbacks (callbacks) } } /* _XtRemoveAllCallbacks */ -void XtRemoveAllCallbacks(widget, name) - Widget widget; - _Xconst char* name; +void XtRemoveAllCallbacks( + Widget widget, + _Xconst char* name) { InternalCallbackList *callbacks; Widget hookobj; @@ -457,15 +456,15 @@ void XtRemoveAllCallbacks(widget, name) call_data.type = XtHremoveAllCallbacks; call_data.widget = widget; call_data.event_data = (XtPointer) name; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtRemoveAllCallbacks */ -InternalCallbackList _XtCompileCallbackList(xtcallbacks) - XtCallbackList xtcallbacks; +InternalCallbackList _XtCompileCallbackList( + XtCallbackList xtcallbacks) { register int n; register XtCallbackList xtcl, cl; @@ -486,8 +485,8 @@ InternalCallbackList _XtCompileCallbackList(xtcallbacks) } /* _XtCompileCallbackList */ -XtCallbackList _XtGetCallbackList(callbacks) - InternalCallbackList *callbacks; +XtCallbackList _XtGetCallbackList( + InternalCallbackList *callbacks) { register int i; register InternalCallbackList icl; @@ -593,10 +592,10 @@ XtCallbackStatus XtHasCallbacks( } /* XtHasCallbacks */ -void XtCallCallbackList(widget, callbacks, call_data) - Widget widget; - XtCallbackList callbacks; - XtPointer call_data; +void XtCallCallbackList( + Widget widget, + XtCallbackList callbacks, + XtPointer call_data) { register InternalCallbackList icl; register XtCallbackList cl; @@ -629,11 +628,11 @@ void XtCallCallbackList(widget, callbacks, call_data) UNLOCK_APP(app); } /* XtCallCallbackList */ -void _XtPeekCallback(widget, callbacks, callback, closure) - Widget widget; - XtCallbackList callbacks; - XtCallbackProc *callback; - XtPointer *closure; +void _XtPeekCallback( + Widget widget, + XtCallbackList callbacks, + XtCallbackProc *callback, + XtPointer *closure) { register InternalCallbackList icl = (InternalCallbackList) callbacks; register XtCallbackList cl; @@ -648,11 +647,11 @@ void _XtPeekCallback(widget, callbacks, callback, closure) return; } -void _XtCallConditionalCallbackList(widget, callbacks, call_data, cond_proc) - Widget widget; - XtCallbackList callbacks; - XtPointer call_data; - _XtConditionProc cond_proc; +void _XtCallConditionalCallbackList( + Widget widget, + XtCallbackList callbacks, + XtPointer call_data, + _XtConditionProc cond_proc) { register InternalCallbackList icl; register XtCallbackList cl; diff --git a/src/ClickTime.c b/src/ClickTime.c index 807134f..9472330 100644 --- a/src/ClickTime.c +++ b/src/ClickTime.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -59,15 +59,15 @@ in this Software without prior written authorization from The Open Group. */ -/* +/* * Contains XtSetMultiClickTime, XtGetMultiClickTime */ #include "IntrinsicI.h" -void XtSetMultiClickTime( dpy, time ) - Display *dpy; - int time; +void XtSetMultiClickTime( + Display *dpy, + int time) { DPY_TO_APPCON(dpy); @@ -77,8 +77,8 @@ void XtSetMultiClickTime( dpy, time ) } -int XtGetMultiClickTime( dpy ) - Display *dpy; +int XtGetMultiClickTime( + Display *dpy) { int retval; DPY_TO_APPCON(dpy); diff --git a/src/Composite.c b/src/Composite.c index 27bc4a1..0b48e51 100644 --- a/src/Composite.c +++ b/src/Composite.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital, or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -73,11 +73,11 @@ static XtResource resources[] = { XtOffsetOf(CompositeRec, composite.insert_position), XtRImmediate, NULL}, }; -static void CompositeClassPartInitialize(); -static void CompositeInitialize(); -static void CompositeInsertChild(); -static void CompositeDeleteChild(); -static void CompositeDestroy(); +static void CompositeClassPartInitialize(WidgetClass); +static void CompositeInitialize(Widget, Widget, ArgList, Cardinal *); +static void CompositeInsertChild(Widget); +static void CompositeDeleteChild(Widget); +static void CompositeDestroy(Widget); externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { { /******* CorePart *******/ @@ -88,7 +88,7 @@ externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { /* class_part_initialize*/ CompositeClassPartInitialize, /* class_inited */ FALSE, /* initialize */ CompositeInitialize, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -103,9 +103,9 @@ externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -125,8 +125,8 @@ externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { externaldef(compositewidgetclass) WidgetClass compositeWidgetClass = (WidgetClass) &compositeClassRec; -static void InheritAllowsChangeManagedSet(widget_class) - WidgetClass widget_class; +static void InheritAllowsChangeManagedSet( + WidgetClass widget_class) { CompositeWidgetClass cc = (CompositeWidgetClass) widget_class; CompositeClassExtension ext, super_ext, new_ext; @@ -149,7 +149,7 @@ static void InheritAllowsChangeManagedSet(widget_class) super_ext->record_size == sizeof(CompositeClassExtensionRec) && super_ext->allows_change_managed_set) { - new_ext = (CompositeClassExtension) + new_ext = (CompositeClassExtension) __XtCalloc(1, sizeof(CompositeClassExtensionRec)); /* Be careful to inherit only what is appropriate */ @@ -164,8 +164,8 @@ static void InheritAllowsChangeManagedSet(widget_class) UNLOCK_PROCESS; } -static void CompositeClassPartInitialize(widgetClass) - WidgetClass widgetClass; +static void CompositeClassPartInitialize( + WidgetClass widgetClass) { register CompositePartPtr wcPtr; register CompositePartPtr superPtr = NULL; @@ -203,16 +203,16 @@ static void CompositeClassPartInitialize(widgetClass) UNLOCK_PROCESS; } -static void CompositeDestroy(w) - Widget w; +static void CompositeDestroy( + Widget w) { register CompositeWidget cw = (CompositeWidget) w; XtFree((char *) cw->composite.children); } -static void CompositeInsertChild(w) - Widget w; +static void CompositeInsertChild( + Widget w) { register Cardinal position; register Cardinal i; @@ -230,7 +230,7 @@ static void CompositeInsertChild(w) if (cw->composite.num_children == cw->composite.num_slots) { /* Allocate more space */ cw->composite.num_slots += (cw->composite.num_slots / 2) + 2; - cw->composite.children = children = + cw->composite.children = children = (WidgetList) XtRealloc((XtPointer) children, (unsigned) (cw->composite.num_slots) * sizeof(Widget)); } @@ -242,8 +242,8 @@ static void CompositeInsertChild(w) cw->composite.num_children++; } -static void CompositeDeleteChild(w) - Widget w; +static void CompositeDeleteChild( + Widget w) { register Cardinal position; register Cardinal i; @@ -266,10 +266,11 @@ static void CompositeDeleteChild(w) } /* ARGSUSED */ -static void CompositeInitialize(requested_widget, new_widget, args, num_args) - Widget new_widget, requested_widget; - ArgList args; - Cardinal *num_args; +static void CompositeInitialize( + Widget requested_widget, + Widget new_widget, + ArgList args, + Cardinal *num_args) { register CompositeWidget cw; diff --git a/src/Constraint.c b/src/Constraint.c index 459e078..e8ef7f3 100644 --- a/src/Constraint.c +++ b/src/Constraint.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -74,7 +74,7 @@ externaldef(constraintclassrec) ConstraintClassRec constraintClassRec = { /* class_part_initialize*/ ConstraintPartInitialize, /* class_inited */ FALSE, /* initialize */ NULL, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -89,9 +89,9 @@ externaldef(constraintclassrec) ConstraintClassRec constraintClassRec = { /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -120,8 +120,7 @@ externaldef(constraintwidgetclass) WidgetClass constraintWidgetClass = (WidgetClass) &constraintClassRec; -static void ConstraintPartInitialize(wc) - WidgetClass wc; +static void ConstraintPartInitialize(WidgetClass wc) { ConstraintWidgetClass cwc = (ConstraintWidgetClass)wc; if (cwc->constraint_class.resources) diff --git a/src/Convert.c b/src/Convert.c index 634c9a6..136e7e9 100644 --- a/src/Convert.c +++ b/src/Convert.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -88,8 +88,8 @@ typedef struct _ConverterRec { /* used for old-style type converter cache only */ static Heap globalHeap = {NULL, NULL, 0}; -void _XtSetDefaultConverterTable(table) - ConverterTable *table; +void _XtSetDefaultConverterTable( + ConverterTable *table) { register ConverterTable globalConverterTable; @@ -119,10 +119,10 @@ void _XtSetDefaultConverterTable(table) UNLOCK_PROCESS; } -void _XtFreeConverterTable(table) - ConverterTable table; +void _XtFreeConverterTable( + ConverterTable table) { - register int i; + register Cardinal i; register ConverterPtr p; for (i = 0; i < CONVERTHASHSIZE; i++) { @@ -133,7 +133,7 @@ void _XtFreeConverterTable(table) } } XtFree((char*)table); -} +} /* Data cache hash table */ @@ -204,7 +204,7 @@ void _XtTableAddConverter( p->to = to_type; p->converter = converter; p->destructor = destructor; - p->num_args = num_args; + p->num_args = num_args; p->global = global; args = ConvertArgs(p); while (num_args--) @@ -307,7 +307,7 @@ void XtAddConverter( while (app) { _XtTableAddConverter(app->converterTable, from, to, (XtTypeConverter)converter, convert_args, - num_args, False, XtCacheAll, (XtDestructor)NULL, + num_args, False, XtCacheAll, (XtDestructor)NULL, True); app = app->next; } @@ -334,20 +334,19 @@ void XtAppAddConverter( } static CachePtr -CacheEnter(heap, converter, args, num_args, from, to, succeeded, hash, - do_ref, do_free, destructor, closure) - Heap* heap; - register XtTypeConverter converter; - register XrmValuePtr args; - Cardinal num_args; - XrmValuePtr from; - XrmValuePtr to; - Boolean succeeded; - register int hash; - Boolean do_ref; - Boolean do_free; - XtDestructor destructor; - XtPointer closure; +CacheEnter( + Heap* heap, + register XtTypeConverter converter, + register XrmValuePtr args, + Cardinal num_args, + XrmValuePtr from, + XrmValuePtr to, + Boolean succeeded, + register int hash, + Boolean do_ref, + Boolean do_free, + XtDestructor destructor, + XtPointer closure) { register CachePtr *pHashEntry; register CachePtr p; @@ -418,10 +417,10 @@ CacheEnter(heap, converter, args, num_args, from, to, succeeded, hash, return p; } -static void FreeCacheRec(app, p, prev) - XtAppContext app; - CachePtr p; - CachePtr *prev; +static void FreeCacheRec( + XtAppContext app, + CachePtr p, + CachePtr *prev) { LOCK_PROCESS; if (p->has_ext) { @@ -465,9 +464,9 @@ static void FreeCacheRec(app, p, prev) } -void _XtCacheFlushTag(app, tag) - XtAppContext app; - XtPointer tag; +void _XtCacheFlushTag( + XtAppContext app, + XtPointer tag) { int i; register CachePtr *prev; @@ -489,7 +488,7 @@ void _XtCacheFlushTag(app, tag) #ifdef DEBUG #include <stdio.h> -void _XtConverterCacheStats() +void _XtConverterCacheStats(void) { register Cardinal i; register CachePtr p; @@ -516,10 +515,10 @@ void _XtConverterCacheStats() } #endif /*DEBUG*/ -static Boolean ResourceQuarkToOffset(widget_class, name, offset) - WidgetClass widget_class; - XrmName name; - Cardinal *offset; +static Boolean ResourceQuarkToOffset( + WidgetClass widget_class, + XrmName name, + Cardinal *offset) { register WidgetClass wc; register Cardinal i; @@ -540,11 +539,11 @@ static Boolean ResourceQuarkToOffset(widget_class, name, offset) } -static void ComputeArgs(widget, convert_args, num_args, args) - Widget widget; - XtConvertArgList convert_args; - Cardinal num_args; - XrmValuePtr args; +static void ComputeArgs( + Widget widget, + XtConvertArgList convert_args, + Cardinal num_args, + XrmValuePtr args) { register Cardinal i; Cardinal offset; @@ -555,7 +554,7 @@ static void ComputeArgs(widget, convert_args, num_args, args) for (i = 0; i < num_args; i++) { args[i].size = convert_args[i].size; switch (convert_args[i].address_mode) { - case XtAddress: + case XtAddress: args[i].addr = convert_args[i].address_id; break; @@ -617,12 +616,12 @@ static void ComputeArgs(widget, convert_args, num_args, args) } /* for */ } /* ComputeArgs */ -void XtDirectConvert(converter, args, num_args, from, to) - XtConverter converter; - XrmValuePtr args; - Cardinal num_args; - register XrmValuePtr from; - XrmValuePtr to; +void XtDirectConvert( + XtConverter converter, + XrmValuePtr args, + Cardinal num_args, + register XrmValuePtr from, + XrmValuePtr to) { register CachePtr p; register int hash; @@ -632,7 +631,7 @@ void XtDirectConvert(converter, args, num_args, from, to) /* Try to find cache entry for conversion */ hash = ((long) converter >> 2) + from->size + *((char *) from->addr); if (from->size > 1) hash += ((char *) from->addr)[1]; - + for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next) { if ((p->hash == hash) && (p->converter == (XtTypeConverter)converter) @@ -681,11 +680,11 @@ void XtDirectConvert(converter, args, num_args, from, to) } -static ConverterPtr GetConverterEntry( app, converter ) - XtAppContext app; - XtTypeConverter converter; +static ConverterPtr GetConverterEntry( + XtAppContext app, + XtTypeConverter converter) { - int entry; + Cardinal entry; register ConverterPtr cP; ConverterTable converterTable; @@ -702,16 +701,15 @@ static ConverterPtr GetConverterEntry( app, converter ) static Boolean -CallConverter(dpy, converter, - args, num_args, from, to, cache_ref_return, cP) - Display* dpy; - XtTypeConverter converter; - XrmValuePtr args; - Cardinal num_args; - register XrmValuePtr from; - XrmValuePtr to; - XtCacheRef *cache_ref_return; - register ConverterPtr cP; +CallConverter( + Display* dpy, + XtTypeConverter converter, + XrmValuePtr args, + Cardinal num_args, + register XrmValuePtr from, + XrmValuePtr to, + XtCacheRef *cache_ref_return, + register ConverterPtr cP) { CachePtr p; int hash; @@ -730,7 +728,7 @@ CallConverter(dpy, converter, /* Try to find cache entry for conversion */ hash = ((long)(converter) >> 2) + from->size + *((char *) from->addr); if (from->size > 1) hash += ((char *) from->addr)[1]; - + if (cP->cache_type != XtCacheNone) { for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next){ if ((p->hash == hash) @@ -763,10 +761,10 @@ CallConverter(dpy, converter, } to->size = p->to.size; if (p->to_is_value) { - XtMemmove(to->addr, &p->to.addr, + XtMemmove(to->addr, &p->to.addr, to->size); } else { - (void) memmove((char *)to->addr, + (void) memmove((char *)to->addr, (char *)p->to.addr, to->size); } } else { /* old-style call */ @@ -837,14 +835,14 @@ CallConverter(dpy, converter, } Boolean -XtCallConverter(dpy, converter, args, num_args, from, to, cache_ref_return) - Display* dpy; - XtTypeConverter converter; - XrmValuePtr args; - Cardinal num_args; - register XrmValuePtr from; - XrmValuePtr to; - XtCacheRef *cache_ref_return; +XtCallConverter( + Display* dpy, + XtTypeConverter converter, + XrmValuePtr args, + Cardinal num_args, + register XrmValuePtr from, + XrmValuePtr to, + XtCacheRef *cache_ref_return) { ConverterPtr cP; Boolean retval; @@ -853,24 +851,24 @@ XtCallConverter(dpy, converter, args, num_args, from, to, cache_ref_return) LOCK_APP(app); if ((cP = GetConverterEntry(app, converter)) == NULL) { XtAppSetTypeConverter(XtDisplayToApplicationContext(dpy), - "_XtUnk1", "_XtUnk2", + "_XtUnk1", "_XtUnk2", converter, NULL, 0, XtCacheAll, NULL); cP = GetConverterEntry(app, converter); } - retval = CallConverter(dpy, converter, args, num_args, from, to, + retval = CallConverter(dpy, converter, args, num_args, from, to, cache_ref_return, cP); UNLOCK_APP(app); return retval; } -Boolean _XtConvert(widget, from_type, from, to_type, to, cache_ref_return) - Widget widget; - register XrmRepresentation from_type; - XrmValuePtr from; - register XrmRepresentation to_type; - register XrmValuePtr to; - XtCacheRef *cache_ref_return; +Boolean _XtConvert( + Widget widget, + register XrmRepresentation from_type, + XrmValuePtr from, + register XrmRepresentation to_type, + register XrmValuePtr to, + XtCacheRef *cache_ref_return) { XtAppContext app = XtWidgetToApplicationContext(widget); register ConverterPtr p; @@ -909,7 +907,7 @@ Boolean _XtConvert(widget, from_type, from, to_type, to, cache_ref_return) if (to_type == _XtQString) *(String*)(to->addr) = tempTo.addr; else { - XtMemmove(to->addr, tempTo.addr, + XtMemmove(to->addr, tempTo.addr, tempTo.size); } retval = True; @@ -918,7 +916,7 @@ Boolean _XtConvert(widget, from_type, from, to_type, to, cache_ref_return) } else { /* old-style caller */ *to = tempTo; retval = True; - } + } } } if (args) DEALLOCATE_LOCAL( (XtPointer)args ); @@ -945,8 +943,7 @@ void XtConvert( _Xconst char* from_type_str, XrmValuePtr from, _Xconst char* to_type_str, - XrmValuePtr to - ) + XrmValuePtr to) { XrmQuark from_type, to_type; WIDGET_TO_APPCON(widget); @@ -980,8 +977,7 @@ Boolean XtConvertAndStore( _Xconst char* from_type_str, XrmValuePtr from, _Xconst char* to_type_str, - XrmValuePtr to - ) + XrmValuePtr to) { XrmQuark from_type, to_type; WIDGET_TO_APPCON(object); @@ -1044,9 +1040,9 @@ Boolean XtConvertAndStore( return True; } -void XtAppReleaseCacheRefs(app, refs) - XtAppContext app; - XtCacheRef *refs; +void XtAppReleaseCacheRefs( + XtAppContext app, + XtCacheRef *refs) { register CachePtr *r; register CachePtr p; @@ -1064,10 +1060,10 @@ void XtAppReleaseCacheRefs(app, refs) /* ARGSUSED */ -void XtCallbackReleaseCacheRefList(widget, closure, call_data) - Widget widget; /* unused */ - XtPointer closure; - XtPointer call_data; /* unused */ +void XtCallbackReleaseCacheRefList( + Widget widget, /* unused */ + XtPointer closure, + XtPointer call_data) /* unused */ { XtAppReleaseCacheRefs( XtWidgetToApplicationContext(widget), (XtCacheRef*)closure ); @@ -1076,10 +1072,10 @@ void XtCallbackReleaseCacheRefList(widget, closure, call_data) /* ARGSUSED */ -void XtCallbackReleaseCacheRef(widget, closure, call_data) - Widget widget; /* unused */ - XtPointer closure; - XtPointer call_data; /* unused */ +void XtCallbackReleaseCacheRef( + Widget widget, /* unused */ + XtPointer closure, + XtPointer call_data) /* unused */ { XtCacheRef cache_refs[2]; cache_refs[0] = (XtCacheRef)closure; diff --git a/src/Converters.c b/src/Converters.c index 0cad630..a3c41a4 100644 --- a/src/Converters.c +++ b/src/Converters.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -117,7 +117,7 @@ XrmQuark _XtQString = 0; XrmQuark _XtQString; #endif -void _XtConvertInitialize() +void _XtConvertInitialize(void) { XtQBool = XrmPermStringToQuark(XtRBool); XtQBoolean = XrmPermStringToQuark(XtRBoolean); @@ -177,7 +177,7 @@ void XtDisplayStringConversionWarning( _Xconst char* toType ) { -#ifndef NO_MIT_HACKS +#ifndef NO_MIT_HACKS /* Allow suppression of conversion warnings. %%% Not specified. */ static enum {Check, Report, Ignore} report_it = Check; @@ -225,7 +225,7 @@ void XtDisplayStringConversionWarning( XtNconversionError,"string",XtCXtToolkitError, "Cannot convert string \"%s\" to type %s", params,&num_params); -#ifndef NO_MIT_HACKS +#ifndef NO_MIT_HACKS } #endif /* ifndef NO_MIT_HACKS */ UNLOCK_PROCESS; @@ -246,12 +246,12 @@ void XtStringConversionWarning( params,&num_params); } -static int CompareISOLatin1(); +static int CompareISOLatin1(char *, char *); -static Boolean IsInteger(string, value) - String string; - int *value; +static Boolean IsInteger( + String string, + int *value) { Boolean foundDigit = False; Boolean isNegative = False; @@ -302,13 +302,13 @@ static Boolean IsInteger(string, value) /*ARGSUSED*/ -Boolean XtCvtIntToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToBoolean( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -320,13 +320,13 @@ Boolean XtCvtIntToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtIntToShort(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToShort( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -338,13 +338,13 @@ Boolean XtCvtIntToShort(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtStringToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToBoolean( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String)fromVal->addr; if (*num_args != 0) @@ -369,13 +369,13 @@ Boolean XtCvtStringToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtIntToBool(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToBool( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -387,13 +387,13 @@ Boolean XtCvtIntToBool(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtStringToBool(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToBool( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String)fromVal->addr; if (*num_args != 0) @@ -426,14 +426,14 @@ XtConvertArgRec const colorConvertArgs[] = { /* ARGSUSED */ -Boolean XtCvtIntToColor(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; -{ +Boolean XtCvtIntToColor( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) +{ XColor c; Screen *screen; Colormap colormap; @@ -454,13 +454,13 @@ Boolean XtCvtIntToColor(dpy, args, num_args, fromVal, toVal, closure_ret) } -Boolean XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToPixel( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String)fromVal->addr; XColor screenColor; @@ -521,12 +521,12 @@ Boolean XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) } /* ARGSUSED */ -static void FreePixel(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; - XrmValuePtr args; - Cardinal *num_args; +static void FreePixel( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, + XrmValuePtr args, + Cardinal *num_args) { Screen *screen; Colormap colormap; @@ -556,10 +556,10 @@ XtConvertArgRec const screenConvertArg[] = { }; /*ARGSUSED*/ -static void FetchDisplayArg(widget, size, value) - Widget widget; - Cardinal *size; - XrmValue* value; +static void FetchDisplayArg( + Widget widget, + Cardinal *size, + XrmValue* value) { if (widget == NULL) XtErrorMsg("missingWidget", "fetchDisplayArg", XtCXtToolkitError, @@ -577,14 +577,13 @@ static XtConvertArgRec const displayConvertArg[] = { }; /*ARGSUSED*/ -Boolean XtCvtStringToCursor(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - - XtPointer *closure_ret; +Boolean XtCvtStringToCursor( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { static const struct _CursorName { const char *name; @@ -670,7 +669,7 @@ Boolean XtCvtStringToCursor(dpy, args, num_args, fromVal, toVal, closure_ret) }; const struct _CursorName *nP; char *name = (char *)fromVal->addr; - register int i; + register Cardinal i; if (*num_args != 1) { XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -692,12 +691,12 @@ Boolean XtCvtStringToCursor(dpy, args, num_args, fromVal, toVal, closure_ret) } /* ARGSUSED */ -static void FreeCursor(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; - Cardinal *num_args; +static void FreeCursor( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, + Cardinal *num_args) { Display* display; @@ -714,13 +713,13 @@ static void FreeCursor(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtStringToDisplay(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToDisplay( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { Display *d; @@ -740,13 +739,13 @@ Boolean XtCvtStringToDisplay(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtStringToFile(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToFile( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { FILE *f; @@ -765,12 +764,12 @@ Boolean XtCvtStringToFile(dpy, args, num_args, fromVal, toVal, closure_ret) } /* ARGSUSED */ -static void FreeFile(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; /* unused */ - Cardinal *num_args; +static void FreeFile( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, /* unused */ + Cardinal *num_args) { if (*num_args != 0) XtAppWarningMsg(app, @@ -782,13 +781,13 @@ static void FreeFile(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtIntToFloat(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToFloat( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -799,21 +798,21 @@ Boolean XtCvtIntToFloat(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtStringToFloat(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToFloat( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { int ret; float f, nan; #ifndef ISC /* On ISC this generates a core dump :-( at least with gs */ /* depending on the system this may or may not do anything useful */ - (void) sscanf ("NaNS", "%g", - toVal->addr != NULL ? (float*) toVal->addr : &nan); + (void) sscanf ("NaNS", "%g", + toVal->addr != NULL ? (float*) toVal->addr : &nan); #endif if (*num_args != 0) @@ -833,13 +832,13 @@ Boolean XtCvtStringToFloat(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtStringToFont(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToFont( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { Font f; Display* display; @@ -873,7 +872,7 @@ Boolean XtCvtStringToFont(dpy, args, num_args, fromVal, toVal, closure_ret) xrm_name[1] = 0; xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont"); xrm_class[1] = 0; - if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, + if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, &rep_type, &value)) { if (rep_type == _XtQString) { f = XLoadFont(display, (char *)value.addr); @@ -905,12 +904,12 @@ Boolean XtCvtStringToFont(dpy, args, num_args, fromVal, toVal, closure_ret) } /* ARGSUSED */ -static void FreeFont(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; - Cardinal *num_args; +static void FreeFont( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, + Cardinal *num_args) { Display *display; if (*num_args != 1) { @@ -926,13 +925,13 @@ static void FreeFont(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtIntToFont(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToFont( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -943,13 +942,13 @@ Boolean XtCvtIntToFont(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtStringToFontSet(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToFontSet( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { XFontSet f; Display* display; @@ -995,7 +994,7 @@ Boolean XtCvtStringToFontSet(dpy, args, num_args, fromVal, toVal, closure_ret) xrm_name[1] = 0; xrm_class[0] = XrmPermStringToQuark ("XtDefaultFontSet"); xrm_class[1] = 0; - if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, + if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, &rep_type, &value)) { if (rep_type == _XtQString) { @@ -1042,17 +1041,17 @@ Boolean XtCvtStringToFontSet(dpy, args, num_args, fromVal, toVal, closure_ret) "noFont","cvtStringToFontSet",XtCXtToolkitError, "Unable to load any usable fontset", (String *) NULL, (Cardinal *)NULL); - + return False; } /*ARGSUSED*/ -static void FreeFontSet(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; - Cardinal *num_args; +static void FreeFontSet( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, + Cardinal *num_args) { Display *display; if (*num_args != 2) { @@ -1068,10 +1067,10 @@ static void FreeFontSet(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -static void FetchLocaleArg(widget, size, value ) - Widget widget; /* unused */ - Cardinal *size; /* unused */ - XrmValue *value; +static void FetchLocaleArg( + Widget widget, /* unused */ + Cardinal *size, /* unused */ + XrmValue *value) { static XrmString locale; @@ -1089,13 +1088,13 @@ static XtConvertArgRec const localeDisplayConvertArgs[] = { /*ARGSUSED*/ Boolean -XtCvtStringToFontStruct(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +XtCvtStringToFontStruct( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { XFontStruct *f; Display* display; @@ -1132,7 +1131,7 @@ XtCvtStringToFontStruct(dpy, args, num_args, fromVal, toVal, closure_ret) xrm_name[1] = 0; xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont"); xrm_class[1] = 0; - if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, + if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class, &rep_type, &value)) { if (rep_type == _XtQString) { f = XLoadQueryFont(display, (char*)value.addr); @@ -1159,17 +1158,17 @@ XtCvtStringToFontStruct(dpy, args, num_args, fromVal, toVal, closure_ret) "noFont","cvtStringToFontStruct",XtCXtToolkitError, "Unable to load any usable ISO8859 font", (String *) NULL, (Cardinal *)NULL); - + return False; } /* ARGSUSED */ -static void FreeFontStruct(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; - Cardinal *num_args; +static void FreeFontStruct( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, + Cardinal *num_args) { Display *display; if (*num_args != 1) { @@ -1185,13 +1184,13 @@ static void FreeFontStruct(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtStringToInt(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToInt( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { int i; @@ -1208,13 +1207,13 @@ Boolean XtCvtStringToInt(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtStringToShort(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToShort( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { int i; @@ -1231,13 +1230,13 @@ Boolean XtCvtStringToShort(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtStringToDimension(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToDimension( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { int i; @@ -1257,13 +1256,13 @@ Boolean XtCvtStringToDimension(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtIntToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToUnsignedChar( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -1275,13 +1274,13 @@ Boolean XtCvtIntToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtStringToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToUnsignedChar( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { int i; @@ -1303,13 +1302,13 @@ Boolean XtCvtStringToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_r /*ARGSUSED*/ -Boolean XtCvtColorToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtColorToPixel( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -1320,13 +1319,13 @@ Boolean XtCvtColorToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtIntToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToPixel( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -1337,13 +1336,13 @@ Boolean XtCvtIntToPixel(dpy, args, num_args, fromVal, toVal, closure_ret) } /*ARGSUSED*/ -Boolean XtCvtIntToPixmap(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtIntToPixmap( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -1354,8 +1353,7 @@ Boolean XtCvtIntToPixmap(dpy, args, num_args, fromVal, toVal, closure_ret) } #ifdef MOTIFBC -void LowerCase(source, dest) - register char *source, *dest; +void LowerCase(register char *source, register *dest) { register char ch; int i; @@ -1370,8 +1368,7 @@ void LowerCase(source, dest) } #endif -static int CompareISOLatin1 (first, second) - char *first, *second; +static int CompareISOLatin1 (char *first, char *second) { register unsigned char *ap, *bp; @@ -1402,8 +1399,7 @@ static int CompareISOLatin1 (first, second) return (((int) *bp) - ((int) *ap)); } -static void CopyISOLatin1Lowered(dst, src) - char *dst, *src; +static void CopyISOLatin1Lowered(char *dst, char *src) { unsigned char *dest, *source; @@ -1423,14 +1419,14 @@ static void CopyISOLatin1Lowered(dst, src) } /*ARGSUSED*/ -Boolean -XtCvtStringToInitialState(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean +XtCvtStringToInitialState( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String)fromVal->addr; if (*num_args != 0) @@ -1457,13 +1453,13 @@ static XtConvertArgRec const visualConvertArgs[] = { }; /*ARGSUSED*/ -Boolean XtCvtStringToVisual(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; /* Screen, depth */ - Cardinal *num_args; /* 2 */ - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; /* unused */ +Boolean XtCvtStringToVisual( + Display* dpy, + XrmValuePtr args, /* Screen, depth */ + Cardinal *num_args, /* 2 */ + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) /* unused */ { String str = (String)fromVal->addr; int vc; @@ -1498,7 +1494,7 @@ Boolean XtCvtStringToVisual(dpy, args, num_args, fromVal, toVal, closure_ret) String params[2]; Cardinal num_params = 2; params[0] = str; - params[1] = + params[1] = DisplayString(XDisplayOfScreen((Screen*)*(Screen**)args[0].addr)); XtAppWarningMsg(XtDisplayToApplicationContext(dpy), XtNconversionError, "stringToVisual", XtCXtToolkitError, @@ -1510,13 +1506,13 @@ Boolean XtCvtStringToVisual(dpy, args, num_args, fromVal, toVal, closure_ret) /*ARGSUSED*/ -Boolean XtCvtStringToAtom(dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToAtom( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { Atom atom; if (*num_args != 1) { @@ -1526,20 +1522,19 @@ Boolean XtCvtStringToAtom(dpy, args, num_args, fromVal, toVal, closure_ret) (String *) NULL, (Cardinal *)NULL); return False; } - + atom = XInternAtom( *(Display**)args->addr, (char*)fromVal->addr, False ); donestr(Atom, atom, XtRAtom); } /*ARGSUSED*/ -Boolean XtCvtStringToDirectoryString(dpy, args, num_args, fromVal, toVal, - closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToDirectoryString( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str; char directory[PATH_MAX+1]; @@ -1578,12 +1573,12 @@ Boolean XtCvtStringToDirectoryString(dpy, args, num_args, fromVal, toVal, } /*ARGSUSED*/ -static void FreeDirectoryString(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; /* unused */ - XrmValuePtr args; - Cardinal *num_args; +static void FreeDirectoryString( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, /* unused */ + XrmValuePtr args, + Cardinal *num_args) { if (*num_args != 0) XtAppWarningMsg(app, @@ -1595,14 +1590,13 @@ static void FreeDirectoryString(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtStringToRestartStyle(dpy, args, num_args, fromVal, toVal, - closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToRestartStyle( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String str = (String)fromVal->addr; if (*num_args != 0) @@ -1624,14 +1618,13 @@ Boolean XtCvtStringToRestartStyle(dpy, args, num_args, fromVal, toVal, } /*ARGSUSED*/ -Boolean XtCvtStringToCommandArgArray(dpy, args, num_args, fromVal, toVal, - closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToCommandArgArray( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { String *strarray, *ptr; char *src; @@ -1656,7 +1649,7 @@ Boolean XtCvtStringToCommandArgArray(dpy, args, num_args, fromVal, toVal, /* test for end of string */ if (*src == '\0') break; - + /* start new token */ tokens++; start = src; @@ -1704,12 +1697,12 @@ Boolean XtCvtStringToCommandArgArray(dpy, args, num_args, fromVal, toVal, } /*ARGSUSED*/ -static void ArgArrayDestructor(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; - XrmValuePtr args; - Cardinal *num_args; +static void ArgArrayDestructor( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, + XrmValuePtr args, + Cardinal *num_args) { String *strarray; @@ -1721,13 +1714,13 @@ static void ArgArrayDestructor(app, toVal, closure, args, num_args) } /*ARGSUSED*/ -Boolean XtCvtStringToGravity (dpy, args, num_args, fromVal, toVal, closure_ret) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr fromVal; - XrmValuePtr toVal; - XtPointer *closure_ret; +Boolean XtCvtStringToGravity ( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr fromVal, + XrmValuePtr toVal, + XtPointer *closure_ret) { static struct _namepair { XrmQuark quark; @@ -1757,7 +1750,7 @@ Boolean XtCvtStringToGravity (dpy, args, num_args, fromVal, toVal, closure_ret) { NULLQUARK, "8", SouthGravity }, { NULLQUARK, "9", SouthEastGravity }, { NULLQUARK, "10", StaticGravity }, - { NULLQUARK, NULL, ForgetGravity } + { NULLQUARK, NULL, ForgetGravity } }; static Boolean haveQuarks = FALSE; char lowerName[40]; @@ -1789,8 +1782,8 @@ Boolean XtCvtStringToGravity (dpy, args, num_args, fromVal, toVal, closure_ret) return False; } -void _XtAddDefaultConverters(table) - ConverterTable table; +void _XtAddDefaultConverters( + ConverterTable table) { #define Add(from, to, proc, convert_args, num_args, cache) \ _XtTableAddConverter(table, from, to, proc, \ @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -79,7 +79,7 @@ in this Software without prior written authorization from The Open Group. externaldef(xtinherittranslations) int _XtInheritTranslations = 0; extern String XtCXtToolkitError; /* from IntrinsicI.h */ -static void XtCopyScreen(); +static void XtCopyScreen(Widget, int, XrmValue *); static XtResource resources[] = { {XtNscreen, XtCScreen, XtRScreen, sizeof(Screen*), @@ -115,12 +115,12 @@ parameter is not passed through to the XtRCallProc routines */ XtRTranslationTable, (XtPointer)NULL} }; -static void CoreInitialize(); -static void CoreClassPartInitialize(); -static void CoreDestroy(); -static void CoreRealize(); -static Boolean CoreSetValues(); -static void CoreSetValuesAlmost(); +static void CoreInitialize(Widget, Widget, ArgList, Cardinal *); +static void CoreClassPartInitialize(WidgetClass); +static void CoreDestroy(Widget); +static void CoreRealize(Widget, XtValueMask *, XSetWindowAttributes *); +static Boolean CoreSetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void CoreSetValuesAlmost(Widget, Widget, XtWidgetGeometry *, XtWidgetGeometry *); static RectObjClassRec unNamedObjClassRec = { { @@ -131,7 +131,7 @@ static RectObjClassRec unNamedObjClassRec = { /* class_part_initialize*/ NULL, /* class_inited */ FALSE, /* initialize */ NULL, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ (XtProc)XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -146,9 +146,9 @@ static RectObjClassRec unNamedObjClassRec = { /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -202,10 +202,10 @@ externaldef (WidgetClass) WidgetClass coreWidgetClass = &widgetClassRec; /*ARGSUSED*/ -static void XtCopyScreen(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +static void XtCopyScreen( + Widget widget, + int offset, + XrmValue *value) { value->addr = (XPointer)(&widget->core.screen); } @@ -214,8 +214,8 @@ static void XtCopyScreen(widget, offset, value) * Start of Core methods */ -static void CoreClassPartInitialize(wc) - register WidgetClass wc; +static void CoreClassPartInitialize( + register WidgetClass wc) { /* We don't need to check for null super since we'll get to object eventually, and it had better define them! */ @@ -232,7 +232,7 @@ static void CoreClassPartInitialize(wc) } if (wc->core_class.display_accelerator == XtInheritDisplayAccelerator) { - wc->core_class.display_accelerator = + wc->core_class.display_accelerator = super->core_class.display_accelerator; } @@ -249,7 +249,7 @@ static void CoreClassPartInitialize(wc) if (wc->core_class.version == XtVersionDontCheck) inPlace = True; - else + else inPlace = (wc->core_class.version < XtVersion) ? False : True; /* Compile the action table into a more efficient form */ @@ -259,11 +259,11 @@ static void CoreClassPartInitialize(wc) UNLOCK_PROCESS; } /* ARGSUSED */ -static void CoreInitialize(requested_widget, new_widget, args, num_args) - Widget requested_widget; - register Widget new_widget; - ArgList args; - Cardinal *num_args; +static void CoreInitialize( + Widget requested_widget, + register Widget new_widget, + ArgList args, + Cardinal *num_args) { XtTranslations save1, save2; new_widget->core.event_table = NULL; @@ -283,17 +283,17 @@ static void CoreInitialize(requested_widget, new_widget, args, num_args) _XtMergeTranslations(new_widget, save2, save2->operation); } -static void CoreRealize(widget, value_mask, attributes) - Widget widget; - XtValueMask *value_mask; - XSetWindowAttributes *attributes; +static void CoreRealize( + Widget widget, + XtValueMask *value_mask, + XSetWindowAttributes *attributes) { XtCreateWindow(widget, (unsigned int) InputOutput, (Visual *) CopyFromParent, *value_mask, attributes); } /* CoreRealize */ -static void CoreDestroy (widget) - Widget widget; +static void CoreDestroy ( + Widget widget) { _XtFreeEventTable(&widget->core.event_table); _XtDestroyTMData(widget); @@ -305,10 +305,10 @@ static void CoreDestroy (widget) } /* CoreDestroy */ /* ARGSUSED */ -static Boolean CoreSetValues(old, reference, new, args, num_args) - Widget old, reference, new; - ArgList args; - Cardinal *num_args; +static Boolean CoreSetValues( + Widget old, Widget reference, Widget new, + ArgList args, + Cardinal *num_args) { Boolean redisplay; Mask window_mask; @@ -320,7 +320,7 @@ static Boolean CoreSetValues(old, reference, new, args, num_args) save = new->core.tm.translations; new->core.tm.translations = old->core.tm.translations; _XtMergeTranslations(new, save, XtTableReplace); - } + } /* Check everything that depends upon window being realized */ if (XtIsRealized(old)) { @@ -331,7 +331,7 @@ static Boolean CoreSetValues(old, reference, new, args, num_args) attributes.background_pixel = new->core.background_pixel; window_mask |= CWBackPixel; redisplay = TRUE; - } + } if (old->core.background_pixmap != new->core.background_pixmap) { if (new->core.background_pixmap == XtUnspecifiedPixmap) { window_mask |= CWBackPixel; @@ -343,7 +343,7 @@ static Boolean CoreSetValues(old, reference, new, args, num_args) window_mask |= CWBackPixmap; } redisplay = TRUE; - } + } if (old->core.border_pixel != new->core.border_pixel && new->core.border_pixmap == XtUnspecifiedPixmap) { attributes.border_pixel = new->core.border_pixel; @@ -380,18 +380,18 @@ static Boolean CoreSetValues(old, reference, new, args, num_args) Boolean mapped_when_managed = new->core.mapped_when_managed; new->core.mapped_when_managed = !mapped_when_managed; XtSetMappedWhenManaged(new, mapped_when_managed); - } + } } /* if realized */ return redisplay; } /* CoreSetValues */ /*ARGSUSED*/ -static void CoreSetValuesAlmost(old, new, request, reply) - Widget old; - Widget new; - XtWidgetGeometry *request; - XtWidgetGeometry *reply; +static void CoreSetValuesAlmost( + Widget old, + Widget new, + XtWidgetGeometry *request, + XtWidgetGeometry *reply) { *request = *reply; } diff --git a/src/Create.c b/src/Create.c index 27244d4..19236d4 100644 --- a/src/Create.c +++ b/src/Create.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -72,7 +72,7 @@ in this Software without prior written authorization from The Open Group. static String XtNxtCreateWidget = "xtCreateWidget"; static String XtNxtCreatePopupShell = "xtCreatePopupShell"; -static void +static void CallClassPartInit(WidgetClass ancestor, WidgetClass wc) { if (ancestor->core_class.superclass != NULL) { @@ -83,7 +83,7 @@ CallClassPartInit(WidgetClass ancestor, WidgetClass wc) } } -void +void XtInitializeWidgetClass(wc) WidgetClass wc; { @@ -181,10 +181,10 @@ XtInitializeWidgetClass(wc) } } - if ((wc->core_class.superclass != NULL) + 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); @@ -192,7 +192,7 @@ XtInitializeWidgetClass(wc) UNLOCK_PROCESS; } -static void +static void CallInitialize ( WidgetClass class, Widget req_widget, @@ -221,7 +221,7 @@ CallInitialize ( (*initialize_hook) (new_widget, args, &num_args); } -static void +static void CallConstraintInitialize ( ConstraintWidgetClass class, Widget req_widget, @@ -266,10 +266,10 @@ xtWidgetAlloc( ext = (ObjectClassExtension) XtGetClassExtension(widget_class, XtOffsetOf(ObjectClassRec, object_class.extension), - NULLQUARK, XtObjectExtensionVersion, + NULLQUARK, XtObjectExtensionVersion, sizeof(ObjectClassExtensionRec)); if (parent_constraint_class) - csize = parent_constraint_class->constraint_class.constraint_size; + csize = parent_constraint_class->constraint_class.constraint_size; if (ext && ext->allocate) { XtAllocateProc allocate; Cardinal extra = 0; @@ -325,7 +325,7 @@ CompileCallbacks( UNLOCK_PROCESS; } -static Widget +static Widget xtCreate( char *name, char *class, @@ -348,10 +348,10 @@ xtCreate( Cardinal wsize, csize; Widget widget; XtCacheRef *cache_refs; - int i; + Cardinal i; XtCreateHookDataRec call_data; - widget = xtWidgetAlloc(widget_class, parent_constraint_class, parent, + widget = xtWidgetAlloc(widget_class, parent_constraint_class, parent, name, args, num_args, typed_args, num_typed_args); if (XtIsRectObj(widget)) { @@ -378,7 +378,7 @@ xtCreate( UNLOCK_PROCESS; /* fetch resources */ - cache_refs = _XtGetResources(widget, args, num_args, + cache_refs = _XtGetResources(widget, args, num_args, typed_args, &num_typed_args); /* Convert typed arg list to arg list */ @@ -391,7 +391,7 @@ xtCreate( } num_args = num_typed_args; } - + CompileCallbacks(widget); if (cache_refs != NULL) { @@ -408,7 +408,7 @@ xtCreate( csize = parent_constraint_class->constraint_class.constraint_size; if (csize) { req_constraints = XtStackAlloc(csize, constraint_cache); - (void) memmove((char*)req_constraints, widget->core.constraints, + (void) memmove((char*)req_constraints, widget->core.constraints, (int)csize); req_widget->core.constraints = req_constraints; } else req_widget->core.constraints = NULL; @@ -422,7 +422,7 @@ xtCreate( if (post_proc != (XtWidgetProc) NULL) { Widget hookobj; (*post_proc)(widget); - hookobj = XtHooksOfDisplay((default_screen != (Screen*) NULL) ? + hookobj = XtHooksOfDisplay((default_screen != (Screen*) NULL) ? default_screen->display : XtDisplayOfObject(parent)); if (XtHasCallbacks(hookobj, XtNcreateHook) == XtCallbackHasSome) { @@ -431,14 +431,14 @@ xtCreate( call_data.widget = widget; call_data.args = args; call_data.num_args = num_args; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.createhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.createhook_callbacks, (XtPointer)&call_data); } } if (typed_args != NULL) { while (num_typed_args-- > 0) { - + /* In GetResources we may have dynamically alloc'd store to hold */ /* a copy of a resource which was larger then sizeof(XtArgVal). */ /* We must free this store now in order to prevent a memory leak */ @@ -456,7 +456,7 @@ xtCreate( return (widget); } -static void +static void widgetPostProc(Widget w) { XtWidgetProc insert_child; @@ -482,7 +482,7 @@ widgetPostProc(Widget w) } } -Widget +Widget _XtCreateWidget( String name, WidgetClass widget_class, @@ -563,7 +563,7 @@ _XtCreateWidget( return (widget); } -Widget +Widget XtCreateWidget( _Xconst char* name, WidgetClass widget_class, @@ -583,7 +583,7 @@ XtCreateWidget( } -Widget +Widget XtCreateManagedWidget( _Xconst char* name, WidgetClass widget_class, @@ -615,16 +615,15 @@ popupPostProc(Widget w) parent->core.popup_list[parent->core.num_popups++] = w; } -Widget -_XtCreatePopupShell(name, widget_class, parent, args, num_args, - typed_args, num_typed_args) - String name; - WidgetClass widget_class; - Widget parent; - ArgList args; - Cardinal num_args; - XtTypedArgList typed_args; - Cardinal num_typed_args; +Widget +_XtCreatePopupShell( + String name, + WidgetClass widget_class, + Widget parent, + ArgList args, + Cardinal num_args, + XtTypedArgList typed_args, + Cardinal num_typed_args) { register Widget widget; Screen* default_screen; @@ -653,7 +652,7 @@ _XtCreatePopupShell(name, widget_class, parent, args, num_args, return(widget); } -Widget +Widget XtCreatePopupShell( _Xconst char* name, WidgetClass widget_class, @@ -672,16 +671,16 @@ XtCreatePopupShell( return retval; } -Widget -_XtAppCreateShell(name, class, widget_class, display, args, num_args, - typed_args, num_typed_args) - String name, class; - WidgetClass widget_class; - Display* display; - ArgList args; - Cardinal num_args; - XtTypedArgList typed_args; - Cardinal num_typed_args; +Widget +_XtAppCreateShell( + String name, + String class, + WidgetClass widget_class, + Display* display, + ArgList args, + Cardinal num_args, + XtTypedArgList typed_args, + Cardinal num_typed_args) { Widget shell; @@ -706,7 +705,7 @@ _XtAppCreateShell(name, class, widget_class, display, args, num_args, return shell; } -Widget +Widget XtAppCreateShell( _Xconst char* name, _Xconst char* class, @@ -727,7 +726,7 @@ XtAppCreateShell( } /* ARGSUSED */ -Widget +Widget XtCreateApplicationShell( _Xconst char* name, /* unused in R3 and later */ WidgetClass widget_class, @@ -752,26 +751,25 @@ XtCreateApplicationShell( } Widget -_XtCreateHookObj(screen) - Screen* screen; +_XtCreateHookObj(Screen* screen) { Widget req_widget; double widget_cache[100]; Cardinal wsize = 0; - Widget hookobj = xtWidgetAlloc(hookObjectClass, - (ConstraintWidgetClass)NULL, + Widget hookobj = xtWidgetAlloc(hookObjectClass, + (ConstraintWidgetClass)NULL, (Widget)NULL, "hooks", - (ArgList)NULL, (Cardinal)0, + (ArgList)NULL, (Cardinal)0, (XtTypedArgList)NULL, (Cardinal)0); ((HookObject)hookobj)->hooks.screen = screen; - (void) _XtGetResources(hookobj, (ArgList)NULL, 0, + (void) _XtGetResources(hookobj, (ArgList)NULL, 0, (XtTypedArgList)NULL, &wsize); CompileCallbacks(hookobj); wsize = hookObjectClass->core_class.widget_size; req_widget = (Widget) XtStackAlloc(wsize, widget_cache); (void) memmove ((char *) req_widget, (char *) hookobj, (int) wsize); - CallInitialize (hookObjectClass, req_widget, hookobj, + CallInitialize (hookObjectClass, req_widget, hookobj, (ArgList)NULL, (Cardinal) 0); XtStackFree((XtPointer)req_widget, widget_cache); return hookobj; diff --git a/src/Destroy.c b/src/Destroy.c index 8fc072b..53aae31 100644 --- a/src/Destroy.c +++ b/src/Destroy.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -67,11 +67,9 @@ struct _DestroyRec { Widget widget; }; -static void Recursive(widget, proc) - Widget widget; - XtWidgetProc proc; +static void Recursive(Widget widget, XtWidgetProc proc) { - register int i; + register Cardinal i; CompositePart *cwp; /* Recurse down normal children */ @@ -90,11 +88,10 @@ static void Recursive(widget, proc) } /* Finally, apply procedure to this widget */ - (*proc) (widget); + (*proc) (widget); } /* Recursive */ -static void Phase1Destroy (widget) - Widget widget; +static void Phase1Destroy (Widget widget) { Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget)); @@ -104,14 +101,13 @@ static void Phase1Destroy (widget) call_data.type = XtHdestroy; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.destroyhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.destroyhook_callbacks, (XtPointer) &call_data); } } /* Phase1Destroy */ -static void Phase2Callbacks(widget) - Widget widget; +static void Phase2Callbacks(Widget widget) { if (widget->core.destroy_callbacks != NULL) { XtCallCallbackList(widget, @@ -119,8 +115,7 @@ static void Phase2Callbacks(widget) } } /* Phase2Callbacks */ -static void Phase2Destroy(widget) - register Widget widget; +static void Phase2Destroy(register Widget widget) { register WidgetClass class; register ConstraintWidgetClass cwClass; @@ -149,7 +144,7 @@ static void Phase2Destroy(widget) /* Call widget destroy procedures */ LOCK_PROCESS; for (class = widget->core.widget_class; - class != NULL; + class != NULL; class = class->core_class.superclass) { XtWidgetProc destroy; @@ -162,9 +157,9 @@ static void Phase2Destroy(widget) /* Call widget deallocate procedure */ ext = (ObjectClassExtension) - XtGetClassExtension(widget->core.widget_class, + XtGetClassExtension(widget->core.widget_class, XtOffsetOf(CoreClassPart, extension), - NULLQUARK, XtObjectExtensionVersion, + NULLQUARK, XtObjectExtensionVersion, sizeof(ObjectClassExtensionRec)); if (ext && ext->deallocate) { XtDeallocateProc deallocate; @@ -177,8 +172,7 @@ static void Phase2Destroy(widget) } } /* Phase2Destroy */ -static Boolean IsDescendant(widget, root) - register Widget widget, root; +static Boolean IsDescendant(Widget widget, Widget root) { while ((widget = XtParent(widget)) != root) { if (widget == NULL) return False; @@ -186,8 +180,7 @@ static Boolean IsDescendant(widget, root) return True; } -static void XtPhase2Destroy (widget) - register Widget widget; +static void XtPhase2Destroy (Widget widget) { Display *display = NULL; Window window; @@ -203,7 +196,7 @@ static void XtPhase2Destroy (widget) parent = widget->core.parent; if (parent && XtIsWidget(parent) && parent->core.num_popups) { - int i; + Cardinal i; for (i = 0; i < parent->core.num_popups; i++) { if (parent->core.popup_list[i] == widget) { isPopup = True; @@ -274,7 +267,7 @@ static void XtPhase2Destroy (widget) app->in_phase2_destroy = outerInPhase2Destroy; if (isPopup) { - int i; + Cardinal i; for (i = 0; i < parent->core.num_popups; i++) if (parent->core.popup_list[i] == widget) { parent->core.num_popups--; @@ -295,9 +288,7 @@ static void XtPhase2Destroy (widget) } /* XtPhase2Destroy */ -void _XtDoPhase2Destroy(app, dispatch_level) - XtAppContext app; - int dispatch_level; +void _XtDoPhase2Destroy(XtAppContext app, int dispatch_level) { /* Phase 2 must occur in fifo order. List is not necessarily * contiguous in dispatch_level. @@ -324,8 +315,7 @@ void _XtDoPhase2Destroy(app, dispatch_level) } -void XtDestroyWidget (widget) - Widget widget; +void XtDestroyWidget (Widget widget) { XtAppContext app; DestroyRec *dr, *dr2; @@ -377,5 +367,5 @@ void XtDestroyWidget (widget) app->dispatch_level = 0; } UNLOCK_APP(app); - + } /* XtDestroyWidget */ diff --git a/src/Display.c b/src/Display.c index eea5fc4..13151f1 100644 --- a/src/Display.c +++ b/src/Display.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -68,14 +68,14 @@ in this Software without prior written authorization from The Open Group. #include <stdlib.h> #ifdef XTHREADS -void (*_XtProcessLock)() = NULL; -void (*_XtProcessUnlock)() = NULL; -void (*_XtInitAppLock)() = NULL; +void (*_XtProcessLock)(void) = NULL; +void (*_XtProcessUnlock)(void) = NULL; +void (*_XtInitAppLock)(XtAppContext) = NULL; #endif static String XtNnoPerDisplay = "noPerDisplay"; -ProcessContext _XtGetProcessContext() +ProcessContext _XtGetProcessContext(void) { static ProcessContextRec processContextRec = { (XtAppContext)NULL, @@ -88,7 +88,7 @@ ProcessContext _XtGetProcessContext() } -XtAppContext _XtDefaultAppContext() +XtAppContext _XtDefaultAppContext(void) { ProcessContext process = _XtGetProcessContext(); XtAppContext app; @@ -102,9 +102,9 @@ XtAppContext _XtDefaultAppContext() return app; } -static void AddToAppContext(d, app) - Display *d; - XtAppContext app; +static void AddToAppContext( + Display *d, + XtAppContext app) { #define DISPLAYS_TO_ADD 4 @@ -126,9 +126,9 @@ static void AddToAppContext(d, app) #undef DISPLAYS_TO_ADD } -static void XtDeleteFromAppContext(d, app) - Display *d; - register XtAppContext app; +static void XtDeleteFromAppContext( + Display *d, + register XtAppContext app) { register int i; @@ -150,8 +150,8 @@ static void XtDeleteFromAppContext(d, app) #endif } -static XtPerDisplay NewPerDisplay(dpy) - Display *dpy; +static XtPerDisplay NewPerDisplay( + Display *dpy) { PerDisplayTablePtr pd; @@ -164,11 +164,11 @@ static XtPerDisplay NewPerDisplay(dpy) return &(pd->perDpy); } -static XtPerDisplay InitPerDisplay(dpy, app, name, classname) - Display *dpy; - XtAppContext app; - String name; - String classname; +static XtPerDisplay InitPerDisplay( + Display *dpy, + XtAppContext app, + _Xconst char * name, + _Xconst char * classname) { XtPerDisplay pd; @@ -218,7 +218,7 @@ static XtPerDisplay InitPerDisplay(dpy, app, name, classname) #if 0 pd->hook_object = _XtCreate("hooks", "Hooks", hookObjectClass, (Widget)NULL, (Screen*)DefaultScreenOfDisplay(dpy), - (ArgList)NULL, 0, (XtTypedArgList)NULL, 0, + (ArgList)NULL, 0, (XtTypedArgList)NULL, 0, (ConstraintWidgetClass)NULL); #endif @@ -238,8 +238,7 @@ Display *XtOpenDisplay( XrmOptionDescRec *urlist, Cardinal num_urs, int *argc, - String *argv - ) + String *argv) { Display *d; XrmDatabase db = 0; @@ -296,23 +295,23 @@ Display *XtOpenDisplay( } Display * -_XtAppInit(app_context_return, application_class, options, num_options, - argc_in_out, argv_in_out, fallback_resources) -XtAppContext * app_context_return; -String application_class; -XrmOptionDescRec *options; -Cardinal num_options; -int *argc_in_out; -String **argv_in_out, * fallback_resources; +_XtAppInit( + XtAppContext * app_context_return, + String application_class, + XrmOptionDescRec *options, + Cardinal num_options, + int *argc_in_out, + String **argv_in_out, + String * fallback_resources) { String *saved_argv; int i; Display *dpy; /* - * Save away argv and argc so we can set the properties later + * Save away argv and argc so we can set the properties later */ - + saved_argv = (String *) __XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) ); @@ -370,7 +369,7 @@ XtDisplayInitialize( UNLOCK_APP(app); } -XtAppContext XtCreateApplicationContext() +XtAppContext XtCreateApplicationContext(void) { XtAppContext app = XtNew(XtAppStruct); #ifdef XTHREADS @@ -398,8 +397,8 @@ XtAppContext XtCreateApplicationContext() app->input_list = NULL; app->outstandingQueue = NULL; app->errorDB = NULL; - _XtSetDefaultErrorHandlers(&app->errorMsgHandler, - &app->warningMsgHandler, &app->errorHandler, + _XtSetDefaultErrorHandlers(&app->errorMsgHandler, + &app->warningMsgHandler, &app->errorHandler, &app->warningHandler); app->action_table = NULL; _XtSetDefaultSelectionTimeout(&app->selectionTimeout); @@ -452,8 +451,7 @@ Boolean XtAppGetExitFlag ( return retval; } -static void DestroyAppContext(app) - XtAppContext app; +static void DestroyAppContext(XtAppContext app) { XtAppContext* prev_app; @@ -465,7 +463,7 @@ static void DestroyAppContext(app) _XtFreeActions(app->action_table); if (app->destroy_callbacks != NULL) { XtCallCallbackList((Widget) NULL, - (XtCallbackList)app->destroy_callbacks, + (XtCallbackList)app->destroy_callbacks, (XtPointer)app); _XtRemoveAllCallbacks(&app->destroy_callbacks); } @@ -487,8 +485,7 @@ static void DestroyAppContext(app) static XtAppContext* appDestroyList = NULL; int _XtAppDestroyCount = 0; -void XtDestroyApplicationContext(app) - XtAppContext app; +void XtDestroyApplicationContext(XtAppContext app) { LOCK_APP(app); if (app->being_destroyed) { @@ -513,7 +510,7 @@ void XtDestroyApplicationContext(app) } } -void _XtDestroyAppContexts() +void _XtDestroyAppContexts(void) { int i,ii; XtAppContext apps[8]; @@ -538,8 +535,7 @@ void _XtDestroyAppContexts() XtStackFree ((XtPointer) pApps, apps); } -XrmDatabase XtDatabase(dpy) - Display *dpy; +XrmDatabase XtDatabase(Display *dpy) { XrmDatabase retval; DPY_TO_APPCON(dpy); @@ -552,8 +548,7 @@ XrmDatabase XtDatabase(dpy) PerDisplayTablePtr _XtperDisplayList = NULL; -XtPerDisplay _XtSortPerDisplayList(dpy) - Display *dpy; +XtPerDisplay _XtSortPerDisplayList(Display *dpy) { register PerDisplayTablePtr pd, opd = NULL; @@ -581,8 +576,7 @@ XtPerDisplay _XtSortPerDisplayList(dpy) return &(pd->perDpy); } -XtAppContext XtDisplayToApplicationContext(dpy) - Display *dpy; +XtAppContext XtDisplayToApplicationContext(Display *dpy) { XtAppContext retval; @@ -590,14 +584,13 @@ XtAppContext XtDisplayToApplicationContext(dpy) return retval; } -static void CloseDisplay(dpy) - Display *dpy; +static void CloseDisplay(Display *dpy) { register XtPerDisplay xtpd; register PerDisplayTablePtr pd, opd = NULL; XrmDatabase db; int i; - + XtDestroyWidget(XtHooksOfDisplay(dpy)); LOCK_PROCESS; @@ -668,8 +661,7 @@ static void CloseDisplay(dpy) UNLOCK_PROCESS; } -void XtCloseDisplay(dpy) - Display *dpy; +void XtCloseDisplay(Display *dpy) { XtPerDisplay pd; XtAppContext app = XtDisplayToApplicationContext(dpy); @@ -685,7 +677,7 @@ void XtCloseDisplay(dpy) else { pd->being_destroyed = TRUE; app->dpy_destroy_count++; - app->dpy_destroy_list = (Display **) + app->dpy_destroy_list = (Display **) XtRealloc((char *) app->dpy_destroy_list, (unsigned) (app->dpy_destroy_count * sizeof(Display *))); app->dpy_destroy_list[app->dpy_destroy_count-1] = dpy; @@ -693,8 +685,7 @@ void XtCloseDisplay(dpy) UNLOCK_APP(app); } -void _XtCloseDisplays( - XtAppContext app) +void _XtCloseDisplays(XtAppContext app) { int i; @@ -708,8 +699,7 @@ void _XtCloseDisplays( UNLOCK_APP(app); } -XtAppContext XtWidgetToApplicationContext(w) - Widget w; +XtAppContext XtWidgetToApplicationContext(Widget w) { XtAppContext retval; @@ -718,10 +708,10 @@ XtAppContext XtWidgetToApplicationContext(w) } -void XtGetApplicationNameAndClass(dpy, name_return, class_return) - Display *dpy; - String *name_return; - String *class_return; +void XtGetApplicationNameAndClass( + Display *dpy, + String *name_return, + String *class_return) { XtPerDisplay pd; @@ -730,8 +720,7 @@ void XtGetApplicationNameAndClass(dpy, name_return, class_return) *class_return = XrmQuarkToString(pd->class); } -XtPerDisplay _XtGetPerDisplay ( - Display* display) +XtPerDisplay _XtGetPerDisplay (Display* display) { XtPerDisplay retval; @@ -744,8 +733,7 @@ XtPerDisplay _XtGetPerDisplay ( return retval; } -XtPerDisplayInputRec* _XtGetPerDisplayInput( - Display* display) +XtPerDisplayInputRec* _XtGetPerDisplayInput(Display* display) { XtPerDisplayInputRec* retval; LOCK_PROCESS; diff --git a/src/Error.c b/src/Error.c index d0886ef..18c9e25 100644 --- a/src/Error.c +++ b/src/Error.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -72,12 +72,14 @@ in this Software without prior written authorization from The Open Group. #define GLOBALERRORS 1 #endif -static void InitErrorHandling(); +static void InitErrorHandling(XrmDatabase *); #if GLOBALERRORS static XrmDatabase errorDB = NULL; static Boolean error_inited = FALSE; -void _XtDefaultErrorMsg(), _XtDefaultWarningMsg(), - _XtDefaultError(), _XtDefaultWarning(); +void _XtDefaultErrorMsg(String, String, String, String, String*, Cardinal*); +void _XtDefaultWarningMsg(String, String, String, String, String*, Cardinal*); +void _XtDefaultError(String); +void _XtDefaultWarning(String); static XtErrorMsgHandler errorMsgHandler = _XtDefaultErrorMsg; static XtErrorMsgHandler warningMsgHandler = _XtDefaultWarningMsg; static XtErrorHandler errorHandler = _XtDefaultError; @@ -97,8 +99,8 @@ XrmDatabase *XtGetErrorDatabase(void) return retval; } -XrmDatabase *XtAppGetErrorDatabase(app) - XtAppContext app; +XrmDatabase *XtAppGetErrorDatabase( + XtAppContext app) { XrmDatabase* retval; #if GLOBALERRORS @@ -182,7 +184,7 @@ void XtAppGetErrorDatabaseText( } else (void) XrmGetResource(db, str_name, str_class, &type_str, &result); if (result.addr) { (void) strncpy (buffer, result.addr, nbytes); - if (result.size > nbytes) buffer[nbytes-1] = 0; + if (result.size > (unsigned) nbytes) buffer[nbytes-1] = 0; } else { int len = strlen(defaultp); if (len >= nbytes) len = nbytes-1; @@ -200,8 +202,8 @@ void XtAppGetErrorDatabaseText( #endif } -static void InitErrorHandling (db) - XrmDatabase *db; +static void InitErrorHandling ( + XrmDatabase *db) { XrmDatabase errordb; @@ -209,12 +211,15 @@ static void InitErrorHandling (db) XrmMergeDatabases(errordb, db); } -static void DefaultMsg (name,type,class,defaultp,params,num_params,error,fn) - String name,type,class,defaultp; - String* params; - Cardinal* num_params; - Bool error; - void (*fn)(_Xconst _XtString); +static void DefaultMsg ( + String name, + String type, + String class, + String defaultp, + String* params, + Cardinal* num_params, + Bool error, + void (*fn)(_Xconst _XtString)) { #define BIGBUF 1024 #ifdef notyet /* older versions don't, might want to wait until more do */ @@ -233,10 +238,10 @@ static void DefaultMsg (name,type,class,defaultp,params,num_params,error,fn) if ((error && errorHandler == _XtDefaultError) || (!error && warningHandler == _XtDefaultWarning)) { /* - * if it's just going to go to stderr anyway, then we'll + * if it's just going to go to stderr anyway, then we'll * fprintf to stderr ourselves and skip the insecure sprintf. */ - int i = *num_params; + Cardinal i = *num_params; String par[10]; if (i > 10) i = 10; (void) memmove((char*)par, (char*)params, i * sizeof(String) ); @@ -267,20 +272,20 @@ program as a non-root user or by removing the suid bit on the executable."); else { /* * If you have snprintf the worst thing that could happen is you'd - * lose some information. Without snprintf you're probably going to + * lose some information. Without snprintf you're probably going to * scramble your heap and perhaps SEGV -- sooner or later. * If it hurts when you go like this then don't go like this! :-) */ - int i = *num_params; + Cardinal i = *num_params; String par[10]; if (i > 10) i = 10; (void) memmove((char*)par, (char*)params, i * sizeof(String) ); bzero( &par[i], (10-i) * sizeof(String) ); if (i != *num_params) XtWarning( "Some arguments in following message were lost" ); - /* + /* * resist any temptation you might have to make `message' a - * local buffer on the stack. Doing so is a security hole + * local buffer on the stack. Doing so is a security hole * in programs executing as root. Error and Warning * messages shouldn't be called frequently enough for this * to be a performance issue. @@ -288,11 +293,11 @@ program as a non-root user or by removing the suid bit on the executable."); if ((message = __XtMalloc (BIGBUF))) { #ifndef USE_SNPRINTF message[BIGBUF-1] = 0; - (void) sprintf (message, buffer, + (void) sprintf (message, buffer, #else (void) snprintf (message, BIGBUF, buffer, #endif - par[0], par[1], par[2], par[3], par[4], + par[0], par[1], par[2], par[3], par[4], par[5], par[6], par[7], par[8], par[9]); #ifndef USE_SNPRINTF if (message[BIGBUF-1] != '\0') @@ -307,18 +312,24 @@ program as a non-root user or by removing the suid bit on the executable."); } } -void _XtDefaultErrorMsg (name,type,class,defaultp,params,num_params) - String name,type,class,defaultp; - String* params; - Cardinal* num_params; +void _XtDefaultErrorMsg ( + String name, + String type, + String class, + String defaultp, + String* params, + Cardinal* num_params) { DefaultMsg (name,type,class,defaultp,params,num_params,True,XtError); } -void _XtDefaultWarningMsg (name,type,class,defaultp,params,num_params) - String name,type,class,defaultp; - String* params; - Cardinal* num_params; +void _XtDefaultWarningMsg ( + String name, + String type, + String class, + String defaultp, + String* params, + Cardinal* num_params) { DefaultMsg (name,type,class,defaultp,params,num_params,False,XtWarning); } @@ -403,8 +414,8 @@ void XtAppWarningMsg( #endif /* GLOBALERRORS */ } -void XtSetErrorMsgHandler(handler) - XtErrorMsgHandler handler; +void XtSetErrorMsgHandler( + XtErrorMsgHandler handler) { #if GLOBALERRORS LOCK_PROCESS; @@ -437,8 +448,8 @@ XtErrorMsgHandler XtAppSetErrorMsgHandler( return old; } -void XtSetWarningMsgHandler(handler) - XtErrorMsgHandler handler; +void XtSetWarningMsgHandler( + XtErrorMsgHandler handler) { #if GLOBALERRORS LOCK_PROCESS; @@ -471,19 +482,17 @@ XtErrorMsgHandler XtAppSetWarningMsgHandler( return old; } -void _XtDefaultError(message) - String message; +void _XtDefaultError(String message) { if (message && *message) (void)fprintf(stderr, "%sError: %s\n", XTERROR_PREFIX, message); exit(1); } -void _XtDefaultWarning(message) - String message; +void _XtDefaultWarning(String message) { if (message && *message) - (void)fprintf(stderr, "%sWarning: %s\n", XTWARNING_PREFIX, message); + (void)fprintf(stderr, "%sWarning: %s\n", XTWARNING_PREFIX, message); return; } @@ -607,9 +616,11 @@ XtErrorHandler XtAppSetWarningHandler( return old; } -void _XtSetDefaultErrorHandlers(errMsg, warnMsg, err, warn) - XtErrorMsgHandler *errMsg, *warnMsg; - XtErrorHandler *err, *warn; +void _XtSetDefaultErrorHandlers( + XtErrorMsgHandler *errMsg, + XtErrorMsgHandler *warnMsg, + XtErrorHandler *err, + XtErrorHandler *warn) { #ifndef GLOBALERRORS LOCK_PROCESS; diff --git a/src/Event.c b/src/Event.c index 6ab810d..8992f10 100644 --- a/src/Event.c +++ b/src/Event.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -91,8 +91,8 @@ typedef struct _XtEventRecExt { (XtExposeGraphicsExposeMerged & COMP_EXPOSE)) #define NO_EXPOSE (XtExposeNoExpose & COMP_EXPOSE) -EventMask XtBuildEventMask(widget) - Widget widget; +EventMask XtBuildEventMask( + Widget widget) { XtEventTable ev; EventMask mask = 0L; @@ -105,7 +105,7 @@ EventMask XtBuildEventMask(widget) mask |= ev->mask; else { if (EXT_TYPE(ev) < LASTEvent) { - int i; + Cardinal i; for (i = 0; i < ev->mask; i++) if (EXT_SELECT_DATA(ev, i)) mask |= *(EventMask*)EXT_SELECT_DATA(ev, i); @@ -115,7 +115,7 @@ EventMask XtBuildEventMask(widget) LOCK_PROCESS; if (widget->core.widget_class->core_class.expose != NULL) mask |= ExposureMask; - if (widget->core.widget_class->core_class.visible_interest) + if (widget->core.widget_class->core_class.visible_interest) mask |= VisibilityChangeMask; UNLOCK_PROCESS; if (widget->core.tm.translations) @@ -126,15 +126,15 @@ EventMask XtBuildEventMask(widget) return mask; } -static void CallExtensionSelector(widget, rec, forceCall) - Widget widget; - ExtSelectRec* rec; - Boolean forceCall; +static void CallExtensionSelector( + Widget widget, + ExtSelectRec* rec, + Boolean forceCall) { XtEventRec* p; XtPointer* data; int* types; - int i, count = 0; + Cardinal i, count = 0; for (p = widget->core.event_table; p != NULL; p = p->next) if (p->has_type_specifier && @@ -161,15 +161,15 @@ static void CallExtensionSelector(widget, rec, forceCall) } static void -RemoveEventHandler(widget, select_data, type, has_type_specifier, other, - proc, closure, raw) - Widget widget; - XtPointer select_data; - int type; - Boolean has_type_specifier, other; - XtEventHandler proc; - XtPointer closure; - Boolean raw; +RemoveEventHandler( + Widget widget, + XtPointer select_data, + int type, + Boolean has_type_specifier, + Boolean other, + XtEventHandler proc, + XtPointer closure, + Boolean raw) { XtEventRec *p, **pp; EventMask eventMask, oldMask = XtBuildEventMask(widget); @@ -191,7 +191,7 @@ RemoveEventHandler(widget, select_data, type, has_type_specifier, other, eventMask |= NonMaskableMask; p->mask &= ~eventMask; } else { - int i; + Cardinal i; /* p->mask specifies count of EXT_SELECT_DATA(p,i) * search through the list of selection data, if not found * dont remove this handler @@ -210,7 +210,7 @@ RemoveEventHandler(widget, select_data, type, has_type_specifier, other, if (!p->mask) { /* delete it entirely */ *pp = p->next; - XtFree((char *)p); + XtFree((char *)p); } /* Reset select mask if realized and not raw. */ @@ -218,7 +218,7 @@ RemoveEventHandler(widget, select_data, type, has_type_specifier, other, EventMask mask = XtBuildEventMask(widget); Display* dpy = XtDisplay (widget); - if (oldMask != mask) + if (oldMask != mask) XSelectInput(dpy, XtWindow(widget), mask); if (has_type_specifier) { @@ -246,22 +246,24 @@ RemoveEventHandler(widget, select_data, type, has_type_specifier, other, * closure - data to pass to the event hander. * position - where to add this event handler. * force_new_position - If the element is already in the - * list, this will force it to the + * list, this will force it to the * beginning or end depending on position. * raw - If FALSE call XSelectInput for events in mask. * Returns: none */ -static void -AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, - closure, position, force_new_position, raw) - Widget widget; - XtPointer select_data; - int type; - Boolean has_type_specifier, other, force_new_position, raw; - XtEventHandler proc; - XtPointer closure; - XtListPosition position; +static void +AddEventHandler( + Widget widget, + XtPointer select_data, + int type, + Boolean has_type_specifier, + Boolean other, + XtEventHandler proc, + XtPointer closure, + XtListPosition position, + Boolean force_new_position, + Boolean raw) { register XtEventRec *p, **pp; EventMask oldMask = 0, eventMask = 0; @@ -271,9 +273,9 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, if (other) eventMask |= NonMaskableMask; if (!eventMask) return; } else if (!type) return; - + if (XtIsRealized(widget) && !raw) oldMask = XtBuildEventMask(widget); - + if (raw) raw = 1; pp = &widget->core.event_table; while ((p = *pp) && @@ -284,7 +286,7 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, if (!p) { /* New proc to add to list */ if (has_type_specifier) { - p = (XtEventRec*) __XtMalloc(sizeof(XtEventRec) + + p = (XtEventRec*) __XtMalloc(sizeof(XtEventRec) + sizeof(XtEventRecExt)); EXT_TYPE(p) = type; EXT_SELECT_DATA(p,0) = select_data; @@ -298,7 +300,7 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, p->proc = proc; p->closure = closure; p->select = ! raw; - + if (position == XtListHead) { p->next = widget->core.event_table; widget->core.event_table = p; @@ -307,7 +309,7 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, *pp = p; p->next = NULL; } - } + } else { if (force_new_position) { *pp = p->next; @@ -329,7 +331,7 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, if (!has_type_specifier) p->mask |= eventMask; else { - int i; + Cardinal i; /* p->mask specifies count of EXT_SELECT_DATA(p,i) */ for (i = 0; i < p->mask && select_data != EXT_SELECT_DATA(p,i); ) i++; @@ -349,7 +351,7 @@ AddEventHandler(widget, select_data, type, has_type_specifier, other, proc, EventMask mask = XtBuildEventMask(widget); Display* dpy = XtDisplay (widget); - if (oldMask != mask) + if (oldMask != mask) XSelectInput(dpy, XtWindow(widget), mask); if (has_type_specifier) { @@ -390,7 +392,7 @@ void XtAddEventHandler( { WIDGET_TO_APPCON(widget); LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, + AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, proc, closure, XtListTail, FALSE, FALSE); UNLOCK_APP(app); } @@ -405,7 +407,7 @@ void XtInsertEventHandler( { WIDGET_TO_APPCON(widget); LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, + AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, proc, closure, position, TRUE, FALSE); UNLOCK_APP(app); } @@ -434,7 +436,7 @@ void XtInsertRawEventHandler( { WIDGET_TO_APPCON(widget); LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, + AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, proc, closure, position, TRUE, TRUE); UNLOCK_APP(app); } @@ -448,7 +450,7 @@ void XtAddRawEventHandler( { WIDGET_TO_APPCON(widget); LOCK_APP(app); - AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, + AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, proc, closure, XtListTail, FALSE, TRUE); UNLOCK_APP(app); } @@ -504,12 +506,12 @@ static const WidgetRec WWfake; /* placeholder for deletions */ #define WWREHASH(tab,idx,rehash) ((idx + rehash) & tab->mask) #define WWTABLE(display) (_XtGetPerDisplay(display)->WWtable) -static void ExpandWWTable(); +static void ExpandWWTable(WWTable); -void XtRegisterDrawable(display, drawable, widget) - Display* display; - Drawable drawable; - Widget widget; +void XtRegisterDrawable( + Display* display, + Drawable drawable, + Widget widget) { WWTable tab; int idx, rehash; @@ -550,9 +552,9 @@ void XtRegisterDrawable(display, drawable, widget) UNLOCK_APP(app); } -void XtUnregisterDrawable(display, drawable) - Display* display; - Drawable drawable; +void XtUnregisterDrawable( + Display* display, + Drawable drawable) { WWTable tab; int idx, rehash; @@ -600,12 +602,12 @@ void XtUnregisterDrawable(display, drawable) UNLOCK_APP(app); } -static void ExpandWWTable(tab) - register WWTable tab; +static void ExpandWWTable( + register WWTable tab) { unsigned int oldmask; register Widget *oldentries, *entries; - register int oldidx, newidx, rehash; + register Cardinal oldidx, newidx, rehash; register Widget entry; LOCK_PROCESS; @@ -634,9 +636,9 @@ static void ExpandWWTable(tab) UNLOCK_PROCESS; } -Widget XtWindowToWidget(display, window) - register Display *display; - register Window window; +Widget XtWindowToWidget( + register Display *display, + register Window window) { register WWTable tab; register int idx, rehash; @@ -674,8 +676,8 @@ Widget XtWindowToWidget(display, window) return NULL; } -void _XtAllocWWTable(pd) - XtPerDisplay pd; +void _XtAllocWWTable( + XtPerDisplay pd) { register WWTable tab; @@ -689,8 +691,8 @@ void _XtAllocWWTable(pd) pd->WWtable = tab; } -void _XtFreeWWTable(pd) - register XtPerDisplay pd; +void _XtFreeWWTable( + register XtPerDisplay pd) { register WWPair pair, next; @@ -704,12 +706,12 @@ void _XtFreeWWTable(pd) #define EHMAXSIZE 25 /* do not make whopping big */ -static Boolean CallEventHandlers(widget, event, mask) - Widget widget; - XEvent *event; - EventMask mask; +static Boolean CallEventHandlers( + Widget widget, + XEvent *event, + EventMask mask) { - register XtEventRec *p; + register XtEventRec *p; XtEventHandler *proc; XtPointer *closure; XtEventHandler procs[EHMAXSIZE]; @@ -743,7 +745,7 @@ static Boolean CallEventHandlers(widget, event, mask) numprocs++; } } -/* FUNCTIONS CALLED THROUGH POINTER proc: +/* FUNCTIONS CALLED THROUGH POINTER proc: Selection.c:ReqCleanup, "Shell.c":EventHandler, PassivGrab.c:ActiveHandler, @@ -763,7 +765,7 @@ static Boolean CallEventHandlers(widget, event, mask) return cont_to_disp; } -static void CompressExposures(); +static void CompressExposures(XEvent *, Widget); #define KnownButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) @@ -799,7 +801,7 @@ Boolean XtDispatchEventToWidget( /* We need to mask off the bits that could contain the information * about whether or not we desire Graphics and NoExpose events. */ - if ( (COMP_EXPOSE_TYPE == XtExposeNoCompress) || + if ( (COMP_EXPOSE_TYPE == XtExposeNoCompress) || (event->type == NoExpose) ) (*widget->core.widget_class->core_class.expose) @@ -867,7 +869,7 @@ Boolean XtDispatchEventToWidget( int i; for (i = 0; i < numprocs && cont_to_disp; i++) (*(proc[i]))(widget, closure[i], event, &cont_to_disp); -/* FUNCTIONS CALLED THROUGH POINTER proc: +/* FUNCTIONS CALLED THROUGH POINTER proc: Selection.c:ReqCleanup, "Shell.c":EventHandler, PassivGrab.c:ActiveHandler, @@ -902,16 +904,16 @@ Boolean XtDispatchEventToWidget( typedef struct _CheckExposeInfo { int type1, type2; /* Types of events to check for. */ Boolean maximal; /* Ignore non-exposure events? */ - Boolean non_matching; /* Was there an event that did not + Boolean non_matching; /* Was there an event that did not match either type? */ Window window; /* Window to match. */ } CheckExposeInfo; #define GetCount(ev) (((XExposeEvent *)(ev))->count) -static void SendExposureEvent(); -static Bool CheckExposureEvent(); -static void AddExposureToRectangularRegion(); +static void SendExposureEvent(XEvent *, Widget, XtPerDisplay); +static Bool CheckExposureEvent(Display *, XEvent *, char *); +static void AddExposureToRectangularRegion(XEvent *, Region); /* Function Name: CompressExposures * Description: Handles all exposure compression @@ -923,9 +925,9 @@ static void AddExposureToRectangularRegion(); */ static void -CompressExposures(event, widget) -Widget widget; -XEvent * event; +CompressExposures( +XEvent * event, +Widget widget) { CheckExposeInfo info; int count; @@ -948,7 +950,7 @@ XEvent * event; if ( GetCount(event) != 0 ) return; - + if ((comp_expose_type == XtExposeCompressSeries) || (XEventsQueued(dpy, QueuedAfterReading) == 0)) { SendExposureEvent(event, widget, pd); @@ -974,7 +976,7 @@ XEvent * event; * First, check to see if there are any events in the queue for this * widget, and of the correct type. * - * Once we cannot find any more events, check to see that count is zero. + * Once we cannot find any more events, check to see that count is zero. * If it is not then block until we get another exposure event. * * If we find no more events, and count on the last one we saw was zero we @@ -990,7 +992,7 @@ XEvent * event; while (TRUE) { XEvent event_return; - if (XCheckIfEvent(dpy, &event_return, + if (XCheckIfEvent(dpy, &event_return, CheckExposureEvent, (char *) &info)) { count = GetCount(&event_return); @@ -1015,9 +1017,9 @@ XEvent * event; SendExposureEvent(event, widget, pd); } -void XtAddExposureToRegion(event, region) - XEvent *event; - Region region; +void XtAddExposureToRegion( + XEvent *event, + Region region) { XRectangle rect; XExposeEvent *ev = (XExposeEvent *) event; @@ -1040,9 +1042,9 @@ void XtAddExposureToRegion(event, region) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif -static void AddExposureToRectangularRegion(event, region) - XEvent *event; /* when called internally, type is always appropriate */ - Region region; +static void AddExposureToRectangularRegion( + XEvent *event, /* when called internally, type is always appropriate */ + Region region) { XRectangle rect; XExposeEvent *ev = (XExposeEvent *) event; @@ -1072,7 +1074,7 @@ static void AddExposureToRectangularRegion(event, region) static Region nullRegion; /* READ-ONLY VARIABLES: nullRegion */ -void _XtEventInitialize() +void _XtEventInitialize(void) { #ifndef __lock_lint nullRegion = XCreateRegion(); @@ -1089,16 +1091,16 @@ void _XtEventInitialize() */ static void -SendExposureEvent(event, widget, pd) -XEvent * event; -Widget widget; -XtPerDisplay pd; +SendExposureEvent( +XEvent * event, +Widget widget, +XtPerDisplay pd) { XtExposeProc expose; XRectangle rect; XtEnum comp_expose; XExposeEvent *ev = (XExposeEvent *) event; - + XClipBox(pd->region, &rect); ev->x = rect.x; ev->y = rect.y; @@ -1130,10 +1132,10 @@ XtPerDisplay pd; /* ARGSUSED */ static Bool -CheckExposureEvent(disp, event, arg) -Display * disp; -XEvent * event; -char * arg; +CheckExposureEvent( +Display * disp, +XEvent * event, +char * arg) { CheckExposeInfo * info = ((CheckExposeInfo *) arg); @@ -1193,18 +1195,18 @@ static EventMask const masks[] = { NonMaskableMask /* MappingNotify */ }; -EventMask _XtConvertTypeToMask (eventType) - int eventType; +EventMask _XtConvertTypeToMask ( + int eventType) { - if (eventType < XtNumber(masks)) + if ((Cardinal) eventType < XtNumber(masks)) return masks[eventType]; else return NoEventMask; } -Boolean _XtOnGrabList(widget, grabList) - register Widget widget; - XtGrabRec *grabList; +Boolean _XtOnGrabList( + register Widget widget, + XtGrabRec *grabList) { register XtGrabRec* gl; for (; widget != NULL; widget = (Widget)widget->core.parent) { @@ -1216,8 +1218,8 @@ Boolean _XtOnGrabList(widget, grabList) return FALSE; } -static Widget LookupSpringLoaded(grabList) - XtGrabList grabList; +static Widget LookupSpringLoaded( + XtGrabList grabList) { XtGrabList gl; @@ -1233,9 +1235,9 @@ static Widget LookupSpringLoaded(grabList) return NULL; } -static Boolean DispatchEvent(event, widget) - XEvent* event; - Widget widget; +static Boolean DispatchEvent( + XEvent* event, + Widget widget) { if (event->type == EnterNotify && @@ -1280,8 +1282,8 @@ typedef enum _GrabType {pass, ignore, remap} GrabType; #if !defined(AIXV3) || !defined(AIXSHLIB) static /* AIX shared libraries are broken */ #endif -Boolean _XtDefaultDispatcher(event) - XEvent *event; +Boolean _XtDefaultDispatcher( + XEvent *event) { register Widget widget; GrabType grabType; @@ -1321,15 +1323,15 @@ Boolean _XtDefaultDispatcher(event) else was_dispatched = XFilterEvent(event, None); } else if (grabType == pass) { - if (event->type == LeaveNotify || + if (event->type == LeaveNotify || event->type == FocusIn || event->type == FocusOut) { if (XtIsSensitive (widget)) - was_dispatched = (XFilterEvent(event, XtWindow(widget)) || + was_dispatched = (XFilterEvent(event, XtWindow(widget)) || XtDispatchEventToWidget(widget, event)); - } else was_dispatched = (XFilterEvent(event, XtWindow(widget)) || + } else was_dispatched = (XFilterEvent(event, XtWindow(widget)) || XtDispatchEventToWidget(widget, event)); - } + } else if (grabType == ignore) { if ((grabList == NULL || _XtOnGrabList(widget, grabList)) && XtIsSensitive(widget)) { @@ -1343,7 +1345,7 @@ Boolean _XtDefaultDispatcher(event) Boolean was_filtered = False; dspWidget = _XtFindRemapWidget(event, widget, mask, pdi); - + if ((grabList == NULL ||_XtOnGrabList(dspWidget, grabList)) && XtIsSensitive(dspWidget)) { if ((was_filtered = XFilterEvent(event, XtWindow(dspWidget)))) { @@ -1371,8 +1373,8 @@ Boolean _XtDefaultDispatcher(event) return was_dispatched; } -Boolean XtDispatchEvent (event) - XEvent *event; +Boolean XtDispatchEvent ( + XEvent *event) { Boolean was_dispatched, safe; int dispatch_level; @@ -1432,19 +1434,19 @@ Boolean XtDispatchEvent (event) } /* ARGSUSED */ -static void GrabDestroyCallback(widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +static void GrabDestroyCallback( + Widget widget, + XtPointer closure, + XtPointer call_data) { /* Remove widget from grab list if it destroyed */ XtRemoveGrab(widget); } -static XtGrabRec *NewGrabRec(widget, exclusive, spring_loaded) - Widget widget; - Boolean exclusive; - Boolean spring_loaded; +static XtGrabRec *NewGrabRec( + Widget widget, + Boolean exclusive, + Boolean spring_loaded) { register XtGrabList gl; @@ -1482,14 +1484,14 @@ void XtAddGrab( gl->next = *grabListPtr; *grabListPtr = gl; - XtAddCallback (widget, XtNdestroyCallback, + XtAddCallback (widget, XtNdestroyCallback, GrabDestroyCallback, (XtPointer) NULL); UNLOCK_PROCESS; UNLOCK_APP(app); } -void XtRemoveGrab(widget) - Widget widget; +void XtRemoveGrab( + Widget widget) { register XtGrabList gl; register Boolean done; @@ -1513,7 +1515,7 @@ void XtRemoveGrab(widget) UNLOCK_PROCESS; UNLOCK_APP(app); return; - } + } do { gl = *grabListPtr; @@ -1528,13 +1530,13 @@ void XtRemoveGrab(widget) return; } -void XtMainLoop() +void XtMainLoop(void) { XtAppMainLoop(_XtDefaultAppContext()); } -void XtAppMainLoop(app) - XtAppContext app; +void XtAppMainLoop( + XtAppContext app) { XEvent event; @@ -1549,8 +1551,8 @@ void XtAppMainLoop(app) UNLOCK_APP(app); } -void _XtFreeEventTable(event_table) - XtEventTable *event_table; +void _XtFreeEventTable( + XtEventTable *event_table) { register XtEventTable event; @@ -1562,8 +1564,8 @@ void _XtFreeEventTable(event_table) } } -Time XtLastTimestampProcessed(dpy) - Display *dpy; +Time XtLastTimestampProcessed( + Display *dpy) { Time time; DPY_TO_APPCON(dpy); @@ -1575,13 +1577,13 @@ Time XtLastTimestampProcessed(dpy) UNLOCK_APP(app); return(time); } - -XEvent* XtLastEventProcessed(dpy) - Display* dpy; + +XEvent* XtLastEventProcessed( + Display* dpy) { XEvent* le = NULL; DPY_TO_APPCON(dpy); - + LOCK_APP(app); le = &_XtGetPerDisplay(dpy)->last_event; if (!le->xany.serial) @@ -1590,9 +1592,9 @@ XEvent* XtLastEventProcessed(dpy) return le; } -void _XtSendFocusEvent(child, type) - Widget child; - int type; +void _XtSendFocusEvent( + Widget child, + int type) { child = XtIsWidget(child) ? child : _XtWindowedAncestor(child); if (XtIsSensitive(child) && !child->core.being_destroyed @@ -1615,7 +1617,7 @@ void _XtSendFocusEvent(child, type) } } -static XtEventDispatchProc* NewDispatcherList() +static XtEventDispatchProc* NewDispatcherList(void) { XtEventDispatchProc* l = (XtEventDispatchProc*) __XtCalloc((Cardinal) 128, @@ -1678,14 +1680,14 @@ void XtRegisterExtensionSelector( e->client_data = client_data; return; } - if ((min_event_type >= e->min && min_event_type <= e->max) || + if ((min_event_type >= e->min && min_event_type <= e->max) || (max_event_type >= e->min && max_event_type <= e->max)) { XtErrorMsg("rangeError", "xtRegisterExtensionSelector", XtCXtToolkitError, "Attempt to register multiple selectors for one extension event type", (String *) NULL, (Cardinal *) NULL); UNLOCK_PROCESS; - UNLOCK_APP(app); + UNLOCK_APP(app); return; } } @@ -1706,8 +1708,8 @@ void XtRegisterExtensionSelector( UNLOCK_APP(app); } -void _XtExtensionSelect(widget) - Widget widget; +void _XtExtensionSelect( + Widget widget) { int i; XtPerDisplay pd; diff --git a/src/EventUtil.c b/src/EventUtil.c index df0b7ea..e38c904 100644 --- a/src/EventUtil.c +++ b/src/EventUtil.c @@ -6,13 +6,13 @@ Copyright 1988 by Hewlett-Packard Company Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation, and that the names of -Hewlett-Packard, Digital, or Sun not be used in advertising or -publicity pertaining to distribution of the software without specific, +Permission to use, copy, modify, and distribute this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the names of +Hewlett-Packard, Digital, or Sun not be used in advertising or +publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING @@ -68,15 +68,15 @@ in this Software without prior written authorization from The Open Group. static XContext perWidgetInputContext = 0; -void _XtFreePerWidgetInput(w, pwi) - Widget w; - XtPerWidgetInput pwi; +void _XtFreePerWidgetInput( + Widget w, + XtPerWidgetInput pwi) { LOCK_PROCESS; - XDeleteContext(XtDisplay(w), + XDeleteContext(XtDisplay(w), (Window)w, perWidgetInputContext); - + XtFree((char *)pwi); UNLOCK_PROCESS; } @@ -95,16 +95,16 @@ XtPerWidgetInput _XtGetPerWidgetInput( LOCK_PROCESS; if (! perWidgetInputContext) perWidgetInputContext = XUniqueContext(); - - if (XFindContext(dpy, - (Window)widget, - perWidgetInputContext, + + if (XFindContext(dpy, + (Window)widget, + perWidgetInputContext, (XPointer *)&pwi) && - create) + create) { - pwi = (XtPerWidgetInput) + pwi = (XtPerWidgetInput) __XtMalloc((unsigned) sizeof(XtPerWidgetInputRec)); - + pwi->focusKid = NULL; pwi->queryEventDescendant = NULL; pwi->focalPoint = XtUnrelated; @@ -113,15 +113,15 @@ XtPerWidgetInput _XtGetPerWidgetInput( pwi->haveFocus = pwi->map_handler_added = - pwi->realize_handler_added = + pwi->realize_handler_added = pwi->active_handler_added = FALSE; - - XtAddCallback(widget, XtNdestroyCallback, + + XtAddCallback(widget, XtNdestroyCallback, _XtDestroyServerGrabs, (XtPointer)pwi); - (void) XSaveContext(dpy, - (Window)widget, - perWidgetInputContext, + (void) XSaveContext(dpy, + (Window)widget, + perWidgetInputContext, (char *) pwi); } UNLOCK_PROCESS; @@ -129,10 +129,12 @@ XtPerWidgetInput _XtGetPerWidgetInput( } -void _XtFillAncestorList(listPtr, maxElemsPtr, numElemsPtr, start, breakWidget) - Widget **listPtr; - int *maxElemsPtr, *numElemsPtr; - Widget start, breakWidget; +void _XtFillAncestorList( + Widget **listPtr, + int *maxElemsPtr, + int *numElemsPtr, + Widget start, + Widget breakWidget) { #define CACHESIZE 16 Cardinal i; @@ -140,19 +142,19 @@ void _XtFillAncestorList(listPtr, maxElemsPtr, numElemsPtr, start, breakWidget) Widget *trace = *listPtr; /* First time in, allocate the ancestor list */ - if (trace == NULL) + if (trace == NULL) { trace = (Widget *) __XtMalloc(CACHESIZE * sizeof(Widget)); *maxElemsPtr = CACHESIZE; - } + } /* First fill in the ancestor list */ trace[0] = start; - for (i = 1, w = XtParent(start); - w != NULL && !XtIsShell(trace[i-1]) && trace[i-1] != breakWidget; + for (i = 1, w = XtParent(start); + w != NULL && !XtIsShell(trace[i-1]) && trace[i-1] != breakWidget; w = XtParent(w), i++) { - if (i == *maxElemsPtr) { + if (i == (Cardinal) *maxElemsPtr) { /* This should rarely happen, but if it does it'll probably happen again, so grow the ancestor list */ *maxElemsPtr += CACHESIZE; @@ -164,20 +166,20 @@ void _XtFillAncestorList(listPtr, maxElemsPtr, numElemsPtr, start, breakWidget) *listPtr = trace; *numElemsPtr = i; #undef CACHESIZE -} +} -Widget _XtFindRemapWidget(event, widget, mask, pdi) - XEvent *event; - Widget widget; - EventMask mask; - XtPerDisplayInput pdi; +Widget _XtFindRemapWidget( + XEvent *event, + Widget widget, + EventMask mask, + XtPerDisplayInput pdi) { Widget dspWidget = widget; - + if (!pdi->traceDepth || !(widget == pdi->trace[0])) { - _XtFillAncestorList(&pdi->trace, &pdi->traceMax, + _XtFillAncestorList(&pdi->trace, &pdi->traceMax, &pdi->traceDepth, widget, NULL); pdi->focusWidget = NULL; /* invalidate the focus cache */ @@ -190,11 +192,11 @@ Widget _XtFindRemapWidget(event, widget, mask, pdi) return dspWidget; } -void _XtUngrabBadGrabs(event, widget, mask, pdi) - XEvent *event; - Widget widget; - EventMask mask; - XtPerDisplayInput pdi; +void _XtUngrabBadGrabs( + XEvent *event, + Widget widget, + EventMask mask, + XtPerDisplayInput pdi) { XKeyEvent * ke = (XKeyEvent *) event; diff --git a/src/Functions.c b/src/Functions.c index 3fc4d18..f6cf87e 100644 --- a/src/Functions.c +++ b/src/Functions.c @@ -60,48 +60,42 @@ in this Software without prior written authorization from The Open Group. */ #undef XtIsRectObj -Boolean XtIsRectObj(object) - Widget object; +Boolean XtIsRectObj(Widget object) { return _XtCheckSubclassFlag(object, 0x02); } #undef XtIsWidget -Boolean XtIsWidget(object) - Widget object; +Boolean XtIsWidget(Widget object) { return _XtCheckSubclassFlag(object, 0x04); } #undef XtIsComposite -Boolean XtIsComposite(object) - Widget object; +Boolean XtIsComposite(Widget object) { return _XtCheckSubclassFlag(object, 0x08); } #undef XtIsConstraint -Boolean XtIsConstraint(object) - Widget object; +Boolean XtIsConstraint(Widget object) { return _XtCheckSubclassFlag(object, 0x10); } #undef XtIsShell -Boolean XtIsShell(object) - Widget object; +Boolean XtIsShell(Widget object) { return _XtCheckSubclassFlag(object, 0x20); } #undef XtIsOverrideShell -Boolean XtIsOverrideShell(object) - Widget object; +Boolean XtIsOverrideShell(Widget object) { return _XtIsSubclassOf(object, (WidgetClass)overrideShellWidgetClass, (WidgetClass)shellWidgetClass, 0x20); @@ -109,16 +103,14 @@ Boolean XtIsOverrideShell(object) #undef XtIsWMShell -Boolean XtIsWMShell(object) - Widget object; +Boolean XtIsWMShell(Widget object) { return _XtCheckSubclassFlag(object, 0x40); } #undef XtIsVendorShell -Boolean XtIsVendorShell(object) - Widget object; +Boolean XtIsVendorShell(Widget object) { Boolean retval; @@ -139,8 +131,7 @@ Boolean XtIsVendorShell(object) #undef XtIsTransientShell -Boolean XtIsTransientShell(object) - Widget object; +Boolean XtIsTransientShell(Widget object) { return _XtIsSubclassOf(object, (WidgetClass)transientShellWidgetClass, (WidgetClass)wmShellWidgetClass, 0x40); @@ -148,32 +139,28 @@ Boolean XtIsTransientShell(object) #undef XtIsTopLevelShell -Boolean XtIsTopLevelShell(object) - Widget object; +Boolean XtIsTopLevelShell(Widget object) { return _XtCheckSubclassFlag(object, 0x80); } #undef XtIsApplicationShell -Boolean XtIsApplicationShell(object) - Widget object; +Boolean XtIsApplicationShell(Widget object) { return _XtIsSubclassOf(object, (WidgetClass)applicationShellWidgetClass, (WidgetClass)topLevelShellWidgetClass, 0x80); } #undef XtIsSessionShell -Boolean XtIsSessionShell(object) - Widget object; +Boolean XtIsSessionShell(Widget object) { return _XtIsSubclassOf(object, (WidgetClass)sessionShellWidgetClass, (WidgetClass)topLevelShellWidgetClass, 0x80); } #undef XtMapWidget -void XtMapWidget(w) - Widget w; +void XtMapWidget(Widget w) { Widget hookobj; WIDGET_TO_APPCON(w); @@ -186,8 +173,8 @@ void XtMapWidget(w) call_data.type = XtHmapWidget; call_data.widget = w; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); @@ -195,8 +182,7 @@ void XtMapWidget(w) #undef XtUnmapWidget -void XtUnmapWidget(w) - Widget w; +void XtUnmapWidget(Widget w) { Widget hookobj; WIDGET_TO_APPCON(w); @@ -209,8 +195,8 @@ void XtUnmapWidget(w) call_data.type = XtHunmapWidget; call_data.widget = w; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); @@ -218,8 +204,7 @@ void XtUnmapWidget(w) #undef XtNewString -String XtNewString(str) - String str; +String XtNewString(String str) { if (str == NULL) return NULL; diff --git a/src/GCManager.c b/src/GCManager.c index dd765c5..127d8df 100644 --- a/src/GCManager.c +++ b/src/GCManager.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -110,12 +110,12 @@ static Bool Matches( checkMask = readOnlyMask & ~ptr->unused_mask; CHECK(GCForeground, foreground, 0); CHECK(GCBackground, background, 1); - CHECK(GCFont, font, ~0L); + CHECK(GCFont, font, ~0UL); CHECK(GCFillStyle, fill_style, FillSolid); CHECK(GCLineWidth, line_width, 0); CHECK(GCFunction, function, GXcopy); CHECK(GCGraphicsExposures, graphics_exposures, True); - CHECK(GCTile, tile, ~0L); + CHECK(GCTile, tile, ~0UL); CHECK(GCSubwindowMode, subwindow_mode, ClipByChildren); CHECK(GCPlaneMask, plane_mask, AllPlanes); CHECK(GCLineStyle, line_style, LineSolid); @@ -123,7 +123,7 @@ static Bool Matches( CHECK(GCJoinStyle, join_style, JoinMiter); CHECK(GCFillRule, fill_rule, EvenOddRule); CHECK(GCArcMode, arc_mode, ArcPieSlice); - CHECK(GCStipple, stipple, ~0L); + CHECK(GCStipple, stipple, ~0UL); CHECK(GCTileStipXOrigin, ts_x_origin, 0); CHECK(GCTileStipYOrigin, ts_y_origin, 0); CHECK(GCClipXOrigin, clip_x_origin, 0); @@ -147,9 +147,9 @@ static Bool Matches( } /* Matches */ /* Called by CloseDisplay to free the per-display GC list */ -void _XtGClistFree(dpy, pd) - Display *dpy; - register XtPerDisplay pd; +void _XtGClistFree( + Display *dpy, + register XtPerDisplay pd) { register GCptr GClist, next; register int i; @@ -170,17 +170,17 @@ void _XtGClistFree(dpy, pd) } -/* +/* * Return a GC with the given values and characteristics. */ -GC XtAllocateGC(widget, depth, valueMask, values, dynamicMask, unusedMask) - register Widget widget; - Cardinal depth; - XtGCMask valueMask; - XGCValues *values; - XtGCMask dynamicMask; - XtGCMask unusedMask; +GC XtAllocateGC( + register Widget widget, + Cardinal depth, + XtGCMask valueMask, + XGCValues *values, + XtGCMask dynamicMask, + XtGCMask unusedMask) { register GCptr *prev; register GCptr cur; @@ -234,7 +234,7 @@ GC XtAllocateGC(widget, depth, valueMask, values, dynamicMask, unusedMask) drawable = 0; if (depth == widget->core.depth) drawable = XtWindow(widget); - if (!drawable && depth == DefaultDepthOfScreen(screen)) + if (!drawable && depth == (Cardinal) DefaultDepthOfScreen(screen)) drawable = RootWindowOfScreen(screen); if (!drawable) { if (!pd->pixmap_tab) { @@ -274,21 +274,21 @@ GC XtAllocateGC(widget, depth, valueMask, values, dynamicMask, unusedMask) return retval; } /* XtAllocateGC */ -/* - * Return a read-only GC with the given values. +/* + * Return a read-only GC with the given values. */ -GC XtGetGC(widget, valueMask, values) - register Widget widget; - XtGCMask valueMask; - XGCValues *values; +GC XtGetGC( + register Widget widget, + XtGCMask valueMask, + XGCValues *values) { return XtAllocateGC(widget, 0, valueMask, values, 0, 0); } /* XtGetGC */ -void XtReleaseGC(widget, gc) - Widget widget; - register GC gc; +void XtReleaseGC( + Widget widget, + register GC gc) { register GCptr cur, *prev; Display* dpy; @@ -299,7 +299,7 @@ void XtReleaseGC(widget, gc) LOCK_PROCESS; dpy = XtDisplayOfObject(widget); pd = _XtGetPerDisplay(dpy); - + for (prev = &pd->GClist; (cur = *prev); prev = &cur->next) { if (cur->gc == gc) { if (--(cur->ref_count) == 0) { @@ -319,8 +319,7 @@ void XtReleaseGC(widget, gc) * is exactly 1 Display created by the application. */ -void XtDestroyGC(gc) - register GC gc; +void XtDestroyGC(register GC gc) { GCptr cur, *prev; XtAppContext app; diff --git a/src/Geometry.c b/src/Geometry.c index 853bf04..2c1cca2 100644 --- a/src/Geometry.c +++ b/src/Geometry.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -90,15 +90,16 @@ static void ClearRectObjAreas( * Returns more data than the public interface. Does not convert * XtGeometryDone to XtGeometryYes. * - * clear_rect_obj - *** RETURNED *** + * clear_rect_obj - *** RETURNED *** * TRUE if the rect obj has been cleared, false otherwise. */ -XtGeometryResult -_XtMakeGeometryRequest (widget, request, reply, clear_rect_obj) - Widget widget; - XtWidgetGeometry *request, *reply; - Boolean * clear_rect_obj; +XtGeometryResult +_XtMakeGeometryRequest ( + Widget widget, + XtWidgetGeometry *request, + XtWidgetGeometry *reply, + Boolean * clear_rect_obj) { XtWidgetGeometry junk; XtGeometryHandler manager = (XtGeometryHandler) NULL; @@ -324,7 +325,7 @@ _XtMakeGeometryRequest (widget, request, reply, clear_rect_obj) * If Unrealized, not a XtGeometryYes, or a query-only then we are done. */ - if ((returnCode != XtGeometryYes) || + if ((returnCode != XtGeometryYes) || (req.changeMask & XtCWQueryOnly) || !XtIsRealized(widget)) { #ifdef XT_GEO_TATTLER @@ -350,7 +351,7 @@ _XtMakeGeometryRequest (widget, request, reply, clear_rect_obj) (reply)?reply->width:junk.width, (reply)?reply->height:junk.height)); CALLGEOTAT(_XtGeoTab(-1)); - + /* check for no change */ break ; case XtGeometryYes: @@ -459,9 +460,10 @@ _XtMakeGeometryRequest (widget, request, reply, clear_rect_obj) /* Public routines */ -XtGeometryResult XtMakeGeometryRequest (widget, request, reply) - Widget widget; - XtWidgetGeometry *request, *reply; +XtGeometryResult XtMakeGeometryRequest ( + Widget widget, + XtWidgetGeometry *request, + XtWidgetGeometry *reply) { Boolean junk; XtGeometryResult r; @@ -474,15 +476,15 @@ XtGeometryResult XtMakeGeometryRequest (widget, request, reply) call_data.type = XtHpreGeometry; call_data.widget = widget; call_data.request = request; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); - call_data.result = r = + call_data.result = r = _XtMakeGeometryRequest(widget, request, reply, &junk); call_data.type = XtHpostGeometry; call_data.reply = reply; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); } else { r = _XtMakeGeometryRequest(widget, request, reply, &junk); @@ -492,7 +494,7 @@ XtGeometryResult XtMakeGeometryRequest (widget, request, reply) return ((r == XtGeometryDone) ? XtGeometryYes : r); } -XtGeometryResult +XtGeometryResult XtMakeResizeRequest( Widget widget, _XtDimension width, @@ -516,15 +518,15 @@ XtMakeResizeRequest( call_data.type = XtHpreGeometry; call_data.widget = widget; call_data.request = &request; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); - call_data.result = r = + call_data.result = r = _XtMakeGeometryRequest(widget, &request, &reply, &junk); call_data.type = XtHpostGeometry; call_data.reply = &reply; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); } else { r = _XtMakeGeometryRequest(widget, &request, &reply, &junk); @@ -545,8 +547,8 @@ XtMakeResizeRequest( return ((r == XtGeometryDone) ? XtGeometryYes : r); } /* XtMakeResizeRequest */ -void XtResizeWindow(w) - Widget w; +void XtResizeWindow( + Widget w) { XtConfigureHookDataRec req; Widget hookobj; @@ -596,10 +598,10 @@ void XtConfigureWidget( CALLGEOTAT(_XtGeoTrace(w, "\"%s\" is being configured by its parent \"%s\"\n", - XtName(w), + XtName(w), (XtParent(w))?XtName(XtParent(w)):"Root")); CALLGEOTAT(_XtGeoTab(1)); - + LOCK_APP(app); req.changeMask = 0; if ((old.x = w->core.x) != x) { @@ -640,7 +642,7 @@ void XtConfigureWidget( if (XtIsWidget(w)) { CALLGEOTAT(_XtGeoTrace(w, "XConfigure \"%s\"'s window\n",XtName(w))); - XConfigureWindow(XtDisplay(w), XtWindow(w), + XConfigureWindow(XtDisplay(w), XtWindow(w), req.changeMask, &req.changes); } else { CALLGEOTAT(_XtGeoTrace(w, @@ -662,7 +664,7 @@ void XtConfigureWidget( LOCK_PROCESS; resize = XtClass(w)->core_class.resize; UNLOCK_PROCESS; - if ((req.changeMask & (CWWidth | CWHeight)) && + if ((req.changeMask & (CWWidth | CWHeight)) && resize != (XtWidgetProc) NULL) { CALLGEOTAT(_XtGeoTrace(w,"Resize proc is called.\n")); (*resize)(w); @@ -721,10 +723,10 @@ void XtTranslateCoords( UNLOCK_APP(app); } -XtGeometryResult XtQueryGeometry(widget, intended, reply) - Widget widget; - register XtWidgetGeometry *intended; /* parent's changes; may be NULL */ - XtWidgetGeometry *reply; /* child's preferred geometry; never NULL */ +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; @@ -790,7 +792,7 @@ XtGeometryResult XtQueryGeometry(widget, intended, reply) } 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; @@ -805,7 +807,7 @@ XtGeometryResult XtQueryGeometry(widget, intended, reply) CALLGEOTAT(_XtGeoTab(-1)); #undef FillIn - if (!(reply->request_mode & CWStackMode)) + if (!(reply->request_mode & CWStackMode)) reply->stack_mode = XtSMDontChange; UNLOCK_APP(app); return result; diff --git a/src/GetActKey.c b/src/GetActKey.c index 7e08a92..efa8cde 100644 --- a/src/GetActKey.c +++ b/src/GetActKey.c @@ -8,13 +8,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -63,9 +63,9 @@ in this Software without prior written authorization from The Open Group. #include "IntrinsicI.h" -KeySym XtGetActionKeysym(event, modifiers_return) - XEvent *event; - Modifiers *modifiers_return; +KeySym XtGetActionKeysym( + XEvent *event, + Modifiers *modifiers_return) { TMKeyContext tm_context; Modifiers modifiers; diff --git a/src/GetResList.c b/src/GetResList.c index b84160c..4c1ec6f 100644 --- a/src/GetResList.c +++ b/src/GetResList.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -69,13 +69,13 @@ in this Software without prior written authorization from The Open Group. #define TOXRMQUARK(p) ((XrmQuark)(long)(p)) /* avoid LP64 warnings */ -void XtGetResourceList(widget_class, resources, num_resources) - WidgetClass widget_class; - XtResourceList *resources; - Cardinal *num_resources; +void XtGetResourceList( + WidgetClass widget_class, + XtResourceList *resources, + Cardinal *num_resources) { int size; - register int i, dest = 0; + register Cardinal i, dest = 0; register XtResourceList *list, dlist; LOCK_PROCESS; @@ -85,7 +85,7 @@ void XtGetResourceList(widget_class, resources, num_resources) if (!widget_class->core_class.class_inited) { /* Easy case */ - (void) memmove((char *) *resources, + (void) memmove((char *) *resources, (char *)widget_class->core_class.resources, size); *num_resources = widget_class->core_class.num_resources; UNLOCK_PROCESS; @@ -100,7 +100,7 @@ void XtGetResourceList(widget_class, resources, num_resources) if (list[i] != NULL) { dlist[dest].resource_name = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_name)); - dlist[dest].resource_class = (String) + dlist[dest].resource_class = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_class)); dlist[dest].resource_type = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_type)); @@ -127,13 +127,13 @@ static Boolean ClassIsSubclassOf(WidgetClass class, WidgetClass superclass) return False; } -void XtGetConstraintResourceList(widget_class, resources, num_resources) - WidgetClass widget_class; - XtResourceList *resources; - Cardinal *num_resources; +void XtGetConstraintResourceList( + WidgetClass widget_class, + XtResourceList *resources, + Cardinal *num_resources) { int size; - register int i, dest = 0; + register Cardinal i, dest = 0; register XtResourceList *list, dlist; ConstraintWidgetClass class = (ConstraintWidgetClass)widget_class; @@ -156,7 +156,7 @@ void XtGetConstraintResourceList(widget_class, resources, num_resources) if (!class->core_class.class_inited) { /* Easy case */ - (void) memmove((char *) *resources, + (void) memmove((char *) *resources, (char *)class->constraint_class.resources, size); *num_resources = class->constraint_class.num_resources; UNLOCK_PROCESS; @@ -171,7 +171,7 @@ void XtGetConstraintResourceList(widget_class, resources, num_resources) if (list[i] != NULL) { dlist[dest].resource_name = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_name)); - dlist[dest].resource_class = (String) + dlist[dest].resource_class = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_class)); dlist[dest].resource_type = (String) XrmQuarkToString(TOXRMQUARK(list[i]->resource_type)); diff --git a/src/GetValues.c b/src/GetValues.c index bb09a27..73ab7b1 100644 --- a/src/GetValues.c +++ b/src/GetValues.c @@ -7,13 +7,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -72,7 +72,7 @@ static int GetValues( Cardinal num_args) /* number of items in arg list */ { register ArgList arg; - register int i; + register Cardinal i; register XrmName argName; register XrmResourceList* xrmres; int translation_arg_num = -1; @@ -183,10 +183,10 @@ static void CallConstraintGetValuesHook( } -void XtGetValues(w, args, num_args) - register Widget w; - register ArgList args; - register Cardinal num_args; +void XtGetValues( + register Widget w, + register ArgList args, + register Cardinal num_args) { WidgetClass wc; int targ; @@ -215,12 +215,12 @@ void XtGetValues(w, args, num_args) /* Get constraint values if necessary */ /* constraints may be NULL if constraint_size==0 */ - if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) && + if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) && w->core.constraints) { ConstraintWidgetClass cwc = (ConstraintWidgetClass) XtClass(XtParent(w)); LOCK_PROCESS; - GetValues((char*)w->core.constraints, + GetValues((char*)w->core.constraints, (XrmResourceList *)(cwc->constraint_class.resources), cwc->constraint_class.num_resources, args, num_args); UNLOCK_PROCESS; @@ -234,12 +234,12 @@ void XtGetValues(w, args, num_args) UNLOCK_APP(app); } /* XtGetValues */ -void XtGetSubvalues(base, resources, num_resources, args, num_args) - XtPointer base; /* Base address to fetch values from */ - XtResourceList resources; /* The current resource values. */ - Cardinal num_resources; /* number of items in resources */ - ArgList args; /* The resource values requested */ - Cardinal num_args; /* number of items in arg list */ +void XtGetSubvalues( + XtPointer base, /* Base address to fetch values from */ + XtResourceList resources, /* The current resource values. */ + Cardinal num_resources, /* number of items in resources */ + ArgList args, /* The resource values requested */ + Cardinal num_args) /* number of items in arg list */ { XrmResourceList* xrmres; xrmres = _XtCreateIndirectionTable(resources, num_resources); diff --git a/src/HookObj.c b/src/HookObj.c index 697974a..98417f9 100644 --- a/src/HookObj.c +++ b/src/HookObj.c @@ -70,7 +70,7 @@ externaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = { /* class_part_initialize*/ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ NULL, /* actions */ NULL, /* num_actions */ 0, @@ -85,9 +85,9 @@ externaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = { /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ NULL, - /* get_values_hook */ GetValuesHook, + /* set_values_hook */ NULL, + /* set_values_almost */ NULL, + /* get_values_hook */ GetValuesHook, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -101,7 +101,7 @@ externaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = { } }; -externaldef(hookObjectClass) WidgetClass hookObjectClass = +externaldef(hookObjectClass) WidgetClass hookObjectClass = (WidgetClass)&hookObjClassRec; static void FreeShellList( @@ -114,21 +114,21 @@ static void FreeShellList( XtFree((char*)h->hooks.shells); } -static void Initialize(req, new, args, num_args) - Widget req, new; - ArgList args; - Cardinal* num_args; +static void Initialize( + Widget req, + Widget new, + ArgList args, + Cardinal* num_args) { HookObject w = (HookObject) new; w->hooks.max_shells = 0; XtAddCallback (new, XtNdestroyCallback, FreeShellList, (XtPointer) NULL); } -static void GetValuesHook(widget, args, num_args) - Widget widget; - ArgList args; - Cardinal* num_args; +static void GetValuesHook( + Widget widget, + ArgList args, + Cardinal* num_args) { /* get the XtNshells and XtNnumShells pseudo-resources */ } - diff --git a/src/Hooks.c b/src/Hooks.c index af6b49f..5c113e1 100644 --- a/src/Hooks.c +++ b/src/Hooks.c @@ -46,10 +46,10 @@ static void FreeBlockHookList( } -XtBlockHookId XtAppAddBlockHook( app, proc, closure ) - XtAppContext app; - XtBlockHookProc proc; - XtPointer closure; +XtBlockHookId XtAppAddBlockHook( + XtAppContext app, + XtBlockHookProc proc, + XtPointer closure) { BlockHook hook = XtNew(BlockHookRec); LOCK_APP(app); @@ -69,8 +69,8 @@ XtBlockHookId XtAppAddBlockHook( app, proc, closure ) } -void XtRemoveBlockHook( id ) - XtBlockHookId id; +void XtRemoveBlockHook( + XtBlockHookId id) { BlockHook *p, hook = (BlockHook)id; XtAppContext app = hook->app; @@ -81,7 +81,7 @@ void XtRemoveBlockHook( id ) XtAppWarningMsg(app, "badId", "xtRemoveBlockHook", XtCXtToolkitError, "XtRemoveBlockHook called with bad or old hook id", (String*)NULL, (Cardinal*)NULL); -#endif /*DEBUG*/ +#endif /*DEBUG*/ UNLOCK_APP(app); return; } @@ -96,7 +96,7 @@ static void DeleteShellFromHookObj( XtPointer call_data) { /* app_con is locked when this function is called */ - int ii, jj; + Cardinal ii, jj; HookObject ho = (HookObject) closure; for (ii = 0; ii < ho->hooks.num_shells; ii++) @@ -121,13 +121,13 @@ void _XtAddShellToHookObj( if (ho->hooks.num_shells == ho->hooks.max_shells) { ho->hooks.max_shells += SHELL_INCR; - ho->hooks.shells = - (WidgetList)XtRealloc((char*)ho->hooks.shells, + ho->hooks.shells = + (WidgetList)XtRealloc((char*)ho->hooks.shells, ho->hooks.max_shells * sizeof (Widget)); } ho->hooks.shells[ho->hooks.num_shells++] = shell; - XtAddCallback(shell, XtNdestroyCallback, DeleteShellFromHookObj, + XtAddCallback(shell, XtNdestroyCallback, DeleteShellFromHookObj, (XtPointer)ho); } @@ -137,8 +137,8 @@ Boolean _XtIsHookObject( return (widget->core.widget_class == hookObjectClass); } -Widget XtHooksOfDisplay(dpy) - Display* dpy; +Widget XtHooksOfDisplay( + Display* dpy) { Widget retval; XtPerDisplay pd; @@ -147,7 +147,7 @@ Widget XtHooksOfDisplay(dpy) LOCK_APP(app); pd = _XtGetPerDisplay(dpy); if (pd->hook_object == NULL) - pd->hook_object = + pd->hook_object = _XtCreateHookObj((Screen*)DefaultScreenOfDisplay(dpy)); retval = pd->hook_object; UNLOCK_APP(app); diff --git a/src/Initialize.c b/src/Initialize.c index 9ad6522..09fb0cc 100644 --- a/src/Initialize.c +++ b/src/Initialize.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -110,7 +110,7 @@ in this Software without prior written authorization from The Open Group. /* This is a set of default records describing the command line arguments that Xlib will parse and set into the resource data base. - + This list is applied before the users list to enforce these defaults. This is policy, which the toolkit avoids but I hate differing programs at this level. */ @@ -176,7 +176,7 @@ static void GetHostname ( #ifdef SUNSHLIB -void _XtInherit() +void _XtInherit(void) { extern void __XtInherit(); __XtInherit(); @@ -201,19 +201,19 @@ void _XtInherit() * File adds a code stub to each client to provide the * exported symbol name. This stub uses an indirect * pointer to get the original symbol address, which is - * then jumped to, like in this example: + * then jumped to, like in this example: * * --- client --- --- dll ---- - * ... - * call foo - * - * foo: jmp (*_imp_foo) ----> foo: .... + * ... + * call foo + * + * foo: jmp (*_imp_foo) ----> foo: .... + * nop * nop - * nop - * + * * _imp_foo: .long <index of foo in dll export table, is * set to the real address by the runtime linker> - * + * * Now it is clear why the clients symbol foo isn't the same * as in the dll and we can think about how to deal which * this two above mentioned requirements, to export this @@ -224,12 +224,12 @@ void _XtInherit() * with the second requirement, that this symbol should * be used as function. The Trick is to build a little * code stub in the data section in the exact manner as - * above explained. This is done with the assembler code + * above explained. This is done with the assembler code * below. - * + * * Ralf Habacker * - * References: + * References: * msdn http://msdn.microsoft.com/msdnmag/issues/02/02/PE/PE.asp * cygwin-xfree: http://www.cygwin.com/ml/cygwin-xfree/2003-10/msg00000.html */ @@ -238,13 +238,13 @@ asm (".data\n\ .globl __XtInherit \n\ __XtInherit: jmp *_y \n\ _y: .long ___XtInherit \n\ - .text \n"); + .text \n"); #define _XtInherit __XtInherit #endif -void _XtInherit() +void _XtInherit(void) { XtErrorMsg("invalidProcedure","inheritanceProc",XtCXtToolkitError, "Unresolved inheritance operation", @@ -252,7 +252,7 @@ void _XtInherit() } -void XtToolkitInitialize() +void XtToolkitInitialize(void) { static Boolean initialized = False; @@ -275,14 +275,14 @@ void XtToolkitInitialize() /* Some apps rely on old (broken) XtAppPeekEvent behavior */ if(getenv("XTAPPPEEKEVENT_SKIPTIMER")) XtAppPeekEvent_SkipTimer = True; - else + else XtAppPeekEvent_SkipTimer = False; } -String _XtGetUserName(dest, len) - String dest; - int len; +String _XtGetUserName( + String dest, + int len) { #ifdef WIN32 String ptr = NULL; @@ -415,7 +415,7 @@ static void CombineUserDefaults( XrmCombineDatabase(XrmGetStringDatabase(dpy_defaults), pdb, False); } else { char filename[PATH_MAX]; - (void) GetRootDirName(filename, + (void) GetRootDirName(filename, PATH_MAX - strlen (slashDotXdefaults) - 1); (void) strcat(filename, slashDotXdefaults); (void)XrmCombineFileDatabase(filename, pdb, False); @@ -485,7 +485,7 @@ XtLanguageProc XtSetLanguageProc( app->langProcRec.closure = closure; UNLOCK_PROCESS; UNLOCK_APP(app); - } else { + } else { /* set langProcRec for all application contexts */ ProcessContext process; @@ -505,8 +505,8 @@ XtLanguageProc XtSetLanguageProc( return (old ? old : _XtDefaultLanguageProc); } -XrmDatabase XtScreenDatabase(screen) - Screen *screen; +XrmDatabase XtScreenDatabase( + Screen *screen) { int scrno; Bool doing_def; @@ -548,7 +548,7 @@ XrmDatabase XtScreenDatabase(screen) int len; char *slashDotXdefaultsDash = "/.Xdefaults-"; - (void) GetRootDirName(filename = filenamebuf, + (void) GetRootDirName(filename = filenamebuf, PATH_MAX - strlen (slashDotXdefaultsDash) - 1); (void) strcat(filename, slashDotXdefaultsDash); len = strlen(filename); @@ -623,9 +623,11 @@ static void _MergeOptionTables( Cardinal *num_dst) { XrmOptionDescRec *table, *endP; - register XrmOptionDescRec *opt1, *whereP, *dstP; - const register XrmOptionDescRec *opt2; - int i1, i2, dst_len, order; + register XrmOptionDescRec *opt1, *whereP, *dstP; + register const XrmOptionDescRec *opt2; + int i1; + Cardinal i2; + int dst_len, order; Boolean found; enum {Check, NotSorted, IsSorted} sort_order = Check; @@ -723,13 +725,15 @@ static Boolean _GetResource( return False; } -XrmDatabase _XtPreparseCommandLine(urlist, num_urs, argc, argv, applName, - displayName, language) - XrmOptionDescRec *urlist; - Cardinal num_urs; - int argc; - String *argv; - String *applName, *displayName, *language; /* return */ +XrmDatabase _XtPreparseCommandLine( + XrmOptionDescRec *urlist, + Cardinal num_urs, + int argc, + String *argv, + /* return */ + String *applName, + String *displayName, + String *language) { XrmDatabase db = 0; XrmOptionDescRec *options; @@ -773,7 +777,7 @@ XrmDatabase _XtPreparseCommandLine(urlist, num_urs, argc, argv, applName, return db; } - + static void GetLanguage( Display *dpy, XtPerDisplay pd) @@ -952,7 +956,7 @@ XtAppSetFallbackResources( UNLOCK_APP(app_context); } - + Widget XtOpenApplication(XtAppContext *app_context_return, _Xconst char *application_class, XrmOptionDescRec *options, Cardinal num_options, @@ -966,9 +970,9 @@ Widget XtOpenApplication(XtAppContext *app_context_return, Widget root; Arg args[3], *merged_args; Cardinal num = 0; - + XtToolkitInitialize(); /* cannot be moved into _XtAppInit */ - + dpy = _XtAppInit(&app_con, (String)application_class, options, num_options, argc_in_out, &argv_in_out, fallback_resources); @@ -982,7 +986,7 @@ Widget XtOpenApplication(XtAppContext *app_context_return, root = XtAppCreateShell(NULL, application_class, widget_class, dpy, merged_args, num); - + if (app_context_return) *app_context_return = app_con; @@ -992,7 +996,7 @@ Widget XtOpenApplication(XtAppContext *app_context_return, return root; } - + Widget XtAppInitialize( XtAppContext * app_context_return, @@ -1006,7 +1010,7 @@ XtAppInitialize( Cardinal num_args_in) { return XtOpenApplication(app_context_return, application_class, - options, num_options, + options, num_options, argc_in_out, argv_in_out, fallback_resources, applicationShellWidgetClass, args_in, num_args_in); @@ -1014,7 +1018,7 @@ XtAppInitialize( /*ARGSUSED*/ -Widget +Widget XtInitialize( _Xconst char* name, _Xconst char* classname, @@ -1032,6 +1036,6 @@ XtInitialize( LOCK_PROCESS; process->defaultAppContext = app_con; - UNLOCK_PROCESS; + UNLOCK_PROCESS; return root; } diff --git a/src/Intrinsic.c b/src/Intrinsic.c index a315ed1..263c546 100644 --- a/src/Intrinsic.c +++ b/src/Intrinsic.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -75,9 +75,9 @@ in this Software without prior written authorization from The Open Group. String XtCXtToolkitError = "XtToolkitError"; -Boolean XtIsSubclass(widget, widgetClass) - Widget widget; - WidgetClass widgetClass; +Boolean XtIsSubclass( + Widget widget, + WidgetClass widgetClass) { register WidgetClass w; Boolean retval = FALSE; @@ -152,16 +152,16 @@ XtPointer XtGetClassExtension( || ext->record_size < record_size)) { ext = (ObjectClassExtension) ext->next_extension; } - + UNLOCK_PROCESS; return (XtPointer) ext; } -static void ComputeWindowAttributes(widget,value_mask,values) - Widget widget; - XtValueMask *value_mask; - XSetWindowAttributes *values; +static void ComputeWindowAttributes( + Widget widget, + XtValueMask *value_mask, + XSetWindowAttributes *values) { XtExposeProc expose; @@ -193,8 +193,8 @@ static void ComputeWindowAttributes(widget,value_mask,values) } } /* ComputeWindowAttributes */ -static void CallChangeManaged(widget) - register Widget widget; +static void CallChangeManaged( + register Widget widget) { register Cardinal i; XtWidgetProc change_managed; @@ -203,7 +203,7 @@ static void CallChangeManaged(widget) register CompositePtr cpPtr; register CompositePartPtr clPtr; - + if (XtIsComposite (widget)) { cpPtr = (CompositePtr)&((CompositeWidget) widget)->composite; clPtr = (CompositePartPtr)&((CompositeWidgetClass) @@ -222,16 +222,16 @@ static void CallChangeManaged(widget) } if (change_managed != NULL && managed_children != 0) { - CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s changemanaged\n", - XtName(widget), + CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s changemanaged\n", + XtName(widget), widget->core.width, widget->core.height)); (*change_managed) (widget); } } /* CallChangeManaged */ -static void MapChildren(cwp) - CompositePart *cwp; +static void MapChildren( + CompositePart *cwp) { Cardinal i; WidgetList children; @@ -249,8 +249,8 @@ static void MapChildren(cwp) } /* MapChildren */ -static Boolean ShouldMapAllChildren(cwp) - CompositePart *cwp; +static Boolean ShouldMapAllChildren( + CompositePart *cwp) { Cardinal i; WidgetList children; @@ -260,7 +260,7 @@ static Boolean ShouldMapAllChildren(cwp) for (i = 0; i < cwp->num_children; i++) { child = children[i]; if (XtIsWidget(child)) { - if (XtIsRealized(child) && (! (child->core.managed + if (XtIsRealized(child) && (! (child->core.managed && child->core.mapped_when_managed))){ return False; } @@ -271,8 +271,8 @@ static Boolean ShouldMapAllChildren(cwp) } /* ShouldMapAllChildren */ -static void RealizeWidget(widget) - Widget widget; +static void RealizeWidget( + Widget widget) { XtValueMask value_mask; XSetWindowAttributes values; @@ -297,8 +297,8 @@ static void RealizeWidget(widget) "No realize class procedure defined", (String *)NULL, (Cardinal *)NULL); else { - CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s realize proc\n", - XtName(widget), + CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s realize proc\n", + XtName(widget), widget->core.width, widget->core.height)); (*realize) (widget, &value_mask, &values); } @@ -309,8 +309,8 @@ static void RealizeWidget(widget) call_data.type = XtHrealizeWidget; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } #ifndef NO_IDENTIFY_WINDOWS @@ -328,7 +328,7 @@ static void RealizeWidget(widget) XChangeProperty(display, window, XInternAtom(display, "_MIT_OBJ_CLASS", False), - XA_STRING, 8, PropModeReplace, (unsigned char *) s, + XA_STRING, 8, PropModeReplace, (unsigned char *) s, len_nm + len_cl + 2); XtFree(s); } @@ -368,8 +368,8 @@ static void RealizeWidget(widget) } } /* RealizeWidget */ -void XtRealizeWidget (widget) - Widget widget; +void XtRealizeWidget ( + Widget widget) { WIDGET_TO_APPCON(widget); @@ -384,8 +384,8 @@ void XtRealizeWidget (widget) } /* XtRealizeWidget */ -static void UnrealizeWidget(widget) - Widget widget; +static void UnrealizeWidget( + Widget widget) { CompositeWidget cw; Cardinal i; @@ -429,8 +429,8 @@ static void UnrealizeWidget(widget) } /* UnrealizeWidget */ -void XtUnrealizeWidget (widget) - Widget widget; +void XtUnrealizeWidget ( + Widget widget) { Window window; Widget hookobj; @@ -445,7 +445,7 @@ void XtUnrealizeWidget (widget) if (widget->core.managed && widget->core.parent != NULL) XtUnmanageChild(widget); UnrealizeWidget(widget); - if (window != None) + if (window != None) XDestroyWindow(XtDisplay(widget), window); hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { @@ -453,20 +453,20 @@ void XtUnrealizeWidget (widget) call_data.type = XtHunrealizeWidget; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtUnrealizeWidget */ -void XtCreateWindow(widget, window_class, visual, value_mask, attributes) - Widget widget; - unsigned int window_class; - Visual *visual; - XtValueMask value_mask; - XSetWindowAttributes *attributes; +void XtCreateWindow( + Widget widget, + unsigned int window_class, + Visual *visual, + XtValueMask value_mask, + XSetWindowAttributes *attributes) { XtAppContext app = XtWidgetToApplicationContext(widget); @@ -496,17 +496,22 @@ void XtCreateWindow(widget, window_class, visual, value_mask, attributes) /* ---------------- XtNameToWidget ----------------- */ -static Widget NameListToWidget(); - -typedef Widget (*NameMatchProc)(); - -static Widget MatchExactChildren(names, bindings, children, num, - in_depth, out_depth, found_depth) - XrmNameList names; - XrmBindingList bindings; - register WidgetList children; - register int num; - int in_depth, *out_depth, *found_depth; +static Widget NameListToWidget( + Widget root, + XrmNameList names, + XrmBindingList bindings, + int in_depth, int *out_depth, int *found_depth); + +typedef Widget (*NameMatchProc)(XrmNameList, + XrmBindingList, + WidgetList, Cardinal, int, int *, int *); + +static Widget MatchExactChildren( + XrmNameList names, + XrmBindingList bindings, + register WidgetList children, + register Cardinal num, + int in_depth, int *out_depth, int *found_depth) { register Cardinal i; register XrmName name = *names; @@ -524,13 +529,12 @@ static Widget MatchExactChildren(names, bindings, children, num, return result; } -static Widget MatchWildChildren(names, bindings, children, num, - in_depth, out_depth, found_depth) - XrmNameList names; - XrmBindingList bindings; - register WidgetList children; - register int num; - int in_depth, *out_depth, *found_depth; +static Widget MatchWildChildren( + XrmNameList names, + XrmBindingList bindings, + register WidgetList children, + register Cardinal num, + int in_depth, int *out_depth, int *found_depth) { register Cardinal i; Widget w, result = NULL; @@ -545,13 +549,12 @@ static Widget MatchWildChildren(names, bindings, children, num, return result; } -static Widget SearchChildren(root, names, bindings, matchproc, - in_depth, out_depth, found_depth) - Widget root; - XrmNameList names; - XrmBindingList bindings; - NameMatchProc matchproc; - int in_depth, *out_depth, *found_depth; +static Widget SearchChildren( + Widget root, + XrmNameList names, + XrmBindingList bindings, + NameMatchProc matchproc, + int in_depth, int *out_depth, int *found_depth) { Widget w1 = 0, w2; int d1, d2; @@ -568,12 +571,11 @@ static Widget SearchChildren(root, names, bindings, matchproc, return (d1 < d2 ? w1 : w2); } -static Widget NameListToWidget(root, names, bindings, - in_depth, out_depth, found_depth) - register Widget root; - XrmNameList names; - XrmBindingList bindings; - int in_depth, *out_depth, *found_depth; +static Widget NameListToWidget( + register Widget root, + XrmNameList names, + XrmBindingList bindings, + int in_depth, int *out_depth, int *found_depth) { Widget w1, w2; int d1, d2; @@ -645,8 +647,8 @@ Widget XtNameToWidget( /* Define user versions of intrinsics macros */ #undef XtDisplayOfObject -Display *XtDisplayOfObject(object) - Widget object; +Display *XtDisplayOfObject( + Widget object) { /* Attempts to LockApp() here will generate endless recursive loops */ if (XtIsSubclass(object, hookObjectClass)) @@ -655,16 +657,16 @@ Display *XtDisplayOfObject(object) } #undef XtDisplay -Display *XtDisplay(widget) - Widget widget; +Display *XtDisplay( + Widget widget) { /* Attempts to LockApp() here will generate endless recursive loops */ return DisplayOfScreen(widget->core.screen); } #undef XtScreenOfObject -Screen *XtScreenOfObject(object) - Widget object; +Screen *XtScreenOfObject( + Widget object) { /* Attempts to LockApp() here will generate endless recursive loops */ if (XtIsSubclass(object, hookObjectClass)) @@ -673,31 +675,31 @@ Screen *XtScreenOfObject(object) } #undef XtScreen -Screen *XtScreen(widget) - Widget widget; +Screen *XtScreen( + Widget widget) { /* Attempts to LockApp() here will generate endless recursive loops */ return widget->core.screen; } #undef XtWindowOfObject -Window XtWindowOfObject(object) - Widget object; +Window XtWindowOfObject( + Widget object) { return XtWindow(XtIsWidget(object) ? object : _XtWindowedAncestor(object)); } #undef XtWindow -Window XtWindow(widget) - Widget widget; +Window XtWindow( + Widget widget) { return widget->core.window; } #undef XtSuperclass -WidgetClass XtSuperclass(widget) - Widget widget; +WidgetClass XtSuperclass( + Widget widget) { WidgetClass retval; @@ -708,8 +710,8 @@ WidgetClass XtSuperclass(widget) } #undef XtClass -WidgetClass XtClass(widget) - Widget widget; +WidgetClass XtClass( + Widget widget) { WidgetClass retval; @@ -720,8 +722,8 @@ WidgetClass XtClass(widget) } #undef XtIsManaged -Boolean XtIsManaged(object) - Widget object; +Boolean XtIsManaged( + Widget object) { Boolean retval; WIDGET_TO_APPCON(object); @@ -736,8 +738,8 @@ Boolean XtIsManaged(object) } #undef XtIsRealized -Boolean XtIsRealized (object) - Widget object; +Boolean XtIsRealized ( + Widget object) { Boolean retval; WIDGET_TO_APPCON(object); @@ -749,8 +751,8 @@ Boolean XtIsRealized (object) } /* XtIsRealized */ #undef XtIsSensitive -Boolean XtIsSensitive(object) - Widget object; +Boolean XtIsSensitive( + Widget object) { Boolean retval; WIDGET_TO_APPCON(object); @@ -767,8 +769,8 @@ Boolean XtIsSensitive(object) /* * Internal routine; must be called only after XtIsWidget returns false */ -Widget _XtWindowedAncestor(object) - register Widget object; +Widget _XtWindowedAncestor( + register Widget object) { Widget obj = object; for (object = XtParent(object); object && !XtIsWidget(object);) @@ -786,24 +788,24 @@ Widget _XtWindowedAncestor(object) } #undef XtParent -Widget XtParent(widget) - Widget widget; +Widget XtParent( + Widget widget) { /* Attempts to LockApp() here will generate endless recursive loops */ return widget->core.parent; } #undef XtName -String XtName(object) - Widget object; +String XtName( + Widget object) { /* Attempts to LockApp() here will generate endless recursive loops */ return XrmQuarkToString(object->core.xrm_name); } -Boolean XtIsObject(object) - Widget object; +Boolean XtIsObject( + Widget object) { WidgetClass wc; String class_name; @@ -833,11 +835,11 @@ Boolean XtIsObject(object) } #if defined(WIN32) -static int access_file (path, pathbuf, len_pathbuf, pathret) - char* path; - char* pathbuf; - int len_pathbuf; - char** pathret; +static int access_file ( + char* path, + char* pathbuf, + int len_pathbuf, + char** pathret) { if (access (path, F_OK) == 0) { if (strlen (path) < len_pathbuf) @@ -852,11 +854,11 @@ static int access_file (path, pathbuf, len_pathbuf, pathret) return 0; } -static int AccessFile (path, pathbuf, len_pathbuf, pathret) - char* path; - char* pathbuf; - int len_pathbuf; - char** pathret; +static int AccessFile ( + char* path, + char* pathbuf, + int len_pathbuf, + char** pathret) { unsigned long drives; int i, len; @@ -885,7 +887,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret) return 1; } -#ifndef __UNIXOS2__ +#ifndef __UNIXOS2__ /* one last place to look */ drive = getenv ("HOMEDRIVE"); if (drive) { @@ -923,8 +925,8 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret) } #endif -static Boolean TestFile(path) - String path; +static Boolean TestFile( + String path) { #ifndef VMS int ret = 0; @@ -936,7 +938,7 @@ static Boolean TestFile(path) UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); if (AccessFile (path, buf, MAX_PATH, &bufp)) - path = bufp; + path = bufp; (void) SetErrorMode (olderror); #endif @@ -959,13 +961,13 @@ static Boolean TestFile(path) /* return of TRUE = resolved string fit, FALSE = didn't fit. Not null-terminated and not collapsed if it didn't fit */ -static Boolean Resolve(source, len, sub, num, buf, collapse) - register char *source; /* The source string */ - register int len; /* The length in bytes of *source */ - Substitution sub; /* Array of string values to substitute */ - Cardinal num; /* Number of substitution entries */ - char *buf; /* Where to put the resolved string; */ - char collapse; /* Character to collapse */ +static Boolean Resolve( + register _Xconst char *source, /* The source string */ + register int len, /* The length in bytes of *source */ + Substitution sub, /* Array of string values to substitute */ + Cardinal num, /* Number of substitution entries */ + char *buf, /* Where to put the resolved string; */ + char collapse) /* Character to collapse */ { register int bytesLeft = PATH_MAX; register char* bp = buf; @@ -1018,7 +1020,7 @@ static Boolean Resolve(source, len, sub, num, buf, collapse) PUT(*source) else { /* Match the character against the match array */ - register int j; + register Cardinal j; for (j = 0; j < num && sub[j].match != *source; j++) {} @@ -1130,16 +1132,16 @@ String XtFindFile( /* The implementation of this routine is operating system dependent */ /* Should match the code in Xlib _XlcMapOSLocaleName */ -static char *ExtractLocaleName(lang) - String lang; +static char *ExtractLocaleName( + String lang) { #if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(__osf__) || defined(AIXV3) || defined(ultrix) || defined(WIN32) || defined(__UNIXOS2__) || defined (linux) # ifdef hpux -/* - * We need to discriminated between HPUX 9 and HPUX 10. The equivalent - * code in Xlib in SetLocale.c does include locale.h via X11/Xlocale.h. - */ +/* + * We need to discriminated between HPUX 9 and HPUX 10. The equivalent + * code in Xlib in SetLocale.c does include locale.h via X11/Xlocale.h. + */ # include <locale.h> # ifndef _LastCategory /* HPUX 9 and earlier */ @@ -1198,7 +1200,7 @@ static char *ExtractLocaleName(lang) start = lang; # endif # ifdef STARTCHAR - if (start && (start = strchr (start, STARTCHAR))) + if (start && (start = strchr (start, STARTCHAR))) # elif defined (STARTSTR) if (start && (start = strstr (start,STARTSTR))) # endif @@ -1243,16 +1245,16 @@ static char *ExtractLocaleName(lang) return lang; } -static void FillInLangSubs(subs, pd) - Substitution subs; - XtPerDisplay pd; +static void FillInLangSubs( + Substitution subs, + XtPerDisplay pd) { int len; char *string, *p1, *p2, *p3; char **rest; char *ch; - if (pd->language == NULL || + if (pd->language == NULL || (pd->language != NULL && pd->language[0] == '\0')) { subs[0].substitution = subs[1].substitution = subs[2].substitution = subs[3].substitution = NULL; @@ -1261,7 +1263,7 @@ static void FillInLangSubs(subs, pd) string = ExtractLocaleName(pd->language); - if (string == NULL || + if (string == NULL || (string != NULL && string[0] == '\0')) { subs[0].substitution = subs[1].substitution = subs[2].substitution = subs[3].substitution = NULL; @@ -1332,7 +1334,7 @@ static SubstitutionRec defaultSubs[] = { {'S', NULL}, {'C', NULL}, {'L', NULL}, - {'l', NULL}, + {'l', NULL}, {'t', NULL}, {'c', NULL} }; @@ -1375,7 +1377,7 @@ String XtResolvePathname( #else path = ""; /* NULL would kill us later */ #endif /* VMS */ - } + } if (filename == NULL) { filename = XrmClassToString(pd->class); @@ -1476,7 +1478,7 @@ String XtResolvePathname( if (merged_substitutions[5].substitution != NULL) XtFree( (XtPointer)merged_substitutions[5].substitution ); - if (merged_substitutions != defaultSubs) + if (merged_substitutions != defaultSubs) DEALLOCATE_LOCAL(merged_substitutions); if (pathMallocd) @@ -1489,9 +1491,9 @@ String XtResolvePathname( } -Boolean XtCallAcceptFocus(widget, time) - Widget widget; - Time *time; +Boolean XtCallAcceptFocus( + Widget widget, + Time *time) { XtAcceptFocusProc ac; Boolean retval; @@ -1502,9 +1504,9 @@ Boolean XtCallAcceptFocus(widget, time) ac = XtClass(widget)->core_class.accept_focus; UNLOCK_PROCESS; - if (ac != NULL) + if (ac != NULL) retval = (*ac) (widget, time); - else + else retval = FALSE; UNLOCK_APP(app); return retval; @@ -1513,7 +1515,7 @@ Boolean XtCallAcceptFocus(widget, time) #ifdef XT_GEO_TATTLER /************************************************************************** GeoTattler: This is used to debug Geometry management in Xt. - + It uses a pseudo resource XtNgeotattler. E.G. if those lines are found in the resource database: @@ -1540,7 +1542,7 @@ typedef struct { Boolean geo_tattler ;} GeoDataRec ; static XtResource geo_resources[] = { { XtNgeoTattler, XtCGeoTattler, XtRBoolean, sizeof(Boolean), - XtOffsetOf(GeoDataRec, geo_tattler), + XtOffsetOf(GeoDataRec, geo_tattler), XtRImmediate, (XtPointer) False } }; @@ -1552,10 +1554,10 @@ static Boolean IsTattled (Widget widget) GeoDataRec geo_data ; XtGetSubresources(widget, (XtPointer)&geo_data, - (String)NULL, (String)NULL, - geo_resources, XtNumber(geo_resources), + (String)NULL, (String)NULL, + geo_resources, XtNumber(geo_resources), NULL, 0); - + return geo_data.geo_tattler; } /* IsTattled */ @@ -1569,7 +1571,7 @@ _XtGeoTab (int direction) /* +1 or -1 */ } -void +void _XtGeoTrace (Widget widget, ...) { va_list args; diff --git a/src/Keyboard.c b/src/Keyboard.c index 2f3db03..0d81e89 100644 --- a/src/Keyboard.c +++ b/src/Keyboard.c @@ -6,13 +6,13 @@ Copyright 1988 by Hewlett-Packard Company Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation, and that the names of -Hewlett-Packard, Digital, or Sun not be used in advertising or -publicity pertaining to distribution of the software without specific, +Permission to use, copy, modify, and distribute this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the names of +Hewlett-Packard, Digital, or Sun not be used in advertising or +publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING @@ -67,7 +67,6 @@ in this Software without prior written authorization from The Open Group. #include "EventI.h" #define _GetWindowedAncestor(w) (XtIsWidget(w) ? w : _XtWindowedAncestor(w)) -extern void _XtSendFocusEvent(); /* InActiveSubtree cache of the current focus source and its ancestors */ static Widget *pathTrace = NULL; @@ -79,18 +78,17 @@ static Widget *pseudoTrace = NULL; static int pseudoTraceDepth = 0; static int pseudoTraceMax = 0; -void _XtClearAncestorCache(widget) - Widget widget; +void _XtClearAncestorCache(Widget widget) { /* the caller must lock the process lock */ if (pathTraceDepth && pathTrace[0] == widget) pathTraceDepth = 0; } -static XtServerGrabPtr CheckServerGrabs(event, trace, traceDepth) - XEvent *event; - Widget *trace; - Cardinal traceDepth; +static XtServerGrabPtr CheckServerGrabs( + XEvent *event, + Widget *trace, + Cardinal traceDepth) { XtServerGrabPtr grab; Cardinal i; @@ -103,8 +101,7 @@ static XtServerGrabPtr CheckServerGrabs(event, trace, traceDepth) return (XtServerGrabPtr)0; } -static Boolean IsParent(a, b) - Widget a, b; +static Boolean IsParent(Widget a, Widget b) { for (b = XtParent(b); b; b = XtParent(b)) { if (b == a) return TRUE; @@ -115,11 +112,12 @@ static Boolean IsParent(a, b) #define RelRtn(lca, type) {*relTypeRtn = type; return lca;} -static Widget CommonAncestor(a, b, relTypeRtn) - register Widget a, b; - XtGeneology * relTypeRtn; +static Widget CommonAncestor( + register Widget a, + register Widget b, + XtGeneology * relTypeRtn) { - if (a == b) + if (a == b) { RelRtn(a, XtMySelf) } @@ -133,9 +131,9 @@ static Widget CommonAncestor(a, b, relTypeRtn) } else for (b = XtParent(b); - b && !XtIsShell(b); + b && !XtIsShell(b); b = XtParent(b)) - if (IsParent(b, a)) + if (IsParent(b, a)) { RelRtn(b, XtMyCousin) } @@ -143,21 +141,21 @@ static Widget CommonAncestor(a, b, relTypeRtn) } #undef RelRtn - - -static Widget _FindFocusWidget(widget, trace, traceDepth, activeCheck, isTarget) - Widget widget; - Widget *trace; - int traceDepth; - Boolean activeCheck; - Boolean *isTarget; + + +static Widget _FindFocusWidget( + Widget widget, + Widget *trace, + int traceDepth, + Boolean activeCheck, + Boolean *isTarget) { int src; Widget dst; XtPerWidgetInput pwi = NULL; - + /* For each ancestor, starting at the top, see if it's forwarded */ @@ -193,18 +191,17 @@ static Widget _FindFocusWidget(widget, trace, traceDepth, activeCheck, isTarget) } -static Widget FindFocusWidget(widget, pdi) - Widget widget; - XtPerDisplayInput pdi; +static Widget FindFocusWidget( + Widget widget, + XtPerDisplayInput pdi) { - if (pdi->focusWidget) + if (pdi->focusWidget) return pdi->focusWidget; else return _FindFocusWidget(widget, pdi->trace, pdi->traceDepth, FALSE, NULL); } -Widget XtGetKeyboardFocusWidget(widget) - Widget widget; +Widget XtGetKeyboardFocusWidget(Widget widget) { XtPerDisplayInput pdi; Widget retval; @@ -217,16 +214,16 @@ Widget XtGetKeyboardFocusWidget(widget) return retval; } -static Boolean IsOutside(e, w) - XKeyEvent *e; - Widget w; +static Boolean IsOutside( + XKeyEvent *e, + Widget w) { Position left, right, top, bottom; - + /* * if the pointer is outside the shell or inside * the window try to see if it would recieve the - * focus + * focus */ XtTranslateCoords(w, 0, 0, &left, &top); /* We need to take borders into consideration */ @@ -243,29 +240,26 @@ static Boolean IsOutside(e, w) return FALSE; } -static Widget FindKeyDestination(widget, event, - prevGrab, prevGrabType, - devGrab, devGrabType, - pdi) - Widget widget; - XKeyEvent *event; - XtServerGrabPtr prevGrab; - XtServerGrabType prevGrabType; - XtServerGrabPtr devGrab; - XtServerGrabType devGrabType; - XtPerDisplayInput pdi; +static Widget FindKeyDestination( + Widget widget, + XKeyEvent *event, + XtServerGrabPtr prevGrab, + XtServerGrabType prevGrabType, + XtServerGrabPtr devGrab, + XtServerGrabType devGrabType, + XtPerDisplayInput pdi) { - + Widget dspWidget; Widget focusWidget; LOCK_PROCESS; - dspWidget = - focusWidget = - pdi->focusWidget = + dspWidget = + focusWidget = + pdi->focusWidget = _GetWindowedAncestor(FindFocusWidget(widget, pdi)); - - + + /* * If a grab is active from a previous activation then dispatch * based on owner_events ala protocol but with focus being @@ -273,25 +267,25 @@ static Widget FindKeyDestination(widget, event, */ if (IsAnyGrab(prevGrabType)) { - if (prevGrab->ownerEvents) + if (prevGrab->ownerEvents) dspWidget = focusWidget; else dspWidget = prevGrab->widget; } - else + else { /* * If the focus widget is the event widget or a descendant * then we can avoid the rest of this. Else ugh... */ - if (focusWidget != widget) + if (focusWidget != widget) { XtGeneology ewRelFw; /* relationship of event widget to focusWidget */ Widget lca; lca = CommonAncestor(widget, focusWidget, &ewRelFw); - + /* * if the event widget is an ancestor of focus due to the pointer * and/or the grab being in an ancestor and it's a passive grab @@ -307,7 +301,7 @@ static Widget FindKeyDestination(widget, event, ) dspWidget = devGrab->widget; } - else + else { /* * if the grab widget is not an ancestor of the focus @@ -316,7 +310,7 @@ static Widget FindKeyDestination(widget, event, * through and if synch is set and the event widget * could turn it off we'll lock. check for it ? why not */ - if ((ewRelFw != XtMyAncestor) + if ((ewRelFw != XtMyAncestor) && (devGrabType == XtPassiveServerGrab) && (!IsAnyGrab(prevGrabType)) ) @@ -329,7 +323,7 @@ static Widget FindKeyDestination(widget, event, * if there isn't a grab with then check * for a logical grab that would have been activated * if the server was using Xt focus instead of server - * focus + * focus */ if ( (event->type != KeyPress) || @@ -340,7 +334,7 @@ static Widget FindKeyDestination(widget, event, { XtServerGrabPtr grab; - if (!pseudoTraceDepth || + if (!pseudoTraceDepth || !(focusWidget == pseudoTrace[0]) || !(lca == pseudoTrace[pseudoTraceDepth])) { @@ -349,8 +343,8 @@ static Widget FindKeyDestination(widget, event, * (non-inclusive)to focusWidget by * passing in lca as breakWidget */ - _XtFillAncestorList(&pseudoTrace, - &pseudoTraceMax, + _XtFillAncestorList(&pseudoTrace, + &pseudoTraceMax, &pseudoTraceDepth, focusWidget, lca); @@ -362,12 +356,12 @@ static Widget FindKeyDestination(widget, event, pseudoTraceDepth))) { XtDevice device = &pdi->keyboard; - + device->grabType = XtPseudoPassiveServerGrab; pdi->activatingKey = event->keycode; device->grab = *grab; - if (grab + if (grab ) dspWidget = grab->widget; else @@ -381,11 +375,11 @@ static Widget FindKeyDestination(widget, event, return dspWidget; } -Widget _XtProcessKeyboardEvent(event, widget, pdi) - XKeyEvent *event; - Widget widget; - XtPerDisplayInput pdi; -{ +Widget _XtProcessKeyboardEvent( + XKeyEvent *event, + Widget widget, + XtPerDisplayInput pdi) +{ XtDevice device = &pdi->keyboard; XtServerGrabPtr newGrab, devGrab = &device->grab; XtServerGrabRec prevGrabRec; @@ -400,7 +394,7 @@ Widget _XtProcessKeyboardEvent(event, widget, pdi) case KeyPress: { if (event->keycode != 0 && /* Xlib XIM composed input */ - !IsServerGrab(device->grabType) && + !IsServerGrab(device->grabType) && (newGrab = CheckServerGrabs((XEvent*)event, pdi->trace, pdi->traceDepth))) @@ -422,10 +416,10 @@ Widget _XtProcessKeyboardEvent(event, widget, pdi) } } break; - + case KeyRelease: { - if (IsEitherPassiveGrab(device->grabType) && + if (IsEitherPassiveGrab(device->grabType) && (event->keycode == pdi->activatingKey)) deactivateGrab = TRUE; } @@ -442,14 +436,13 @@ Widget _XtProcessKeyboardEvent(event, widget, pdi) pdi->activatingKey = 0; } return dspWidget; -} - -static Widget GetShell(widget) - Widget widget; +} + +static Widget GetShell(Widget widget) { Widget shell; - for (shell = widget; + for (shell = widget; shell && !XtIsShell(shell); shell = XtParent(shell)){} return shell; @@ -458,26 +451,25 @@ static Widget GetShell(widget) /* * Check that widget really has Xt focus due to it having recieved an - * event + * event */ typedef enum {NotActive = 0, IsActive, IsTarget} ActiveType; -static ActiveType InActiveSubtree(widget) - Widget widget; +static ActiveType InActiveSubtree(Widget widget) { Boolean isTarget; ActiveType retval; LOCK_PROCESS; if (!pathTraceDepth || widget != pathTrace[0]) { - _XtFillAncestorList(&pathTrace, - &pathTraceMax, + _XtFillAncestorList(&pathTrace, + &pathTraceMax, &pathTraceDepth, widget, NULL); } - if (widget == _FindFocusWidget(widget, + if (widget == _FindFocusWidget(widget, pathTrace, - pathTraceDepth, + pathTraceDepth, TRUE, &isTarget)) retval = (isTarget ? IsTarget : IsActive); @@ -491,11 +483,11 @@ static ActiveType InActiveSubtree(widget) /* ARGSUSED */ -void _XtHandleFocus(widget, client_data, event, cont) - Widget widget; - XtPointer client_data; /* child who wants focus */ - XEvent *event; - Boolean *cont; /* unused */ +void _XtHandleFocus( + Widget widget, + XtPointer client_data, /* child who wants focus */ + XEvent *event, + Boolean *cont) /* unused */ { XtPerDisplayInput pdi = _XtGetPerDisplayInput(XtDisplay(widget)); XtPerWidgetInput pwi = (XtPerWidgetInput)client_data; @@ -503,7 +495,7 @@ void _XtHandleFocus(widget, client_data, event, cont) XtGeneology newFocalPoint = pwi->focalPoint; switch( event->type ) { - + case KeyPress: case KeyRelease: /* @@ -514,14 +506,14 @@ void _XtHandleFocus(widget, client_data, event, cont) case EnterNotify: case LeaveNotify: - + /* * If operating in a focus driven model, then enter and * leave events do not affect the keyboard focus. */ if ((event->xcrossing.detail != NotifyInferior) && (event->xcrossing.focus)) - { + { switch (oldFocalPoint) { case XtMyAncestor: @@ -536,8 +528,8 @@ void _XtHandleFocus(widget, client_data, event, cont) break; case XtMyDescendant: break; - - } + + } } break; case FocusIn: @@ -574,7 +566,7 @@ void _XtHandleFocus(widget, client_data, event, cont) } break; } - + if (newFocalPoint != oldFocalPoint) { Boolean add; @@ -613,12 +605,13 @@ void _XtHandleFocus(widget, client_data, event, cont) } -static void AddFocusHandler(widget, descendant, pwi, psi, pdi, oldEventMask) - Widget widget, descendant; - XtPerWidgetInput pwi; - XtPerWidgetInput psi; - XtPerDisplayInput pdi; - EventMask oldEventMask; +static void AddFocusHandler( + Widget widget, + Widget descendant, + XtPerWidgetInput pwi, + XtPerWidgetInput psi, + XtPerDisplayInput pdi, + EventMask oldEventMask) { EventMask eventMask, targetEventMask; Widget target; @@ -640,12 +633,12 @@ static void AddFocusHandler(widget, descendant, pwi, psi, pdi, oldEventMask) oldEventMask |= FocusChangeMask | EnterWindowMask | LeaveWindowMask; if (oldEventMask != eventMask) - XtRemoveEventHandler(widget, (oldEventMask & ~eventMask), + XtRemoveEventHandler(widget, (oldEventMask & ~eventMask), False, _XtHandleFocus, (XtPointer)pwi); } if (oldEventMask != eventMask) - XtAddEventHandler(widget, eventMask, False, + XtAddEventHandler(widget, eventMask, False, _XtHandleFocus, (XtPointer)pwi); /* What follows is too much grief to go through if the @@ -707,11 +700,11 @@ static void AddFocusHandler(widget, descendant, pwi, psi, pdi, oldEventMask) /* ARGSUSED */ -static void QueryEventMask(widget, client_data, event, cont) - Widget widget; /* child who gets focus */ - XtPointer client_data; /* ancestor giving it */ - XEvent *event; - Boolean *cont; /* unused */ +static void QueryEventMask( + Widget widget, /* child who gets focus */ + XtPointer client_data, /* ancestor giving it */ + XEvent *event, + Boolean *cont) /* unused */ { /* widget was once the target of an XtSetKeyboardFocus but * was unrealized at the time. Make sure ancestor still wants @@ -736,17 +729,17 @@ static void QueryEventMask(widget, client_data, event, cont) /* ARGSUSED */ -static void FocusDestroyCallback(widget, closure, call_data) - Widget widget; - XtPointer closure; /* Widget */ - XtPointer call_data; +static void FocusDestroyCallback( + Widget widget, + XtPointer closure, /* Widget */ + XtPointer call_data) { XtSetKeyboardFocus((Widget)closure, None); } -void XtSetKeyboardFocus(widget, descendant) - Widget widget; - Widget descendant; +void XtSetKeyboardFocus( + Widget widget, + Widget descendant) { XtPerDisplayInput pdi; XtPerWidgetInput pwi; @@ -763,21 +756,21 @@ void XtSetKeyboardFocus(widget, descendant) target = descendant ? _GetWindowedAncestor(descendant) : NULL; oldTarget = oldDesc ? _GetWindowedAncestor(oldDesc) : NULL; - + if (descendant != oldDesc) { - + /* update the forward path */ pwi->focusKid = descendant; /* all the rest handles focus ins and focus outs and misc gunk */ - + if (oldDesc) { /* invalidate FindKeyDestination's ancestor list */ if (pseudoTraceDepth && oldTarget == pseudoTrace[0]) pseudoTraceDepth = 0; - XtRemoveCallback(oldDesc, XtNdestroyCallback, + XtRemoveCallback(oldDesc, XtNdestroyCallback, FocusDestroyCallback, (XtPointer)widget); if (!oldTarget->core.being_destroyed) { @@ -807,16 +800,16 @@ void XtSetKeyboardFocus(widget, descendant) * will continue to dynamically assign focus for this widget. */ if (!XtIsShell(widget) && !descendant) { - XtRemoveEventHandler(widget, XtAllEvents, True, + XtRemoveEventHandler(widget, XtAllEvents, True, _XtHandleFocus, (XtPointer)pwi); pwi->haveFocus = FALSE; } } - + if (descendant) { Widget shell = GetShell(widget); XtPerWidgetInput psi = _XtGetPerWidgetInput(shell, TRUE); - XtAddCallback (descendant, XtNdestroyCallback, + XtAddCallback (descendant, XtNdestroyCallback, FocusDestroyCallback, (XtPointer) widget); AddFocusHandler(widget, descendant, pwi, psi, pdi, @@ -846,8 +839,8 @@ void XtSetKeyboardFocus(widget, descendant) call_data.type = XtHsetKeyboardFocus; call_data.widget = widget; call_data.event_data = (XtPointer) descendant; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_PROCESS; diff --git a/src/Manage.c b/src/Manage.c index ece5ff5..65a1477 100644 --- a/src/Manage.c +++ b/src/Manage.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -112,7 +112,7 @@ static void UnmanageChildren( } else if (child->core.managed) { (*num_unique_children)++; - CALLGEOTAT(_XtGeoTrace(child,"Child \"%s\" is marked unmanaged\n", + CALLGEOTAT(_XtGeoTrace(child,"Child \"%s\" is marked unmanaged\n", XtName(child))); child->core.managed = FALSE; if (XtIsWidget(child) @@ -137,16 +137,16 @@ static void UnmanageChildren( 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", + "Call parent: \"%s\"[%d,%d]'s changemanaged proc\n", XtName((Widget)parent), parent->core.width,parent->core.height)); (*change_managed) (parent); } } /* UnmanageChildren */ -void XtUnmanageChildren (children, num_children) - WidgetList children; - Cardinal num_children; +void XtUnmanageChildren ( + WidgetList children, + Cardinal num_children) { Widget parent, hookobj; Cardinal ii; @@ -170,7 +170,7 @@ void XtUnmanageChildren (children, num_children) UNLOCK_APP(app); return; } - UnmanageChildren(children, num_children, parent, &ii, + UnmanageChildren(children, num_children, parent, &ii, (Boolean)True, XtNxtUnmanageChildren); hookobj = XtHooksOfDisplay(XtDisplayOfObject(children[0])); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { @@ -180,15 +180,15 @@ void XtUnmanageChildren (children, num_children) call_data.widget = parent; call_data.event_data = (XtPointer) children; call_data.num_event_data = num_children; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtUnmanageChildren */ -void XtUnmanageChild(child) - Widget child; +void XtUnmanageChild( + Widget child) { XtUnmanageChildren(&child, (Cardinal)1); } /* XtUnmanageChild */ @@ -260,7 +260,7 @@ static void ManageChildren( } 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", + "Child \"%s\"[%d,%d] is marked managed\n", XtName(child), child->core.width,child->core.height)); child->core.managed = TRUE; @@ -271,8 +271,8 @@ static void ManageChildren( /* 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), + "Call parent: \"%s\"[%d,%d]'s changemanaged\n", + XtName((Widget)parent), parent->core.width,parent->core.height)); (*change_managed) ((Widget)parent); } @@ -301,9 +301,9 @@ static void ManageChildren( if (unique_children != cache) XtFree((char *) unique_children); } /* ManageChildren */ -void XtManageChildren(children, num_children) - WidgetList children; - Cardinal num_children; +void XtManageChildren( + WidgetList children, + Cardinal num_children) { Widget parent, hookobj; #ifdef XTHREADS @@ -326,7 +326,7 @@ void XtManageChildren(children, num_children) UNLOCK_APP(app); return; } - ManageChildren(children, num_children, parent, (Boolean)False, + ManageChildren(children, num_children, parent, (Boolean)False, XtNxtManageChildren); hookobj = XtHooksOfDisplay(XtDisplayOfObject(children[0])); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { @@ -336,15 +336,15 @@ void XtManageChildren(children, num_children) call_data.widget = parent; call_data.event_data = (XtPointer) children; call_data.num_event_data = num_children; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); } /* XtManageChildren */ -void XtManageChild(child) - Widget child; +void XtManageChild( + Widget child) { XtManageChildren(&child, (Cardinal) 1); } /* XtManageChild */ @@ -371,8 +371,8 @@ void XtSetMappedWhenManaged( 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, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } @@ -454,7 +454,7 @@ void XtChangeManagedSet( call_out = True; } - UnmanageChildren(unmanage_children, num_unmanage, parent, + UnmanageChildren(unmanage_children, num_unmanage, parent, &some_unmanaged, call_out, XtNxtChangeManagedSet); hookobj = XtHooksOfDisplay(XtDisplay(parent)); @@ -463,12 +463,12 @@ void XtChangeManagedSet( call_data.widget = parent; call_data.event_data = (XtPointer) unmanage_children; call_data.num_event_data = num_unmanage; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer) &call_data); } - if (do_change_proc) + if (do_change_proc) (*do_change_proc)(parent, unmanage_children, &num_unmanage, manage_children, &num_manage, client_data); @@ -480,8 +480,8 @@ void XtChangeManagedSet( call_data.type = XtHmanageSet; call_data.event_data = (XtPointer) manage_children; call_data.num_event_data = num_manage; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer) &call_data); } UNLOCK_APP(app); diff --git a/src/NextEvent.c b/src/NextEvent.c index 277e52e..86f4204 100644 --- a/src/NextEvent.c +++ b/src/NextEvent.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -133,9 +133,9 @@ static SignalEventRec* freeSignalRecs; #endif #endif -static void AdjustHowLong (howlong, start_time) - unsigned long *howlong; - struct timeval *start_time; +static void AdjustHowLong ( + unsigned long *howlong, + struct timeval *start_time) { struct timeval new_time, time_spent, lstart_time; @@ -143,7 +143,7 @@ static void AdjustHowLong (howlong, start_time) X_GETTIMEOFDAY (&new_time); FIXUP_TIMEVAL(new_time); TIMEDELTA(time_spent, new_time, lstart_time); - if(*howlong <= (time_spent.tv_sec*1000+time_spent.tv_usec/1000)) + if(*howlong <= (unsigned long)(time_spent.tv_sec*1000+time_spent.tv_usec/1000)) *howlong = (unsigned long)0; /* Timed out */ else *howlong -= (time_spent.tv_sec*1000+time_spent.tv_usec/1000); @@ -171,10 +171,10 @@ static fd_set zero_fd; #define X_DONT_BLOCK 0 #endif -static void InitTimes (block, howlong, wt) - Boolean block; - unsigned long* howlong; - wait_times_ptr_t wt; +static void InitTimes ( + Boolean block, + unsigned long* howlong, + wait_times_ptr_t wt) { if (block) { X_GETTIMEOFDAY (&wt->cur_time); @@ -216,11 +216,11 @@ typedef struct { #endif } wait_fds_t, *wait_fds_ptr_t; -static void InitFds (app, ignoreEvents, ignoreInputs, wf) - XtAppContext app; - Boolean ignoreEvents; - Boolean ignoreInputs; - wait_fds_ptr_t wf; +static void InitFds ( + XtAppContext app, + Boolean ignoreEvents, + Boolean ignoreInputs, + wait_fds_ptr_t wf) { int ii; app->rebuild_fdlist = FALSE; @@ -275,7 +275,7 @@ static void InitFds (app, ignoreEvents, ignoreInputs, wf) XtStackAlloc (sizeof (struct pollfd) * wf->fdlistlen, wf->stack); } else { wf->fdlist = (struct pollfd*) - XtRealloc ((char*) wf->fdlist, + XtRealloc ((char*) wf->fdlist, sizeof (struct pollfd) * wf->fdlistlen); } @@ -308,12 +308,12 @@ static void InitFds (app, ignoreEvents, ignoreInputs, wf) #endif } -static void AdjustTimes (app, block, howlong, ignoreTimers, wt) - XtAppContext app; - Boolean block; - unsigned long* howlong; - Boolean ignoreTimers; - wait_times_ptr_t wt; +static void AdjustTimes ( + XtAppContext app, + Boolean block, + unsigned long* howlong, + Boolean ignoreTimers, + wait_times_ptr_t wt) { if (app->timerQueue != NULL && !ignoreTimers && block) { if (IS_AFTER (wt->cur_time, app->timerQueue->te_timer_value)) { @@ -323,9 +323,9 @@ static void AdjustTimes (app, block, howlong, ignoreTimers, wt) wt->wait_time_ptr = &wt->wait_time; else wt->wait_time_ptr = &wt->max_wait_time; - } else + } else wt->wait_time_ptr = &zero_time; - } + } #else wt->poll_wait = wt->wait_time.tv_sec * 1000 + wt->wait_time.tv_usec / 1000; else @@ -337,12 +337,12 @@ static void AdjustTimes (app, block, howlong, ignoreTimers, wt) } -static int IoWait (wt, wf) - wait_times_ptr_t wt; - wait_fds_ptr_t wf; +static int IoWait ( + wait_times_ptr_t wt, + wait_fds_ptr_t wf) { #ifndef USE_POLL - return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask, + return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask, wt->wait_time_ptr); #else return poll (wf->fdlist, wf->fdlistlen, wt->poll_wait); @@ -350,14 +350,14 @@ static int IoWait (wt, wf) } -static void FindInputs (app, wf, nfds, ignoreEvents, ignoreInputs, dpy_no, found_input) - XtAppContext app; - wait_fds_ptr_t wf; - int nfds; - Boolean ignoreEvents; - Boolean ignoreInputs; - int* dpy_no; - int* found_input; +static void FindInputs ( + XtAppContext app, + wait_fds_ptr_t wf, + int nfds, + Boolean ignoreEvents, + Boolean ignoreInputs, + int* dpy_no, + int* found_input) { XtInputMask condition; InputEvent *ep; @@ -497,7 +497,7 @@ ENDILOOP: ; #endif /* } */ } -/* +/* * Routine to block in the toolkit. This should be the only call to select. * * This routine returns when there is something to be done. @@ -507,7 +507,7 @@ ENDILOOP: ; * has not already been enqueued. * * - * _XtWaitForSomething( appContext, + * _XtWaitForSomething( appContext, * ignoreEvent, ignoreTimers, ignoreInputs, ignoreSignals, * block, drop_lock, howlong) * XtAppContext app; (Displays to check wait on) @@ -586,8 +586,8 @@ WaitLoop: if (block && app->block_hook_list) { BlockHook hook; - for (hook = app->block_hook_list; - hook != NULL; + for (hook = app->block_hook_list; + hook != NULL; hook = hook->next) (*hook->proc) (hook->closure); @@ -608,7 +608,7 @@ WaitLoop: #ifdef XTHREADS /* { */ if (drop_lock) { YIELD_APP_LOCK(app, &push_thread, &pushed_thread, &level); - nfds = IoWait (&wt, &wf); + nfds = IoWait (&wt, &wf); RESTORE_APP_LOCK(app, level, &pushed_thread); } else #endif /* } */ @@ -689,10 +689,10 @@ WaitLoop: } /* timed out or input available */ break; } - + if (nfds == 0) { /* Timed out */ - if (howlong) + if (howlong) *howlong = (unsigned long)0; #ifdef USE_POLL XtStackFree ((XtPointer) wf.fdlist, fdlist); @@ -709,8 +709,8 @@ WaitLoop: #endif return -1; } else - FindInputs (app, &wf, nfds, - ignoreEvents, ignoreInputs, + FindInputs (app, &wf, nfds, + ignoreEvents, ignoreInputs, &dpy_no, &found_input); if (dpy_no >= 0 || found_input) { @@ -735,18 +735,18 @@ WaitLoop: * Public Routines */ -XtIntervalId XtAddTimeOut(interval, proc, closure) - unsigned long interval; - XtTimerCallbackProc proc; - XtPointer closure; +XtIntervalId XtAddTimeOut( + unsigned long interval, + XtTimerCallbackProc proc, + XtPointer closure) { - return XtAppAddTimeOut(_XtDefaultAppContext(), - interval, proc, closure); + return XtAppAddTimeOut(_XtDefaultAppContext(), + interval, proc, closure); } -static void QueueTimerEvent(app, ptr) - XtAppContext app; - TimerEventRec *ptr; +static void QueueTimerEvent( + XtAppContext app, + TimerEventRec *ptr) { TimerEventRec *t,**tt; tt = &app->timerQueue; @@ -760,11 +760,11 @@ static void QueueTimerEvent(app, ptr) *tt = ptr; } -XtIntervalId XtAppAddTimeOut(app, interval, proc, closure) - XtAppContext app; - unsigned long interval; - XtTimerCallbackProc proc; - XtPointer closure; +XtIntervalId XtAppAddTimeOut( + XtAppContext app, + unsigned long interval, + XtTimerCallbackProc proc, + XtPointer closure) { TimerEventRec *tptr; struct timeval current_time; @@ -792,8 +792,8 @@ XtIntervalId XtAppAddTimeOut(app, interval, proc, closure) return( (XtIntervalId) tptr); } -void XtRemoveTimeOut(id) - XtIntervalId id; +void XtRemoveTimeOut( + XtIntervalId id) { TimerEventRec *t, *last, *tid = (TimerEventRec *) id; XtAppContext app = tid->app; @@ -819,17 +819,17 @@ void XtRemoveTimeOut(id) UNLOCK_APP(app); } -XtWorkProcId XtAddWorkProc(proc, closure) - XtWorkProc proc; - XtPointer closure; +XtWorkProcId XtAddWorkProc( + XtWorkProc proc, + XtPointer closure) { return XtAppAddWorkProc(_XtDefaultAppContext(), proc, closure); } -XtWorkProcId XtAppAddWorkProc(app, proc, closure) - XtAppContext app; - XtWorkProc proc; - XtPointer closure; +XtWorkProcId XtAppAddWorkProc( + XtAppContext app, + XtWorkProc proc, + XtPointer closure) { WorkProcRec *wptr; @@ -849,15 +849,15 @@ XtWorkProcId XtAppAddWorkProc(app, proc, closure) return (XtWorkProcId) wptr; } -void XtRemoveWorkProc(id) - XtWorkProcId id; +void XtRemoveWorkProc( + XtWorkProcId id) { WorkProcRec *wid= (WorkProcRec *) id, *w, *last; XtAppContext app = wid->app; LOCK_APP(app); /* find it */ - for(w = app->workQueue, last = NULL; + for(w = app->workQueue, last = NULL; w != NULL && w != wid; w = w->next) last = w; if (w == NULL) { @@ -874,17 +874,17 @@ void XtRemoveWorkProc(id) UNLOCK_APP(app); } -XtSignalId XtAddSignal(proc, closure) - XtSignalCallbackProc proc; - XtPointer closure; +XtSignalId XtAddSignal( + XtSignalCallbackProc proc, + XtPointer closure) { return XtAppAddSignal(_XtDefaultAppContext(), proc, closure); } -XtSignalId XtAppAddSignal(app, proc, closure) - XtAppContext app; - XtSignalCallbackProc proc; - XtPointer closure; +XtSignalId XtAppAddSignal( + XtAppContext app, + XtSignalCallbackProc proc, + XtPointer closure) { SignalEventRec *sptr; @@ -906,8 +906,8 @@ XtSignalId XtAppAddSignal(app, proc, closure) return (XtSignalId) sptr; } -void XtRemoveSignal(id) - XtSignalId id; +void XtRemoveSignal( + XtSignalId id) { SignalEventRec *sid = (SignalEventRec*) id, *s, *last = NULL; XtAppContext app = sid->app; @@ -930,8 +930,8 @@ void XtRemoveSignal(id) UNLOCK_APP(app); } -void XtNoticeSignal(id) - XtSignalId id; +void XtNoticeSignal( + XtSignalId id) { /* * It would be overkill to lock the app to set this flag. @@ -955,22 +955,22 @@ void XtNoticeSignal(id) sid->se_notice = TRUE; } -XtInputId XtAddInput( source, Condition, proc, closure) - int source; - XtPointer Condition; - XtInputCallbackProc proc; - XtPointer closure; +XtInputId XtAddInput( + int source, + XtPointer Condition, + XtInputCallbackProc proc, + XtPointer closure) { return XtAppAddInput(_XtDefaultAppContext(), source, Condition, proc, closure); } -XtInputId XtAppAddInput(app, source, Condition, proc, closure) - XtAppContext app; - int source; - XtPointer Condition; - XtInputCallbackProc proc; - XtPointer closure; +XtInputId XtAppAddInput( + XtAppContext app, + int source, + XtPointer Condition, + XtInputCallbackProc proc, + XtPointer closure) { InputEvent* sptr; XtInputMask condition = (XtInputMask) Condition; @@ -1017,8 +1017,8 @@ XtInputId XtAppAddInput(app, source, Condition, proc, closure) return((XtInputId)sptr); } -void XtRemoveInput( id ) - register XtInputId id; +void XtRemoveInput( + register XtInputId id) { register InputEvent *sptr, *lptr; XtAppContext app = ((InputEvent *)id)->app; @@ -1065,7 +1065,7 @@ void XtRemoveInput( id ) found = True; break; } - lptr = sptr; + lptr = sptr; } } @@ -1078,14 +1078,14 @@ void XtRemoveInput( id ) app->rebuild_fdlist = TRUE; } else XtAppWarningMsg(app, "invalidProcedure","inputHandler", - XtCXtToolkitError, + XtCXtToolkitError, "XtRemoveInput: Input handler not found", (String *)NULL, (Cardinal *)NULL); UNLOCK_APP(app); } -void _XtRemoveAllInputs(app) - XtAppContext app; +void _XtRemoveAllInputs( + XtAppContext app) { int i; for (i = 0; i < app->input_max; i++) { @@ -1101,8 +1101,8 @@ void _XtRemoveAllInputs(app) /* Do alternate input and timer callbacks if there are any */ -static void DoOtherSources(app) - XtAppContext app; +static void DoOtherSources( + XtAppContext app) { TimerEventRec *te_ptr; InputEvent *ie_ptr; @@ -1120,10 +1120,10 @@ static void DoOtherSources(app) if (app->input_count > 0) { /* Call _XtWaitForSomething to get input queued up */ (void) _XtWaitForSomething (app, - TRUE, TRUE, FALSE, TRUE, - FALSE, + TRUE, TRUE, FALSE, TRUE, + FALSE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *)NULL); DrainQueue(); @@ -1160,8 +1160,8 @@ static void DoOtherSources(app) /* If there are any work procs, call them. Return whether we did so */ -static Boolean CallWorkProc(app) - XtAppContext app; +static Boolean CallWorkProc( + XtAppContext app) { register WorkProcRec *w = app->workQueue; Boolean delete; @@ -1190,8 +1190,8 @@ static Boolean CallWorkProc(app) * return next event; */ -void XtNextEvent(event) - XEvent *event; +void XtNextEvent( + XEvent *event) { XtAppNextEvent(_XtDefaultAppContext(), event); } @@ -1215,9 +1215,9 @@ void _XtRefreshMapping( UNLOCK_PROCESS; } -void XtAppNextEvent(app, event) - XtAppContext app; - XEvent *event; +void XtAppNextEvent( + XtAppContext app, + XEvent *event) { int i, d; @@ -1244,9 +1244,9 @@ void XtAppNextEvent(app, event) d = _XtWaitForSomething (app, FALSE, FALSE, FALSE, FALSE, - TRUE, + TRUE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *) NULL); @@ -1261,20 +1261,20 @@ void XtAppNextEvent(app, event) _XtRefreshMapping(event, False); UNLOCK_APP(app); return; - } + } } /* for */ } - -void XtProcessEvent(mask) - XtInputMask mask; + +void XtProcessEvent( + XtInputMask mask) { XtAppProcessEvent(_XtDefaultAppContext(), mask); } -void XtAppProcessEvent(app, mask) - XtAppContext app; - XtInputMask mask; +void XtAppProcessEvent( + XtAppContext app, + XtInputMask mask) { int i, d; XEvent event; @@ -1318,15 +1318,15 @@ void XtAppProcessEvent(app, mask) return; } } - + if (mask & XtIMAlternateInput) { if (app->input_count > 0 && app->outstandingQueue == NULL) { /* Call _XtWaitForSomething to get input queued up */ - (void) _XtWaitForSomething (app, - TRUE, TRUE, FALSE, TRUE, - FALSE, + (void) _XtWaitForSomething (app, + TRUE, TRUE, FALSE, TRUE, + FALSE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *)NULL); } @@ -1339,7 +1339,7 @@ void XtAppProcessEvent(app, mask) return; } } - + if (mask & XtIMXEvent) { for (i = 1; i <= app->count; i++) { d = (i + app->last) % app->count; @@ -1362,9 +1362,9 @@ void XtAppProcessEvent(app, mask) (mask & XtIMTimer ? FALSE : TRUE), (mask & XtIMAlternateInput ? FALSE : TRUE), (mask & XtIMSignal ? FALSE : TRUE), - TRUE, + TRUE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *) NULL); @@ -1381,18 +1381,18 @@ void XtAppProcessEvent(app, mask) XtDispatchEvent(&event); UNLOCK_APP(app); return; - } - + } + } } -Boolean XtPending() +Boolean XtPending(void) { return (XtAppPending(_XtDefaultAppContext()) != 0); } -XtInputMask XtAppPending(app) - XtAppContext app; +XtInputMask XtAppPending( + XtAppContext app) { struct timeval cur_time; int d; @@ -1431,7 +1431,7 @@ XtInputMask XtAppPending(app) /* * Check for pending alternate input */ - if (app->timerQueue != NULL) { /* check timeout queue */ + if (app->timerQueue != NULL) { /* check timeout queue */ X_GETTIMEOFDAY (&cur_time); FIXUP_TIMEVAL(cur_time); if ((IS_AT_OR_AFTER(app->timerQueue->te_timer_value, cur_time)) && @@ -1445,12 +1445,12 @@ XtInputMask XtAppPending(app) /* This won't cause a wait, but will enqueue any input */ if(_XtWaitForSomething (app, - FALSE, TRUE, FALSE, TRUE, - FALSE, + FALSE, TRUE, FALSE, TRUE, + FALSE, #ifdef XTHREADS - TRUE, + TRUE, #endif - (unsigned long *) NULL) != -1) + (unsigned long *) NULL) != -1) ret |= XtIMXEvent; if (app->outstandingQueue != NULL) ret |= XtIMAlternateInput; } @@ -1460,8 +1460,8 @@ XtInputMask XtAppPending(app) /* Peek at alternate input and timer callbacks if there are any */ -static Boolean PeekOtherSources(app) - XtAppContext app; +static Boolean PeekOtherSources( + XtAppContext app) { struct timeval cur_time; @@ -1479,10 +1479,10 @@ static Boolean PeekOtherSources(app) if (app->input_count > 0) { /* Call _XtWaitForSomething to get input queued up */ (void) _XtWaitForSomething (app, - TRUE, TRUE, FALSE, TRUE, - FALSE, + TRUE, TRUE, FALSE, TRUE, + FALSE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *)NULL); if (app->outstandingQueue != NULL) return TRUE; @@ -1498,17 +1498,17 @@ static Boolean PeekOtherSources(app) return FALSE; } -Boolean XtPeekEvent(event) - XEvent *event; +Boolean XtPeekEvent( + XEvent *event) { return XtAppPeekEvent(_XtDefaultAppContext(), event); } Boolean XtAppPeekEvent_SkipTimer; -Boolean XtAppPeekEvent(app, event) - XtAppContext app; - XEvent *event; +Boolean XtAppPeekEvent( + XtAppContext app, + XEvent *event) { int i, d; Boolean foundCall = FALSE; @@ -1525,7 +1525,7 @@ Boolean XtAppPeekEvent(app, event) if (XEventsQueued(app->list[d], QueuedAfterFlush)) goto GotEvent; } - + if (foundCall) { event->xany.type = 0; event->xany.display = NULL; @@ -1537,12 +1537,12 @@ Boolean XtAppPeekEvent(app, event) while (1) { d = _XtWaitForSomething (app, FALSE, FALSE, FALSE, FALSE, - TRUE, + TRUE, #ifdef XTHREADS - TRUE, + TRUE, #endif (unsigned long *) NULL); - + if (d != -1) { /* event */ GotEvent: XPeekEvent(app->list[d], event); @@ -1589,7 +1589,7 @@ Boolean XtAppPeekEvent(app, event) * spec is vague here; we'll assume signals also return FALSE, * of course to determine whether a signal is pending requires * walking the signalQueue looking for se_notice flags which - * this code doesn't do. + * this code doesn't do. */ #if 0 if (app->signalQueue != NULL) { /* signal */ @@ -1599,10 +1599,10 @@ Boolean XtAppPeekEvent(app, event) UNLOCK_APP(app); return FALSE; } - else + else #endif { /* input */ - event->xany.type = 0; + event->xany.type = 0; event->xany.display = NULL; event->xany.window = 0; UNLOCK_APP(app); @@ -1610,4 +1610,4 @@ Boolean XtAppPeekEvent(app, event) } } } /* end while */ -} +} diff --git a/src/Object.c b/src/Object.c index b680b2c..c048060 100644 --- a/src/Object.c +++ b/src/Object.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -70,9 +70,9 @@ static XtResource resources[] = { XtRCallback, (XtPointer)NULL} }; -static void ObjectClassPartInitialize(); -static Boolean ObjectSetValues(); -static void ObjectDestroy(); +static void ObjectClassPartInitialize(WidgetClass); +static Boolean ObjectSetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void ObjectDestroy(Widget); externaldef(objectclassrec) ObjectClassRec objectClassRec = { { @@ -83,7 +83,7 @@ externaldef(objectclassrec) ObjectClassRec objectClassRec = { /* class_part_initialize*/ ObjectClassPartInitialize, /* class_inited */ FALSE, /* initialize */ NULL, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* pad */ NULL, /* pad */ NULL, /* pad */ 0, @@ -98,9 +98,9 @@ externaldef(objectclassrec) ObjectClassRec objectClassRec = { /* pad */ NULL, /* pad */ NULL, /* set_values */ ObjectSetValues, - /* set_values_hook */ NULL, + /* set_values_hook */ NULL, /* pad */ NULL, - /* get_values_hook */ NULL, + /* get_values_hook */ NULL, /* pad */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -119,8 +119,8 @@ externaldef(objectClass) WidgetClass objectClass */ -static void ConstructCallbackOffsets(widgetClass) - WidgetClass widgetClass; +static void ConstructCallbackOffsets( + WidgetClass widgetClass) { static XrmQuark QCallback = NULLQUARK; register int i; @@ -145,7 +145,7 @@ static void ConstructCallbackOffsets(widgetClass) ((ObjectClass) objectClass->object_class.superclass)-> object_class.callback_private; tableSize = (int)(long) superTable[0]; - } else { + } else { superTable = (CallbackTable) NULL; tableSize = 0; } @@ -155,7 +155,7 @@ static void ConstructCallbackOffsets(widgetClass) for (i = objectClass->object_class.num_resources; --i >= 0; resourceList++) if (resourceList->xrm_type == QCallback) tableSize++; - + /* * Allocate and load the table. Make sure that the new callback * offsets occur in the table ahead of the superclass callback @@ -163,7 +163,7 @@ static void ConstructCallbackOffsets(widgetClass) */ newTable = (CallbackTable) __XtMalloc(sizeof(XrmResource *) * (tableSize + 1)); - + newTable[0] = (XrmResource *)(long) tableSize; if (superTable) @@ -179,12 +179,12 @@ static void ConstructCallbackOffsets(widgetClass) for (tableSize = (int)(long) *superTable++; --tableSize >= 0; superTable++) newTable[i++] = *superTable; - + objectClass->object_class.callback_private = (XtPointer) newTable; } -static void InheritObjectExtensionMethods(widget_class) - WidgetClass widget_class; +static void InheritObjectExtensionMethods( + WidgetClass widget_class) { ObjectClass oc = (ObjectClass) widget_class; ObjectClassExtension ext, super_ext = NULL; @@ -192,14 +192,14 @@ static void InheritObjectExtensionMethods(widget_class) ext = (ObjectClassExtension) XtGetClassExtension(widget_class, XtOffsetOf(ObjectClassRec, object_class.extension), - NULLQUARK, XtObjectExtensionVersion, + NULLQUARK, XtObjectExtensionVersion, sizeof(ObjectClassExtensionRec)); if (oc->object_class.superclass) super_ext = (ObjectClassExtension) XtGetClassExtension(oc->object_class.superclass, XtOffsetOf(ObjectClassRec, object_class.extension), - NULLQUARK, XtObjectExtensionVersion, + NULLQUARK, XtObjectExtensionVersion, sizeof(ObjectClassExtensionRec)); LOCK_PROCESS; if (ext) { @@ -209,7 +209,7 @@ static void InheritObjectExtensionMethods(widget_class) ext->deallocate = (super_ext ? super_ext->deallocate : NULL); } else if (super_ext) { /* Be careful to inherit only what is appropriate */ - ext = (ObjectClassExtension) + ext = (ObjectClassExtension) __XtCalloc(1, sizeof(ObjectClassExtensionRec)); ext->next_extension = oc->object_class.extension; ext->record_type = NULLQUARK; @@ -222,8 +222,8 @@ static void InheritObjectExtensionMethods(widget_class) UNLOCK_PROCESS; } -static void ObjectClassPartInitialize(wc) - register WidgetClass wc; +static void ObjectClassPartInitialize( + register WidgetClass wc) { ObjectClass oc = (ObjectClass)wc; @@ -241,10 +241,12 @@ static void ObjectClassPartInitialize(wc) /*ARGSUSED*/ -static Boolean ObjectSetValues(old, request, widget, args, num_args) - Widget old, request, widget; - ArgList args; - Cardinal *num_args; +static Boolean ObjectSetValues( + Widget old, + Widget request, + Widget widget, + ArgList args, + Cardinal * num_args) { register CallbackTable offsets; register int i; @@ -271,8 +273,8 @@ static Boolean ObjectSetValues(old, request, widget, args, num_args) } -static void ObjectDestroy (widget) - register Widget widget; +static void ObjectDestroy ( + register Widget widget) { register CallbackTable offsets; register int i; @@ -290,5 +292,3 @@ static void ObjectDestroy (widget) } UNLOCK_PROCESS; } /* ObjectDestroy */ - - diff --git a/src/PassivGrab.c b/src/PassivGrab.c index 8484c8a..86398cb 100644 --- a/src/PassivGrab.c +++ b/src/PassivGrab.c @@ -6,13 +6,13 @@ Copyright 1988 by Hewlett-Packard Company Copyright 1987, 1988, 1989,1990 by Digital Equipment Corporation, Maynard, Massachusetts Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation, and that the names of -Hewlett-Packard, Digital, or Sun not be used in advertising or -publicity pertaining to distribution of the software without specific, +Permission to use, copy, modify, and distribute this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the names of +Hewlett-Packard, Digital, or Sun not be used in advertising or +publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING @@ -87,9 +87,9 @@ in this Software without prior written authorization from The Open Group. * with the detail. */ -static void DeleteDetailFromMask(ppDetailMask, detail) - Mask **ppDetailMask; - unsigned short detail; +static void DeleteDetailFromMask( + Mask **ppDetailMask, + unsigned short detail) { Mask *pDetailMask = *ppDetailMask; @@ -108,20 +108,20 @@ static void DeleteDetailFromMask(ppDetailMask, detail) * Make an exact copy of the specified detail mask. */ -static Mask *CopyDetailMask(pOriginalDetailMask) - Mask *pOriginalDetailMask; +static Mask *CopyDetailMask( + Mask *pOriginalDetailMask) { Mask *pTempMask; int i; - + if (!pOriginalDetailMask) return NULL; - + pTempMask = (Mask *)__XtMalloc(sizeof(Mask) * MasksPerDetailMask); - + for ( i = 0; i < MasksPerDetailMask; i++) pTempMask[i]= pOriginalDetailMask[i]; - + return pTempMask; } @@ -131,21 +131,20 @@ static Mask *CopyDetailMask(pOriginalDetailMask) * specified parameters. */ -static XtServerGrabPtr CreateGrab(widget, ownerEvents, modifiers, - keybut, pointer_mode, keyboard_mode, - event_mask, confine_to, cursor, need_ext) - Widget widget; - Boolean ownerEvents; - Modifiers modifiers; - KeyCode keybut; - int pointer_mode, keyboard_mode; - Mask event_mask; - Window confine_to; - Cursor cursor; - Boolean need_ext; +static XtServerGrabPtr CreateGrab( + Widget widget, + Boolean ownerEvents, + Modifiers modifiers, + KeyCode keybut, + int pointer_mode, + int keyboard_mode, + Mask event_mask, + Window confine_to, + Cursor cursor, + Boolean need_ext) { XtServerGrabPtr grab; - + if (confine_to || cursor) need_ext = True; grab = (XtServerGrabPtr)__XtMalloc(sizeof(XtServerGrabRec) + @@ -176,8 +175,8 @@ static XtServerGrabPtr CreateGrab(widget, ownerEvents, modifiers, * Free up the space occupied by a grab entry. */ -static void FreeGrab(pGrab) - XtServerGrabPtr pGrab; +static void FreeGrab( + XtServerGrabPtr pGrab) { if (pGrab->hasExt) { XtServerGrabExtPtr ext = GRABEXT(pGrab); @@ -199,22 +198,23 @@ typedef struct _DetailRec { * is contained in the mask of the first, then TRUE is returned. */ -static Bool IsInGrabMask(firstDetail, secondDetail, exception) - register DetailPtr firstDetail, secondDetail; - unsigned short exception; +static Bool IsInGrabMask( + register DetailPtr firstDetail, + register DetailPtr secondDetail, + unsigned short exception) { if (firstDetail->exact == exception) { if (!firstDetail->pMask) return TRUE; - + /* (at present) never called with two non-null pMasks */ if (secondDetail->exact == exception) return FALSE; - + if (GETBIT(firstDetail->pMask, secondDetail->exact)) return TRUE; } - + return FALSE; } @@ -224,15 +224,17 @@ static Bool IsInGrabMask(firstDetail, secondDetail, exception) * exactly, then TRUE is returned. */ -static Bool IdenticalExactDetails(firstExact, secondExact, exception) - unsigned short firstExact, secondExact, exception; +static Bool IdenticalExactDetails( + unsigned short firstExact, + unsigned short secondExact, + unsigned short exception) { if ((firstExact == exception) || (secondExact == exception)) return FALSE; - + if (firstExact == secondExact) return TRUE; - + return FALSE; } @@ -244,17 +246,18 @@ static Bool IdenticalExactDetails(firstExact, secondExact, exception) * TRUE is returned. */ -static Bool DetailSupersedesSecond(firstDetail, secondDetail, exception) - register DetailPtr firstDetail, secondDetail; - unsigned short exception; +static Bool DetailSupersedesSecond( + register DetailPtr firstDetail, + register DetailPtr secondDetail, + unsigned short exception) { if (IsInGrabMask(firstDetail, secondDetail, exception)) return TRUE; - + if (IdenticalExactDetails(firstDetail->exact, secondDetail->exact, exception)) return TRUE; - + return FALSE; } @@ -264,8 +267,9 @@ static Bool DetailSupersedesSecond(firstDetail, secondDetail, exception) * 'encompasses' the second grab entry, then TRUE is returned. */ -static Bool GrabSupersedesSecond(pFirstGrab, pSecondGrab) - register XtServerGrabPtr pFirstGrab, pSecondGrab; +static Bool GrabSupersedesSecond( + register XtServerGrabPtr pFirstGrab, + register XtServerGrabPtr pSecondGrab) { DetailRec first, second; @@ -281,7 +285,7 @@ static Bool GrabSupersedesSecond(pFirstGrab, pSecondGrab) second.pMask = NULL; if (!DetailSupersedesSecond(&first, &second, (unsigned short)AnyModifier)) return FALSE; - + first.exact = pFirstGrab->keybut; if (pFirstGrab->hasExt) first.pMask = GRABEXT(pFirstGrab)->pKeyButMask; @@ -294,7 +298,7 @@ static Bool GrabSupersedesSecond(pFirstGrab, pSecondGrab) second.pMask = NULL; if (DetailSupersedesSecond(&first, &second, (unsigned short)AnyKey)) return TRUE; - + return FALSE; } @@ -311,20 +315,21 @@ static Bool GrabSupersedesSecond(pFirstGrab, pSecondGrab) * for the other entry encompasses the first. */ -static Bool GrabMatchesSecond(pFirstGrab, pSecondGrab) - register XtServerGrabPtr pFirstGrab, pSecondGrab; +static Bool GrabMatchesSecond( + register XtServerGrabPtr pFirstGrab, + register XtServerGrabPtr pSecondGrab) { DetailRec firstD, firstM, secondD, secondM; if (pDisplay(pFirstGrab) != pDisplay(pSecondGrab)) return FALSE; - + if (GrabSupersedesSecond(pFirstGrab, pSecondGrab)) return TRUE; - + if (GrabSupersedesSecond(pSecondGrab, pFirstGrab)) return TRUE; - + firstD.exact = pFirstGrab->keybut; firstM.exact = pFirstGrab->modifiers; if (pFirstGrab->hasExt) { @@ -347,11 +352,11 @@ static Bool GrabMatchesSecond(pFirstGrab, pSecondGrab) if (DetailSupersedesSecond(&secondD, &firstD, (unsigned short)AnyKey) && DetailSupersedesSecond(&firstM, &secondM, (unsigned short)AnyModifier)) return TRUE; - - if (DetailSupersedesSecond(&firstD, &secondD, (unsigned short)AnyKey) && + + if (DetailSupersedesSecond(&firstD, &secondD, (unsigned short)AnyKey) && DetailSupersedesSecond(&secondM, &firstM, (unsigned short)AnyModifier)) return TRUE; - + return FALSE; } @@ -362,17 +367,17 @@ static Bool GrabMatchesSecond(pFirstGrab, pSecondGrab) * may result in multiple entries being modified/deleted. */ -static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab) - XtServerGrabPtr *passiveListPtr; - XtServerGrabPtr pMinuendGrab; +static void DeleteServerGrabFromList( + XtServerGrabPtr *passiveListPtr, + XtServerGrabPtr pMinuendGrab) { register XtServerGrabPtr *next; register XtServerGrabPtr grab; register XtServerGrabExtPtr ext; - + for (next = passiveListPtr; (grab = *next); ) { - if (GrabMatchesSecond(grab, pMinuendGrab) && + if (GrabMatchesSecond(grab, pMinuendGrab) && (pDisplay(grab) == pDisplay(pMinuendGrab))) { if (GrabSupersedesSecond(pMinuendGrab, grab)) @@ -430,7 +435,7 @@ static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab) * mask set to AnyModifier & ~(deleted modifiers). */ XtServerGrabPtr pNewGrab; - + DeleteDetailFromMask(&ext->pKeyButMask, pMinuendGrab->keybut); pNewGrab = CreateGrab(grab->widget, (Boolean)grab->ownerEvents, @@ -441,10 +446,10 @@ static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab) (Mask)0, (Window)0, (Cursor)0, True); GRABEXT(pNewGrab)->pModifiersMask = CopyDetailMask(ext->pModifiersMask); - + DeleteDetailFromMask(&GRABEXT(pNewGrab)->pModifiersMask, pMinuendGrab->modifiers); - + pNewGrab->next = *passiveListPtr; *passiveListPtr = pNewGrab; } else if (pMinuendGrab->keybut == AnyKey) { @@ -461,8 +466,8 @@ static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab) /* * The list entry has keycode AnyKey and modifier * AnyModifier; the entry being deleted has a - * specific keycode and modifier AnyModifier. So - * we simply need to mask off the specified + * specific keycode and modifier AnyModifier. So + * we simply need to mask off the specified * keycode. */ DeleteDetailFromMask(&ext->pKeyButMask, pMinuendGrab->keybut); @@ -472,18 +477,18 @@ static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab) } } -static void DestroyPassiveList(passiveListPtr) - XtServerGrabPtr *passiveListPtr; +static void DestroyPassiveList( + XtServerGrabPtr *passiveListPtr) { XtServerGrabPtr next, grab; for (next = *passiveListPtr; next; ) { grab = next; next = grab->next; - + /* not necessary to explicitly ungrab key or button; * window is being destroyed so server will take care of it. - */ + */ FreeGrab(grab); } @@ -494,10 +499,10 @@ static void DestroyPassiveList(passiveListPtr) * This function is called at widget destroy time to clean up */ /*ARGSUSED*/ -void _XtDestroyServerGrabs(w, closure, call_data) - Widget w; - XtPointer closure; - XtPointer call_data; /* unused */ +void _XtDestroyServerGrabs( + Widget w, + XtPointer closure, + XtPointer call_data) /* unused */ { XtPerWidgetInput pwi = (XtPerWidgetInput)closure; XtPerDisplayInput pdi; @@ -506,14 +511,14 @@ void _XtDestroyServerGrabs(w, closure, call_data) pdi = _XtGetPerDisplayInput(XtDisplay(w)); _XtClearAncestorCache(w); UNLOCK_PROCESS; - + /* Remove the active grab, if necessary */ - if ((pdi->keyboard.grabType != XtNoServerGrab) && + if ((pdi->keyboard.grabType != XtNoServerGrab) && (pdi->keyboard.grab.widget == w)) { pdi->keyboard.grabType = XtNoServerGrab; pdi->activatingKey = (KeyCode)0; } - if ((pdi->pointer.grabType != XtNoServerGrab) && + if ((pdi->pointer.grabType != XtNoServerGrab) && (pdi->pointer.grab.widget == w)) pdi->pointer.grabType = XtNoServerGrab; @@ -554,7 +559,7 @@ XtServerGrabPtr _XtCheckServerGrabsOnWidget ( */ if (!*passiveListPtr) return (XtServerGrabPtr)NULL; - + /* Take only the lower thirteen bits as modifier state. The X Keyboard * Extension may be representing keyboard group state in two upper bits. */ @@ -576,11 +581,11 @@ XtServerGrabPtr _XtCheckServerGrabsOnWidget ( */ /*ARGSUSED*/ -static void ActiveHandler (widget, pdi, event, cont) - Widget widget; - XtPointer pdi; - XEvent *event; - Boolean *cont; +static void ActiveHandler ( + Widget widget, + XtPointer pdi, + XEvent *event, + Boolean *cont) { /* nothing */ } @@ -589,19 +594,19 @@ static void ActiveHandler (widget, pdi, event, cont) /* * MakeGrab */ -static void MakeGrab(grab, passiveListPtr, isKeyboard, pdi, pwi) - XtServerGrabPtr grab; - XtServerGrabPtr *passiveListPtr; - Boolean isKeyboard; - XtPerDisplayInput pdi; - XtPerWidgetInput pwi; +static void MakeGrab( + XtServerGrabPtr grab, + XtServerGrabPtr *passiveListPtr, + Boolean isKeyboard, + XtPerDisplayInput pdi, + XtPerWidgetInput pwi) { if (!isKeyboard && !pwi->active_handler_added) { XtAddEventHandler(grab->widget, ButtonReleaseMask, FALSE, ActiveHandler, (XtPointer)pdi); pwi->active_handler_added = TRUE; } - + if (isKeyboard) { XGrabKey(pDisplay(grab), grab->keybut, grab->modifiers, @@ -630,10 +635,10 @@ static void MakeGrab(grab, passiveListPtr, isKeyboard, pdi, pwi) *passiveListPtr = grab; } -static void MakeGrabs(passiveListPtr, isKeyboard, pdi) - XtServerGrabPtr *passiveListPtr; - Boolean isKeyboard; - XtPerDisplayInput pdi; +static void MakeGrabs( + XtServerGrabPtr *passiveListPtr, + Boolean isKeyboard, + XtPerDisplayInput pdi) { XtServerGrabPtr next = *passiveListPtr; XtServerGrabPtr grab; @@ -653,8 +658,8 @@ static void MakeGrabs(passiveListPtr, isKeyboard, pdi) MakeGrab(grab, passiveListPtr, isKeyboard, pdi, pwi); } UNLOCK_PROCESS; -} - +} + /* * This function is the event handler attached to the associated widget * when grabs need to be added, but the widget is not yet realized. When @@ -663,11 +668,11 @@ static void MakeGrabs(passiveListPtr, isKeyboard, pdi) */ /*ARGSUSED*/ -static void RealizeHandler (widget, closure, event, cont) - Widget widget; - XtPointer closure; - XEvent *event; /* unused */ - Boolean *cont; /* unused */ +static void RealizeHandler ( + Widget widget, + XtPointer closure, + XEvent *event, /* unused */ + Boolean *cont) /* unused */ { XtPerWidgetInput pwi = (XtPerWidgetInput)closure; XtPerDisplayInput pdi; @@ -677,7 +682,7 @@ static void RealizeHandler (widget, closure, event, cont) UNLOCK_PROCESS; MakeGrabs(&pwi->keyList, KEYBOARD, pdi); MakeGrabs(&pwi->ptrList, POINTER, pdi); - + XtRemoveEventHandler(widget, XtAllEvents, True, RealizeHandler, (XtPointer)pwi); pwi->realize_handler_added = FALSE; @@ -694,26 +699,24 @@ static void RealizeHandler (widget, closure, event, cont) */ static -void GrabKeyOrButton (widget, keyOrButton, modifiers, owner_events, - pointer_mode, keyboard_mode, event_mask, - confine_to, cursor, isKeyboard) - Widget widget; - KeyCode keyOrButton; - Modifiers modifiers; - Boolean owner_events; - int pointer_mode; - int keyboard_mode; - Mask event_mask; - Window confine_to; - Cursor cursor; - Boolean isKeyboard; +void GrabKeyOrButton ( + Widget widget, + KeyCode keyOrButton, + Modifiers modifiers, + Boolean owner_events, + int pointer_mode, + int keyboard_mode, + Mask event_mask, + Window confine_to, + Cursor cursor, + Boolean isKeyboard) { XtServerGrabPtr *passiveListPtr; XtServerGrabPtr newGrab; XtPerWidgetInput pwi; XtPerDisplayInput pdi; - - + + XtCheckSubclass(widget, coreWidgetClass, "in XtGrabKey or XtGrabButton"); LOCK_PROCESS; pwi = _XtGetPerWidgetInput(widget, TRUE); @@ -723,8 +726,8 @@ void GrabKeyOrButton (widget, keyOrButton, modifiers, owner_events, passiveListPtr = &pwi->ptrList; pdi = _XtGetPerDisplayInput(XtDisplay(widget)); UNLOCK_PROCESS; - newGrab = CreateGrab(widget, owner_events, modifiers, - keyOrButton, pointer_mode, keyboard_mode, + newGrab = CreateGrab(widget, owner_events, modifiers, + keyOrButton, pointer_mode, keyboard_mode, event_mask, confine_to, cursor, False); /* * if the widget is realized then process the entry into the grab @@ -742,7 +745,7 @@ void GrabKeyOrButton (widget, keyOrButton, modifiers, owner_events, (XtPointer)pwi); pwi->realize_handler_added = TRUE; } - + while (*passiveListPtr) passiveListPtr = &(*passiveListPtr)->next; *passiveListPtr = newGrab; @@ -751,24 +754,24 @@ void GrabKeyOrButton (widget, keyOrButton, modifiers, owner_events, static -void UngrabKeyOrButton (widget, keyOrButton, modifiers, isKeyboard) - Widget widget; - int keyOrButton; - Modifiers modifiers; - Boolean isKeyboard; +void UngrabKeyOrButton ( + Widget widget, + int keyOrButton, + Modifiers modifiers, + Boolean isKeyboard) { XtServerGrabRec tempGrab; XtPerWidgetInput pwi; - + XtCheckSubclass(widget, coreWidgetClass, "in XtUngrabKey or XtUngrabButton"); - + /* Build a temporary grab list entry */ tempGrab.widget = widget; tempGrab.modifiers = modifiers; tempGrab.keybut = keyOrButton; tempGrab.hasExt = False; - + LOCK_PROCESS; pwi = _XtGetPerWidgetInput(widget, FALSE); UNLOCK_PROCESS; @@ -792,11 +795,11 @@ void UngrabKeyOrButton (widget, keyOrButton, modifiers, isKeyboard) widget->core.window); else XUngrabButton(widget->core.screen->display, - keyOrButton, (unsigned int)modifiers, + keyOrButton, (unsigned int)modifiers, widget->core.window); } - + /* Delete all entries which are encompassed by the specified grab. */ DeleteServerGrabFromList(isKeyboard ? &pwi->keyList : &pwi->ptrList, &tempGrab); @@ -814,7 +817,7 @@ void XtGrabKey ( LOCK_APP(app); GrabKeyOrButton(widget, (KeyCode)keycode, modifiers, owner_events, - pointer_mode, keyboard_mode, + pointer_mode, keyboard_mode, (Mask)0, (Window)None, (Cursor)None, KEYBOARD); UNLOCK_APP(app); } @@ -834,7 +837,7 @@ void XtGrabButton( LOCK_APP(app); GrabKeyOrButton(widget, (KeyCode)button, modifiers, owner_events, - pointer_mode, keyboard_mode, + pointer_mode, keyboard_mode, (Mask)event_mask, confine_to, cursor, POINTER); UNLOCK_APP(app); } @@ -857,10 +860,10 @@ void XtUngrabKey ( UNLOCK_APP(app); } -void XtUngrabButton (widget, button, modifiers) - Widget widget; - unsigned int button; - Modifiers modifiers; +void XtUngrabButton ( + Widget widget, + unsigned int button, + Modifiers modifiers) { WIDGET_TO_APPCON(widget); @@ -872,22 +875,20 @@ void XtUngrabButton (widget, button, modifiers) /* * Active grab of Device. clear any client side grabs so we dont lock */ -static int GrabDevice (widget, owner_events, - pointer_mode, keyboard_mode, - event_mask, confine_to, cursor, time, isKeyboard) - Widget widget; - Boolean owner_events; - int pointer_mode; - int keyboard_mode; - Mask event_mask; - Window confine_to; - Cursor cursor; - Time time; - Boolean isKeyboard; +static int GrabDevice ( + Widget widget, + Boolean owner_events, + int pointer_mode, + int keyboard_mode, + Mask event_mask, + Window confine_to, + Cursor cursor, + Time time, + Boolean isKeyboard) { XtPerDisplayInput pdi; int returnVal; - + XtCheckSubclass(widget, coreWidgetClass, "in XtGrabKeyboard or XtGrabPointer"); if (!XtIsRealized(widget)) @@ -896,18 +897,18 @@ static int GrabDevice (widget, owner_events, pdi = _XtGetPerDisplayInput(XtDisplay(widget)); UNLOCK_PROCESS; if (!isKeyboard) - returnVal = XGrabPointer(XtDisplay(widget), XtWindow(widget), + returnVal = XGrabPointer(XtDisplay(widget), XtWindow(widget), owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time); else - returnVal = XGrabKeyboard(XtDisplay(widget), XtWindow(widget), - owner_events, pointer_mode, + returnVal = XGrabKeyboard(XtDisplay(widget), XtWindow(widget), + owner_events, pointer_mode, keyboard_mode, time); if (returnVal == GrabSuccess) { XtDevice device; - + device = isKeyboard ? &pdi->keyboard : &pdi->pointer; /* fill in the server grab rec */ device->grab.widget = widget; @@ -923,10 +924,10 @@ static int GrabDevice (widget, owner_events, return returnVal; } -static void UngrabDevice(widget, time, isKeyboard) - Widget widget; - Time time; - Boolean isKeyboard; +static void UngrabDevice( + Widget widget, + Time time, + Boolean isKeyboard) { XtPerDisplayInput pdi; XtDevice device; @@ -937,7 +938,7 @@ static void UngrabDevice(widget, time, isKeyboard) device = isKeyboard ? &pdi->keyboard : &pdi->pointer; XtCheckSubclass(widget, coreWidgetClass, "in XtUngrabKeyboard or XtUngrabPointer"); - + if (device->grabType != XtNoServerGrab) { if (device->grabType != XtPseudoPassiveServerGrab @@ -968,7 +969,7 @@ int XtGrabKeyboard ( LOCK_APP(app); retval = GrabDevice (widget, owner_events, - pointer_mode, keyboard_mode, + pointer_mode, keyboard_mode, (Mask)0, (Window)None, (Cursor)None, time, KEYBOARD); UNLOCK_APP(app); return retval; @@ -979,9 +980,9 @@ int XtGrabKeyboard ( * Ungrab the keyboard */ -void XtUngrabKeyboard(widget, time) - Widget widget; - Time time; +void XtUngrabKeyboard( + Widget widget, + Time time) { WIDGET_TO_APPCON(widget); @@ -1011,8 +1012,8 @@ int XtGrabPointer ( LOCK_APP(app); retval = GrabDevice (widget, owner_events, - pointer_mode, keyboard_mode, - (Mask)event_mask, confine_to, + pointer_mode, keyboard_mode, + (Mask)event_mask, confine_to, cursor, time, POINTER); UNLOCK_APP(app); return retval; @@ -1023,9 +1024,9 @@ int XtGrabPointer ( * Ungrab the pointer */ -void XtUngrabPointer(widget, time) - Widget widget; - Time time; +void XtUngrabPointer( + Widget widget, + Time time) { WIDGET_TO_APPCON(widget); @@ -1035,8 +1036,8 @@ void XtUngrabPointer(widget, time) } -void _XtRegisterPassiveGrabs (widget) - Widget widget; +void _XtRegisterPassiveGrabs ( + Widget widget) { XtPerWidgetInput pwi = _XtGetPerWidgetInput (widget, FALSE); @@ -1047,4 +1048,3 @@ void _XtRegisterPassiveGrabs (widget) pwi->realize_handler_added = TRUE; } } - diff --git a/src/Pointer.c b/src/Pointer.c index 1c981d2..1922951 100644 --- a/src/Pointer.c +++ b/src/Pointer.c @@ -5,13 +5,13 @@ Copyright 1988 by Hewlett-Packard Company Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation, and that the names of -Hewlett-Packard or Digital not be used in advertising or -publicity pertaining to distribution of the software without specific, +Permission to use, copy, modify, and distribute this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the names of +Hewlett-Packard or Digital not be used in advertising or +publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING @@ -56,11 +56,11 @@ in this Software without prior written authorization from The Open Group. #define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask) -Widget _XtProcessPointerEvent(event, widget, pdi) - XButtonEvent *event; - Widget widget; - XtPerDisplayInput pdi; -{ +Widget _XtProcessPointerEvent( + XButtonEvent *event, + Widget widget, + XtPerDisplayInput pdi) +{ XtDevice device = &pdi->pointer; XtServerGrabPtr newGrab = NULL, devGrab = &device->grab; Widget dspWidget = NULL; @@ -74,10 +74,10 @@ Widget _XtProcessPointerEvent(event, widget, pdi) { Cardinal i; - for (i = pdi->traceDepth; - i > 0 && !newGrab; + for (i = pdi->traceDepth; + i > 0 && !newGrab; i--) - newGrab = _XtCheckServerGrabsOnWidget((XEvent*)event, + newGrab = _XtCheckServerGrabsOnWidget((XEvent*)event, pdi->trace[i-1], POINTER); } @@ -89,22 +89,22 @@ Widget _XtProcessPointerEvent(event, widget, pdi) } } break; - + case ButtonRelease: { - if ((device->grabType == XtPassiveServerGrab) && + if ((device->grabType == XtPassiveServerGrab) && !(event->state & ~(Button1Mask << (event->button - 1)) & AllButtonsMask)) deactivateGrab = TRUE; } break; } - + if (IsServerGrab(device->grabType) && !(devGrab)->ownerEvents) dspWidget = (devGrab)->widget; else dspWidget = widget; - + if (deactivateGrab) device->grabType = XtNoServerGrab; diff --git a/src/Popup.c b/src/Popup.c index 055175b..d7bd94f 100644 --- a/src/Popup.c +++ b/src/Popup.c @@ -29,13 +29,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -105,7 +105,7 @@ void XtPopup (Widget widget, XtGrabKind grab_kind) (String *)NULL, (Cardinal *)NULL); grab_kind = XtGrabNone; } - + _XtPopup(widget, grab_kind, FALSE); hookobj = XtHooksOfDisplay(XtDisplay(widget)); @@ -115,14 +115,14 @@ void XtPopup (Widget widget, XtGrabKind grab_kind) call_data.type = XtHpopup; call_data.widget = widget; call_data.event_data = (XtPointer)grab_kind; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } } /* XtPopup */ -void XtPopupSpringLoaded (widget) - Widget widget; +void XtPopupSpringLoaded ( + Widget widget) { Widget hookobj; @@ -134,14 +134,14 @@ void XtPopupSpringLoaded (widget) call_data.type = XtHpopupSpringLoaded; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } } -void XtPopdown(widget) - Widget widget; +void XtPopdown( + Widget widget) { /* Unmap a shell widget if it is mapped, and remove from grab list */ Widget hookobj; @@ -174,17 +174,17 @@ void XtPopdown(widget) call_data.type = XtHpopdown; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } } /* XtPopdown */ /* ARGSUSED */ -void XtCallbackPopdown(widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +void XtCallbackPopdown( + Widget widget, + XtPointer closure, + XtPointer call_data) { register XtPopdownID id = (XtPopdownID) closure; @@ -193,6 +193,3 @@ void XtCallbackPopdown(widget, closure, call_data) XtSetSensitive(id->enable_widget, TRUE); } } /* XtCallbackPopdown */ - - - diff --git a/src/PopupCB.c b/src/PopupCB.c index 25ea17d..eca2352 100644 --- a/src/PopupCB.c +++ b/src/PopupCB.c @@ -50,20 +50,20 @@ SOFTWARE. #include "IntrinsicI.h" /* ARGSUSED */ -void XtCallbackNone(widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +void XtCallbackNone( + Widget widget, + XtPointer closure, + XtPointer call_data) { XtSetSensitive(widget, FALSE); _XtPopup((Widget) closure, XtGrabNone, FALSE); } /* XtCallbackNone */ /* ARGSUSED */ -void XtCallbackNonexclusive(widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +void XtCallbackNonexclusive( + Widget widget, + XtPointer closure, + XtPointer call_data) { XtSetSensitive(widget, FALSE); @@ -71,10 +71,10 @@ void XtCallbackNonexclusive(widget, closure, call_data) } /* XtCallbackNonexclusive */ /* ARGSUSED */ -void XtCallbackExclusive(widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +void XtCallbackExclusive( + Widget widget, + XtPointer closure, + XtPointer call_data) { XtSetSensitive(widget, FALSE); _XtPopup((Widget) closure, XtGrabExclusive, FALSE); diff --git a/src/RectObj.c b/src/RectObj.c index 1bb13a2..df313d0 100644 --- a/src/RectObj.c +++ b/src/RectObj.c @@ -29,13 +29,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -59,7 +59,7 @@ SOFTWARE. * ******************************************************************/ -static void XtCopyAncestorSensitive(); +static void XtCopyAncestorSensitive(Widget, int, XrmValue *); static XtResource resources[] = { @@ -82,8 +82,8 @@ static XtResource resources[] = { (XtPointer)True} }; -static void RectClassPartInitialize(); -static void RectSetValuesAlmost(); +static void RectClassPartInitialize(WidgetClass); +static void RectSetValuesAlmost(Widget, Widget, XtWidgetGeometry *, XtWidgetGeometry *); externaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = { { @@ -94,7 +94,7 @@ externaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = { /* class_part_initialize*/ RectClassPartInitialize, /* class_inited */ FALSE, /* initialize */ NULL, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ NULL, /* actions */ NULL, /* num_actions */ 0, @@ -109,9 +109,9 @@ externaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = { /* resize */ NULL, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ RectSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ RectSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, @@ -126,10 +126,10 @@ externaldef(rectObjClass) WidgetClass rectObjClass = (WidgetClass)&rectObjClassRec; /*ARGSUSED*/ -static void XtCopyAncestorSensitive(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +static void XtCopyAncestorSensitive( + Widget widget, + int offset, + XrmValue *value) { static Boolean sensitive; Widget parent = widget->core.parent; @@ -144,8 +144,8 @@ static void XtCopyAncestorSensitive(widget, offset, value) */ -static void RectClassPartInitialize(wc) - register WidgetClass wc; +static void RectClassPartInitialize( + register WidgetClass wc) { register RectObjClass roc = (RectObjClass)wc; register RectObjClass super = ((RectObjClass)roc->rect_class.superclass); @@ -172,7 +172,7 @@ static void RectClassPartInitialize(wc) } } -/* +/* * Why there isn't an Initialize Method: * * Initialization of the RectObj non-Resource field is done by the @@ -181,11 +181,11 @@ static void RectClassPartInitialize(wc) */ /*ARGSUSED*/ -static void RectSetValuesAlmost(old, new, request, reply) - Widget old; - Widget new; - XtWidgetGeometry *request; - XtWidgetGeometry *reply; +static void RectSetValuesAlmost( + Widget old, + Widget new, + XtWidgetGeometry *request, + XtWidgetGeometry *reply) { *request = *reply; } diff --git a/src/ResConfig.c b/src/ResConfig.c index 59aa204..7182e64 100644 --- a/src/ResConfig.c +++ b/src/ResConfig.c @@ -41,9 +41,9 @@ all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +THE IBM CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the IBM Corporation shall @@ -67,9 +67,9 @@ Corporation. #define MAX_BUFFER 512 -static void _search_child(); -static void _set_and_search(); -static int _locate_children(); +static void _search_child(Widget, char *, char *, char *, char *, char, char *); +static void _set_and_search(Widget, char *, char *, char *, char *, char , char *); +static int _locate_children(Widget, Widget **); #if defined(sun) && !defined(SVR4) # define Strtoul(a,b,c) (unsigned long)strtol(a,b,c) @@ -81,7 +81,7 @@ static int _locate_children(); /* * NAME: _set_resource_values * - * FUNCTION: + * FUNCTION: * This function sets the value on the widget. It must first determine * if the last part is a valid resource for that widget. (eg. * labelString is a valid resource for label but not for bulletin board) @@ -103,11 +103,11 @@ static int _locate_children(); * ERRORS: none */ static void -_set_resource_values (w, resource, value, last_part) - Widget w; - char *resource; - char *value; - char *last_part; +_set_resource_values ( + Widget w, + char *resource, + char *value, + char *last_part) { XrmDatabase db = NULL; char *resource_name = NULL; @@ -119,18 +119,18 @@ _set_resource_values (w, resource, value, last_part) char *temp; XtResourceList resources_return = NULL; Cardinal num_resources_return = 0; - int res_index; + Cardinal res_index; Boolean found_resource = False; Display *dpy; XrmDatabase tmp_db; - + if (!XtIsWidget (w)) dpy = XtDisplay (w->core.parent); else dpy = XtDisplay (w); tmp_db = XtDatabase(dpy); - /* + /* * get a list of all the valid resources for this widget */ XtGetResourceList (w->core.widget_class, @@ -156,7 +156,7 @@ _set_resource_values (w, resource, value, last_part) * then exit this function */ if (!found_resource - || !resources_return[res_index].resource_name + || !resources_return[res_index].resource_name || !resources_return[res_index].resource_class) { XtFree ((char *) resources_return); return; @@ -169,12 +169,12 @@ _set_resource_values (w, resource, value, last_part) * .App.XmPushButton.Foreground */ while (cur != NULL) { - /* + /* * create resource name string */ if (resource_name) { temp = XtMalloc (sizeof(char) * - (2 + strlen(cur->core.name) + (2 + strlen(cur->core.name) + strlen(resource_name))); sprintf (temp, ".%s%s", cur->core.name, resource_name); XtFree (resource_name); @@ -188,23 +188,23 @@ _set_resource_values (w, resource, value, last_part) } resource_name = temp; - /* + /* * create resource class string */ if ((XtIsTopLevelShell (cur)) && (XtParent (cur) == NULL)) { - ApplicationShellWidget top = + ApplicationShellWidget top = (ApplicationShellWidget) (cur); if (resource_class) { temp = XtMalloc (sizeof(char) * (2 + strlen(top->application.class) + strlen(resource_class))); - sprintf (temp, ".%s%s", + sprintf (temp, ".%s%s", top->application.class, resource_class); } else { temp = XtMalloc (sizeof(char) * (2 + strlen(top->application.class))); - sprintf (temp, ".%s", + sprintf (temp, ".%s", top->application.class); } } else { @@ -213,7 +213,7 @@ _set_resource_values (w, resource, value, last_part) (2 + strlen( cur->core.widget_class->core_class.class_name) + strlen(resource_class))); - sprintf (temp, ".%s%s", + sprintf (temp, ".%s%s", cur->core.widget_class->core_class.class_name, resource_class); } else { @@ -225,7 +225,7 @@ _set_resource_values (w, resource, value, last_part) } } if (resource_class != NULL) - XtFree (resource_class); + XtFree (resource_class); resource_class = temp; cur = XtParent(cur); @@ -258,26 +258,26 @@ _set_resource_values (w, resource, value, last_part) fprintf (stderr, "resource_class = %s\n", resource_class); #endif - /* + /* * put the resource and its value in a resource database and * then query it back out again using the specific name and - * class resource strings that were built above. This is + * class resource strings that were built above. This is * necessary to maintain a precedence similar to the .Xdefaults * file */ XrmPutStringResource (&db, resource, value); XrmMergeDatabases (db, &tmp_db); - XrmGetResource (tmp_db, resource_name, resource_class, + XrmGetResource (tmp_db, resource_name, resource_class, &return_type, &return_value); - if (return_type) + if (return_type) resource_value = XtNewString (return_value.addr); else resource_value = XtNewString (value); #ifdef DEBUG - fprintf (stderr, + fprintf (stderr, "Apply:\n\twidget = %s\n\tlast_part = %s\n\tvalue = %s\n", - (w->core.name == NULL) ? "NULL" : w->core.name, + (w->core.name == NULL) ? "NULL" : w->core.name, resources_return[res_index].resource_name, resource_value); #endif @@ -286,14 +286,14 @@ _set_resource_values (w, resource, value, last_part) * type String the the same type as the resource (last_part). * Then set the value. */ - XtVaSetValues (w, + XtVaSetValues (w, XtVaTypedArg, resources_return[res_index].resource_name, - XtRString, resource_value, + XtRString, resource_value, strlen (resource_value) + 1, NULL); XtFree ((char *) resources_return); - XtFree (resource_name); + XtFree (resource_name); XtFree (resource_class); XtFree (resource_value); } @@ -301,7 +301,7 @@ _set_resource_values (w, resource, value, last_part) /* * NAME: _apply_values_to_children * - * FUNCTION: + * FUNCTION: * Once the resource string matches the value must be applied to * all children if applicable. (eg. App*Form.background must apply * background to all children of the Form widget) @@ -311,7 +311,7 @@ _set_resource_values (w, resource, value, last_part) * remainder the part of the resource string left over * resource the resource string to be matched * value the value to be set - * last_token the last * or . before the final resoruce part + * last_token the last * or . before the final resoruce part * last_part the last resource part (e.g. *background) * * RETURN VALUES: void @@ -319,13 +319,13 @@ _set_resource_values (w, resource, value, last_part) * ERRORS: none */ static void -_apply_values_to_children (w, remainder, resource, value, last_token, last_part) - Widget w; - char *remainder; - char *resource; - char *value; - char last_token; - char *last_part; +_apply_values_to_children ( + Widget w, + char *remainder, + char *resource, + char *value, + char last_token, + char *last_part) { int i; int num_children; @@ -340,19 +340,19 @@ _apply_values_to_children (w, remainder, resource, value, last_token, last_part) #ifdef DEBUG if (XtIsWidget (children[i]) && XtIsWidget (w)) - fprintf (stderr, "searching child %s of parent %s\n", + fprintf (stderr, "searching child %s of parent %s\n", children[i]->core.name, w->core.name); else fprintf (stderr,"searching child (NULL) of parent %s\n", w->core.name); - if (!XtIsWidget (children[i])) + if (!XtIsWidget (children[i])) fprintf (stderr, "children[%d] is NOT a widget\n", i); if (!XtIsWidget (w)) fprintf (stderr, "w is NOT a widget\n"); #endif _set_resource_values (children[i], resource, value, last_part); - _apply_values_to_children (children[i], remainder, + _apply_values_to_children (children[i], remainder, resource, value, last_token, last_part); } @@ -362,8 +362,8 @@ _apply_values_to_children (w, remainder, resource, value, last_token, last_part) /* * NAME: _search_child * - * FUNCTION: - * descends through each child of the tree + * FUNCTION: + * descends through each child of the tree * * PARAMETERS: * w the widget whose children are to be searched @@ -371,7 +371,7 @@ _apply_values_to_children (w, remainder, resource, value, last_token, last_part) * remainder the remaining part of the resource string * resource the resource string to be matched * value the value to be applied - * last_token the last * or . before the final resoruce part + * last_token the last * or . before the final resoruce part * last_part the last resource part (e.g. *background) * * RETURN VALUES: none @@ -379,14 +379,14 @@ _apply_values_to_children (w, remainder, resource, value, last_token, last_part) * ERRORS: none */ static void -_search_child (w, indx, remainder, resource, value, last_token, last_part) - Widget w; - char *indx; - char *remainder; - char *resource; - char *value; - char last_token; - char *last_part; +_search_child ( + Widget w, + char *indx, + char *remainder, + char *resource, + char *value, + char last_token, + char *last_part) { int i; int num_children; @@ -397,7 +397,7 @@ _search_child (w, indx, remainder, resource, value, last_token, last_part) */ num_children = _locate_children (w, &children); for (i=0; i<num_children; i++) { - _set_and_search (children[i], indx, remainder, resource, + _set_and_search (children[i], indx, remainder, resource, value, last_token, last_part); } @@ -407,16 +407,16 @@ _search_child (w, indx, remainder, resource, value, last_token, last_part) /* * NAME: _get_part * - * FUNCTION: - * This routine will return the token and following part of the resource - * when given the current index it will update the index accordingly + * FUNCTION: + * This routine will return the token and following part of the resource + * when given the current index it will update the index accordingly * * PARAMETERS: * remainder the part of the resource string left over * indx the index into the resource string * part the parsed off part of the resource string * - * RETURN VALUES: + * RETURN VALUES: * char the token (* or . or ?) preceding the resource part * indx the index into the resource string * part the parsed off part of the resource string @@ -425,23 +425,23 @@ _search_child (w, indx, remainder, resource, value, last_token, last_part) */ /* ARGSUSED */ static char -_get_part (remainder, indx, part) - char *remainder; - char **indx; - char **part; +_get_part ( + char *remainder, + char **indx, + char **part) { char buffer[MAX_BUFFER]; - char *buf_ptr; + char *buf_ptr; char token = **indx; int i = 0; - /* + /* * copy the remainder part into the buffer */ buf_ptr = buffer; (*indx)++; /* get rid of the token */ while (**indx && (**indx != '.') && (**indx != '*')) { - *buf_ptr++ = *(*indx)++; + *buf_ptr++ = *(*indx)++; if (++i >= MAX_BUFFER - 1) break; } @@ -458,22 +458,22 @@ _get_part (remainder, indx, part) /* * NAME: _match_resource_to_widget * - * FUNCTION: + * FUNCTION: * This function matches the resource part to the widget name or class * * PARAMETERS: * w the widget to match * part the parsed off part of the resource string * - * RETURN VALUES: + * RETURN VALUES: * Boolean true if a match occurs * * ERRORS: none */ static Boolean -_match_resource_to_widget (w, part) - Widget w; - char *part; +_match_resource_to_widget ( + Widget w, + char *part) { /* * Match any widget at this level if the ? is used @@ -506,7 +506,7 @@ _match_resource_to_widget (w, part) /* * NAME: _set_and_search * - * FUNCTION: + * FUNCTION: * The algorithm to search the widget tree and apply a resource string * * PARAMETERS: @@ -515,7 +515,7 @@ _match_resource_to_widget (w, part) * remainder the part of the resource string left over * resource the resource string to be matched * value the value to be set - * last_token the last * or . before the final resoruce part + * last_token the last * or . before the final resoruce part * last_part the last resource part (e.g. *background) * * RETURN VALUES: none @@ -527,19 +527,19 @@ _match_resource_to_widget (w, part) * if (resource segment and current widget match) * if '.' * if at end of resource string - * set values ( .=over all children + * set values ( .=over all children * *=this widget only) * else - * descend the widget tree + * descend the widget tree * and parse off resource segment * exit the loop * if '*' * if at end of resource string - * set values ( .=over all children + * set values ( .=over all children * *=this widget only) * descend and parse * else - * if '.' + * if '.' * continue looping * if '*' * descend but don't parse @@ -550,14 +550,14 @@ _match_resource_to_widget (w, part) * set on a resource against the rules of the resource database manager */ static void -_set_and_search (w, indx, remainder, resource, value, last_token, last_part) - Widget w; - char *indx; - char *remainder; - char *resource; - char *value; - char last_token; - char *last_part; +_set_and_search ( + Widget w, + char *indx, + char *remainder, + char *resource, + char *value, + char last_token, + char *last_part) { char *part; char *local_index = indx; @@ -566,18 +566,18 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) /* * parse off one part, return token and the new index */ - token = _get_part (remainder, &local_index, &part); + token = _get_part (remainder, &local_index, &part); if (_match_resource_to_widget (w, part)) { if (token == '.') { if (local_index == NULL) { if (last_token == '.') { - _set_resource_values (w, resource, + _set_resource_values (w, resource, value, last_part); } else if (last_token == '*') { - _set_resource_values (w, resource, + _set_resource_values (w, resource, value, last_part); - _apply_values_to_children (w, + _apply_values_to_children (w, remainder, resource, value, last_token, last_part); } @@ -585,16 +585,16 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) _search_child (w, local_index, remainder, resource, value, last_token, last_part); return; - } + } if (token == '*') { if (local_index == NULL) { if (last_token == '.') { - _set_resource_values (w, resource, + _set_resource_values (w, resource, value, last_part); } else if (last_token == '*') { - _set_resource_values (w, resource, + _set_resource_values (w, resource, value, last_part); - _apply_values_to_children ( w, + _apply_values_to_children ( w, remainder, resource, value, last_token, last_part); } @@ -608,7 +608,7 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) if (token == '*') { _search_child (w, indx, remainder, resource, value, last_token, last_part); - } + } } XtFree (part); @@ -617,7 +617,7 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) /* * NAME: _get_last_part * - * FUNCTION: + * FUNCTION: * This routine will parse off the last segment of a resource string * and its token and return them. the remainder of resource is also * returned. strcoll is used to guarantee no problems with @@ -627,7 +627,7 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) * remainder the part of the resource string left over * part the parsed off part of the resource string * - * RETURN VALUES: + * RETURN VALUES: * char the token (* or . or ?) preceding the resource part * remainder the part of the resource string left over * part the parsed off part of the resource string @@ -635,9 +635,9 @@ _set_and_search (w, indx, remainder, resource, value, last_token, last_part) * ERRORS: none */ static char -_get_last_part (remainder, part) - char *remainder; - char **part; +_get_last_part ( + char *remainder, + char **part) { char *loose, *tight; @@ -665,11 +665,11 @@ _get_last_part (remainder, part) /* * NAME: _search_widget_tree * - * FUNCTION: + * FUNCTION: * This function tries to match a resource string to the widgets * it applies to. The functions it invokes to do this then set * the value for that resource to each widget. - * + * * The resource string has to be parsed into the following format: * resource = App*Form*button1.background * remainder = *Form*button1 @@ -692,10 +692,10 @@ _get_last_part (remainder, part) * ERRORS: none */ static void -_search_widget_tree (w, resource, value) - Widget w; - char *resource; - char *value; +_search_widget_tree ( + Widget w, + char *resource, + char *value) { Widget parent = w; char *last_part; @@ -718,7 +718,7 @@ _search_widget_tree (w, resource, value) else fprintf (stderr, "widget = NULL parent = NULL\n"); #endif - + /* * parse off the Class name that was prepended to this string in * a customizing tool @@ -735,8 +735,8 @@ _search_widget_tree (w, resource, value) remainder = XtNewString (tight); else if ((tight == NULL) || (loose_len > tight_len)) remainder = XtNewString (loose); - - /* + + /* * Parse last segment off of resource string, (eg. background, font, * etc.) */ @@ -747,7 +747,7 @@ _search_widget_tree (w, resource, value) if (strcmp (remainder, "") == 0) { _set_resource_values (w, resource, value, last_part); if (last_token == '*') - _apply_values_to_children (parent, remainder, resource, + _apply_values_to_children (parent, remainder, resource, value, last_token, last_part); /* * all other resource strings are recursively applied to the widget tree. @@ -761,10 +761,10 @@ _search_widget_tree (w, resource, value) remainder = copy; } indx = remainder; - _set_and_search (parent, indx, remainder, resource, value, + _set_and_search (parent, indx, remainder, resource, value, last_token, last_part); } - + XtFree (remainder); XtFree (last_part); } @@ -772,7 +772,7 @@ _search_widget_tree (w, resource, value) /* * NAME: _locate_children * - * FUNCTION: + * FUNCTION: * returns a list of all of a widget's children * * PARAMETERS: @@ -781,23 +781,23 @@ _search_widget_tree (w, resource, value) * normal flag for normal children * popup flag for popup children * - * RETURN VALUES: + * RETURN VALUES: * int the number of children * children the list of children found * * ERRORS: none */ static int -_locate_children (parent, children) - Widget parent; - Widget **children; +_locate_children ( + Widget parent, + Widget **children) { CompositeWidget comp = (CompositeWidget) parent; - int i; + Cardinal i; int num_children = 0; int current = 0; - /* + /* * count the number of children */ if (XtIsWidget (parent)) @@ -809,7 +809,7 @@ _locate_children (parent, children) return (0); } - *children = (Widget *) + *children = (Widget *) XtMalloc ((Cardinal) sizeof(Widget) * num_children); if (XtIsComposite (parent)) { @@ -833,7 +833,7 @@ _locate_children (parent, children) /* * NAME: dump_widget_tree * - * FUNCTION: + * FUNCTION: * recursively printout entire widget tree * * PARAMETERS: @@ -845,9 +845,9 @@ _locate_children (parent, children) * ERRORS: none */ static void -dump_widget_tree (w, indent) - Widget w; - int indent; +dump_widget_tree ( + Widget w, + int indent) { int i,j; int num_children; @@ -857,10 +857,10 @@ dump_widget_tree (w, indent) * Recursively search through the children */ num_children = _locate_children (w, &children); - indent += 2; + indent += 2; for (i=0; i<num_children; i++) { if (children[i] != NULL) { - for (j=0; j<indent; j++) + for (j=0; j<indent; j++) fprintf (stderr, " "); if (XtIsWidget (children[i])) { fprintf (stderr, "(%s)\t",children[i]->core.name); @@ -882,10 +882,10 @@ dump_widget_tree (w, indent) /* * NAME: _XtResourceConfiguationEH * - * FUNCTION: + * FUNCTION: * This function is the event handler for the on-the-fly communication - * with a resource customization tool. This event handler must be - * registered for the toplevel shell of each app. This is best done + * with a resource customization tool. This event handler must be + * registered for the toplevel shell of each app. This is best done * in the _XtCreatePopupShell and _XtAppCreateShell functions in Xt's * Create.c source file. * @@ -910,10 +910,10 @@ dump_widget_tree (w, indent) */ /* ARGSUSED */ void -_XtResourceConfigurationEH (w, client_data, event) - Widget w; - XtPointer client_data; - XEvent *event; +_XtResourceConfigurationEH ( + Widget w, + XtPointer client_data, + XEvent *event) { Atom actual_type; int actual_format; @@ -956,7 +956,7 @@ _XtResourceConfigurationEH (w, client_data, event) else fprintf (stderr, "NULL name\n"); dump_widget_tree(w, indent); - + fprintf (stderr, "answer ping\n"); #endif } @@ -965,7 +965,7 @@ _XtResourceConfigurationEH (w, client_data, event) * This event handler ignores any property notify events that * are not RCM_INIT or RCM_DATA */ - if (event->xproperty.atom != pd->rcm_data) + if (event->xproperty.atom != pd->rcm_data) return; /* @@ -979,7 +979,7 @@ _XtResourceConfigurationEH (w, client_data, event) pd->rcm_data, 0L, 8192L, TRUE, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, - &data ) == Success && actual_type == XA_STRING + &data ) == Success && actual_type == XA_STRING && actual_format == 8) { /* * data format is: diff --git a/src/Resources.c b/src/Resources.c index 8d717e3..9b826d5 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -82,10 +82,10 @@ char *Cjumpp = (char *) Cjump; void Cjump() {} #endif -void _XtCopyFromParent(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +void _XtCopyFromParent( + Widget widget, + int offset, + XrmValue *value) { if (widget->core.parent == NULL) { XtAppWarningMsg(XtWidgetToApplicationContext(widget), @@ -104,10 +104,10 @@ void _XtCopyFromParent(widget, offset, value) #ifdef UNALIGNED -void _XtCopyFromArg(src, dst, size) - XtArgVal src; - char* dst; - register unsigned int size; +void _XtCopyFromArg( + XtArgVal src, + char* dst, + register unsigned int size) { if (size == sizeof(long)) *(long *)dst = (long)src; else if (size == sizeof(short)) *(short *)dst = (short)src; @@ -121,10 +121,10 @@ void _XtCopyFromArg(src, dst, size) (void) memmove((char *) dst, (char *) &src, (int) size); } /* _XtCopyFromArg */ -void _XtCopyToArg(src, dst, size) - char* src; - XtArgVal *dst; - register unsigned int size; +void _XtCopyToArg( + char* src, + XtArgVal *dst, + register unsigned int size) { if (! (*dst)) { #ifdef GETVALUES_BUG @@ -155,10 +155,10 @@ void _XtCopyToArg(src, dst, size) } } /* _XtCopyToArg */ -static void CopyToArg(src, dst, size) - char* src; - XtArgVal *dst; - register unsigned int size; +static void CopyToArg( + char* src, + XtArgVal *dst, + register unsigned int size) { if (! (*dst)) { /* old GetValues semantics (storing directly into arglists) are bad, @@ -185,10 +185,10 @@ static void CopyToArg(src, dst, size) } /* CopyToArg */ #else -void _XtCopyFromArg(src, dst, size) - XtArgVal src; - char* dst; - register unsigned int size; +void _XtCopyFromArg( + XtArgVal src, + char* dst, + register unsigned int size) { if (size > sizeof(XtArgVal)) (void) memmove((char *) dst, (char *) src, (int) size); @@ -218,10 +218,10 @@ void _XtCopyFromArg(src, dst, size) } } /* _XtCopyFromArg */ -void _XtCopyToArg(src, dst, size) - char* src; - XtArgVal *dst; - register unsigned int size; +void _XtCopyToArg( + char* src, + XtArgVal *dst, + register unsigned int size) { if (!*dst) { #ifdef GETVALUES_BUG @@ -263,10 +263,10 @@ void _XtCopyToArg(src, dst, size) } } /* _XtCopyToArg */ -static void CopyToArg(src, dst, size) - char* src; - XtArgVal *dst; - register unsigned int size; +static void CopyToArg( + char* src, + XtArgVal *dst, + register unsigned int size) { if (!*dst) { /* old GetValues semantics (storing directly into arglists) are bad, @@ -305,8 +305,8 @@ static void CopyToArg(src, dst, size) #endif -static Cardinal CountTreeDepth(w) - Widget w; +static Cardinal CountTreeDepth( + Widget w) { Cardinal count; @@ -316,10 +316,10 @@ static Cardinal CountTreeDepth(w) return count; } -static void GetNamesAndClasses(w, names, classes) - register Widget w; - register XrmNameList names; - register XrmClassList classes; +static void GetNamesAndClasses( + register Widget w, + register XrmNameList names, + register XrmClassList classes) { register Cardinal length, j; register XrmQuark t; @@ -359,9 +359,9 @@ static void GetNamesAndClasses(w, names, classes) /* All atoms are replaced by quarks, and offsets are -offset-1 to */ /* indicate that this list has been compiled already */ -void _XtCompileResourceList(resources, num_resources) - register XtResourceList resources; - Cardinal num_resources; +void _XtCompileResourceList( + register XtResourceList resources, + Cardinal num_resources) { register Cardinal count; @@ -381,9 +381,9 @@ void _XtCompileResourceList(resources, num_resources) } /* _XtCompileResourceList */ /* Like _XtCompileResourceList, but strings are not permanent */ -static void XrmCompileResourceListEphem(resources, num_resources) - register XtResourceList resources; - Cardinal num_resources; +static void XrmCompileResourceListEphem( + register XtResourceList resources, + Cardinal num_resources) { register Cardinal count; @@ -400,9 +400,9 @@ static void XrmCompileResourceListEphem(resources, num_resources) #undef xrmres } /* XrmCompileResourceListEphem */ -static void BadSize(size, name) - Cardinal size; - XrmQuark name; +static void BadSize( + Cardinal size, + XrmQuark name) { String params[2]; Cardinal num_params = 2; @@ -422,13 +422,12 @@ static void BadSize(size, name) * At the same time, add a level of indirection to the XtResourceList to * create and XrmResourceList. */ -void _XtDependencies(class_resp, class_num_resp, super_res, super_num_res, - super_widget_size) - XtResourceList *class_resp; /* VAR */ - Cardinal *class_num_resp; /* VAR */ - XrmResourceList *super_res; - Cardinal super_num_res; - Cardinal super_widget_size; +void _XtDependencies( + XtResourceList *class_resp, /* VAR */ + Cardinal *class_num_resp, /* VAR */ + XrmResourceList *super_res, + Cardinal super_num_res, + Cardinal super_widget_size) { register XrmResourceList *new_res; Cardinal new_num_res; @@ -453,7 +452,7 @@ void _XtDependencies(class_resp, class_num_resp, super_res, super_num_res, /* Put pointers to class resource entries into new_res */ new_next = super_num_res; for (i = 0; i < class_num_res; i++) { - if (-class_res[i].xrm_offset-1 < super_widget_size) { + if ((Cardinal)(-class_res[i].xrm_offset-1) < super_widget_size) { /* Probably an override of superclass resources--look for overlap */ for (j = 0; j < super_num_res; j++) { if (class_res[i].xrm_offset == new_res[j]->xrm_offset) { @@ -487,8 +486,8 @@ NextResource:; } /* _XtDependencies */ -void _XtResourceDependencies(wc) - WidgetClass wc; +void _XtResourceDependencies( + WidgetClass wc) { WidgetClass sc; @@ -506,8 +505,8 @@ void _XtResourceDependencies(wc) } } /* _XtResourceDependencies */ -void _XtConstraintResDependencies(wc) - ConstraintWidgetClass wc; +void _XtConstraintResDependencies( + ConstraintWidgetClass wc) { ConstraintWidgetClass sc; @@ -528,11 +527,11 @@ void _XtConstraintResDependencies(wc) -XrmResourceList* _XtCreateIndirectionTable (resources, num_resources) - XtResourceList resources; - Cardinal num_resources; +XrmResourceList* _XtCreateIndirectionTable ( + XtResourceList resources, + Cardinal num_resources) { - register int idx; + register Cardinal idx; XrmResourceList* table; table = (XrmResourceList*)__XtMalloc(num_resources * sizeof(XrmResourceList)); @@ -541,21 +540,19 @@ XrmResourceList* _XtCreateIndirectionTable (resources, num_resources) return table; } -static XtCacheRef *GetResources(widget, base, names, classes, - table, num_resources, quark_args, args, num_args, - typed_args, pNumTypedArgs, tm_hack) - Widget widget; /* Widget resources are associated with */ - char* base; /* Base address of memory to write to */ - XrmNameList names; /* Full inheritance name of widget */ - XrmClassList classes; /* Full inheritance class of widget */ - XrmResourceList* table; /* The list of resources required. */ - Cardinal num_resources; /* number of items in resource list */ - XrmQuarkList quark_args; /* Arg names quarkified */ - ArgList args; /* ArgList to override resources */ - Cardinal num_args; /* number of items in arg list */ - XtTypedArgList typed_args; /* Typed arg list to override resources */ - Cardinal* pNumTypedArgs; /* number of items in typed arg list */ - Boolean tm_hack; /* do baseTranslations */ +static XtCacheRef *GetResources( + Widget widget, /* Widget resources are associated with */ + char* base, /* Base address of memory to write to */ + XrmNameList names, /* Full inheritance name of widget */ + XrmClassList classes, /* Full inheritance class of widget */ + XrmResourceList* table, /* The list of resources required. */ + unsigned num_resources, /* number of items in resource list */ + XrmQuarkList quark_args, /* Arg names quarkified */ + ArgList args, /* ArgList to override resources */ + unsigned num_args, /* number of items in arg list */ + XtTypedArgList typed_args, /* Typed arg list to override resources */ + Cardinal* pNumTypedArgs, /* number of items in typed arg list */ + Boolean tm_hack) /* do baseTranslations */ { /* * assert: *pNumTypedArgs == 0 if num_args > 0 @@ -612,11 +609,11 @@ static XtCacheRef *GetResources(widget, base, names, classes, register ArgList arg; register XtTypedArgList typed_arg; register XrmName argName; - register int j; + register Cardinal j; register int i; register XrmResourceList rx; register XrmResourceList *res; - for (arg = args, i = 0; i < num_args; i++, arg++) { + for (arg = args, i = 0; (Cardinal)i < num_args; i++, arg++) { argName = quark_args[i]; if (argName == QinitialResourcesPersistent) { persistent_resources = (Boolean)arg->value; @@ -684,7 +681,7 @@ static XtCacheRef *GetResources(widget, base, names, classes, /* geez, this is an ugly mess */ if (XtIsShell(widget)) { register XrmResourceList *res; - register int j; + register Cardinal j; Screen *oldscreen = widget->core.screen; /* look up screen resource first, since real rdb depends on it */ @@ -698,7 +695,7 @@ static XtCacheRef *GetResources(widget, base, names, classes, from_type = StringToQuark(arg->type); from_val.size = arg->size; - if ((from_type == QString) || (arg->size > sizeof(XtArgVal))) + if ((from_type == QString) || ((unsigned) arg->size > sizeof(XtArgVal))) from_val.addr = (XPointer)arg->value; else from_val.addr = (XPointer)&arg->value; @@ -746,7 +743,7 @@ static XtCacheRef *GetResources(widget, base, names, classes, { register XrmResourceList rx; register XrmResourceList *res; - register int j; + register Cardinal j; register XrmRepresentation xrm_type; register XrmRepresentation xrm_default_type; char char_val; @@ -792,7 +789,7 @@ static XtCacheRef *GetResources(widget, base, names, classes, from_type = StringToQuark(arg->type); from_val.size = arg->size; - if ((from_type == QString) || (arg->size > sizeof(XtArgVal))) + if ((from_type == QString) || ((unsigned) arg->size > sizeof(XtArgVal))) from_val.addr = (XPointer)arg->value; else from_val.addr = (XPointer)&arg->value; @@ -965,7 +962,7 @@ static XtCacheRef *GetResources(widget, base, names, classes, } } } - if (num_typed_args != *pNumTypedArgs) *pNumTypedArgs = num_typed_args; + if ((Cardinal)num_typed_args != *pNumTypedArgs) *pNumTypedArgs = num_typed_args; if (searchList != stackSearchList) XtFree((char*)searchList); if (!cache_ptr) cache_ptr = cache_base; @@ -982,15 +979,14 @@ static XtCacheRef *GetResources(widget, base, names, classes, -static void CacheArgs(args, num_args, typed_args, num_typed_args, quark_cache, - num_quarks, pQuarks) - ArgList args; - Cardinal num_args; - XtTypedArgList typed_args; - Cardinal num_typed_args; - XrmQuarkList quark_cache; - Cardinal num_quarks; - XrmQuarkList *pQuarks; /* RETURN */ +static void CacheArgs( + ArgList args, + Cardinal num_args, + XtTypedArgList typed_args, + Cardinal num_typed_args, + XrmQuarkList quark_cache, + Cardinal num_quarks, + XrmQuarkList *pQuarks) /* RETURN */ { register XrmQuarkList quarks; register Cardinal i; @@ -1019,12 +1015,12 @@ static void CacheArgs(args, num_args, typed_args, num_typed_args, quark_cache, if (cache != pointer) XtFree((char *)pointer) -XtCacheRef *_XtGetResources(w, args, num_args, typed_args, num_typed_args) - register Widget w; - ArgList args; - Cardinal num_args; - XtTypedArgList typed_args; - Cardinal* num_typed_args; +XtCacheRef *_XtGetResources( + register Widget w, + ArgList args, + Cardinal num_args, + XtTypedArgList typed_args, + Cardinal* num_typed_args) { XrmName *names, names_s[50]; XrmClass *classes, classes_s[50]; @@ -1142,16 +1138,15 @@ void XtGetSubresources ( } -void _XtGetApplicationResources - (w, base, resources, num_resources, args, num_args, typed_args, num_typed_args) - Widget w; /* Application shell widget */ - XtPointer base; /* Base address to write to */ - XtResourceList resources; /* resource list for subobject */ - Cardinal num_resources; - ArgList args; /* arg list to override resources */ - Cardinal num_args; - XtTypedArgList typed_args; - Cardinal num_typed_args; +void _XtGetApplicationResources ( + Widget w, /* Application shell widget */ + XtPointer base, /* Base address to write to */ + XtResourceList resources, /* resource list for subobject */ + Cardinal num_resources, + ArgList args, /* arg list to override resources */ + Cardinal num_args, + XtTypedArgList typed_args, + Cardinal num_typed_args) { XrmName *names, names_s[50]; XrmClass *classes, classes_s[50]; @@ -1220,21 +1215,20 @@ void _XtGetApplicationResources UNLOCK_APP(app); } -void XtGetApplicationResources - (w, base, resources, num_resources, args, num_args) - Widget w; /* Application shell widget */ - XtPointer base; /* Base address to write to */ - XtResourceList resources; /* resource list for subobject */ - Cardinal num_resources; - ArgList args; /* arg list to override resources */ - Cardinal num_args; +void XtGetApplicationResources ( + Widget w, /* Application shell widget */ + XtPointer base, /* Base address to write to */ + XtResourceList resources, /* resource list for subobject */ + Cardinal num_resources, + ArgList args, /* arg list to override resources */ + Cardinal num_args) { _XtGetApplicationResources(w, base, resources, num_resources, args, num_args, NULL, 0); } static Boolean initialized = FALSE; -void _XtResourceListInitialize() +void _XtResourceListInitialize(void) { LOCK_PROCESS; if (initialized) { diff --git a/src/Selection.c b/src/Selection.c index 1b65f20..1f41d2f 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -66,34 +66,34 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xatom.h> #include <stdio.h> -void _XtSetDefaultSelectionTimeout(timeout) - unsigned long *timeout; +void _XtSetDefaultSelectionTimeout( + unsigned long *timeout) { *timeout = 5000; /* default to 5 seconds */ } -void XtSetSelectionTimeout(timeout) - unsigned long timeout; +void XtSetSelectionTimeout( + unsigned long timeout) { XtAppSetSelectionTimeout(_XtDefaultAppContext(), timeout); } -void XtAppSetSelectionTimeout(app, timeout) - XtAppContext app; - unsigned long timeout; +void XtAppSetSelectionTimeout( + XtAppContext app, + unsigned long timeout) { LOCK_APP(app); app->selectionTimeout = timeout; UNLOCK_APP(app); } -unsigned long XtGetSelectionTimeout() +unsigned long XtGetSelectionTimeout(void) { return XtAppGetSelectionTimeout(_XtDefaultAppContext()); } -unsigned long XtAppGetSelectionTimeout(app) - XtAppContext app; +unsigned long XtAppGetSelectionTimeout( + XtAppContext app) { unsigned long retval; @@ -106,26 +106,26 @@ unsigned long XtAppGetSelectionTimeout(app) /* General utilities */ -static void HandleSelectionReplies(); -static void ReqTimedOut(); -static void HandlePropertyGone(); -static void HandleGetIncrement(); -static void HandleIncremental(); +static void HandleSelectionReplies(Widget, XtPointer, XEvent *, Boolean *); +static void ReqTimedOut(XtPointer, XtIntervalId *); +static void HandlePropertyGone(Widget, XtPointer, XEvent *, Boolean *); +static void HandleGetIncrement(Widget, XtPointer, XEvent *, Boolean *); +static void HandleIncremental(Display *, Widget, Atom, CallBackInfo, unsigned long); static XContext selectPropertyContext = 0; static XContext paramPropertyContext = 0; static XContext multipleContext = 0; /* Multiple utilities */ -static void AddSelectionRequests(); -static Boolean IsGatheringRequest(); +static void AddSelectionRequests(Widget, Atom, int, Atom *, XtSelectionCallbackProc *, int, XtPointer *, Boolean *, Atom *); +static Boolean IsGatheringRequest(Widget, Atom); #define PREALLOCED 32 /* Parameter utilities */ -static void AddParamInfo(); -static void RemoveParamInfo(); -static Atom GetParamInfo(); +static void AddParamInfo(Widget, Atom, Atom); +static void RemoveParamInfo(Widget, Atom); +static Atom GetParamInfo(Widget, Atom); static int StorageSize[3] = {1, sizeof(short), sizeof(long)}; #define BYTELENGTH(length, format) ((length) * StorageSize[(format)>>4]) @@ -143,10 +143,10 @@ static int StorageSize[3] = {1, sizeof(short), sizeof(long)}; #endif /*ARGSUSED*/ -static void FreePropList(w, closure, callData) - Widget w; /* unused */ - XtPointer closure; - XtPointer callData; /* unused */ +static void FreePropList( + Widget w, /* unused */ + XtPointer closure, + XtPointer callData) /* unused */ { PropList sarray = (PropList)closure; LOCK_PROCESS; @@ -158,8 +158,8 @@ static void FreePropList(w, closure, callData) } -static PropList GetPropList(dpy) - Display *dpy; +static PropList GetPropList( + Display *dpy) { PropList sarray; Atom atoms[4]; @@ -182,7 +182,7 @@ static PropList GetPropList(dpy) sarray->indirect_atom = atoms[1]; sarray->timestamp_atom = atoms[2]; sarray->propCount = 1; - sarray->list = + sarray->list = (SelectionProp)__XtMalloc((unsigned) sizeof(SelectionPropRec)); sarray->list[0].prop = atoms[3]; sarray->list[0].avail = TRUE; @@ -196,8 +196,8 @@ static PropList GetPropList(dpy) } -static Atom GetSelectionProperty(dpy) -Display *dpy; +static Atom GetSelectionProperty( + Display *dpy) { SelectionProp p; int propCount; @@ -213,7 +213,7 @@ Display *dpy; } } propCount = sarray->propCount++; - sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list, + sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list, (unsigned)(sarray->propCount*sizeof(SelectionPropRec))); (void) sprintf(propname, "%s%d", "_XT_SELECTION_", propCount); sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE); @@ -221,30 +221,30 @@ Display *dpy; return(sarray->list[propCount].prop); } -static void FreeSelectionProperty(dpy, prop) -Display *dpy; -Atom prop; +static void FreeSelectionProperty( + Display *dpy, + Atom prop) { SelectionProp p; PropList sarray; if (prop == None) return; LOCK_PROCESS; if (XFindContext(dpy, DefaultRootWindow(dpy), selectPropertyContext, - (XPointer *)&sarray)) + (XPointer *)&sarray)) XtAppErrorMsg(XtDisplayToApplicationContext(dpy), "noSelectionProperties", "freeSelectionProperty", XtCXtToolkitError, "internal error: no selection property context for display", (String *)NULL, (Cardinal *)NULL ); UNLOCK_PROCESS; - for (p = sarray->list; p; p++) + for (p = sarray->list; p; p++) if (p->prop == prop) { p->avail = TRUE; return; } } -static void FreeInfo(info) - CallBackInfo info; +static void FreeInfo( + CallBackInfo info) { XtFree((char*)info->incremental); XtFree((char*)info->callbacks); @@ -253,27 +253,26 @@ static void FreeInfo(info) XtFree((char*)info); } -static CallBackInfo MakeInfo(ctx, callbacks, closures, count, - widget, time, incremental, properties) -Select ctx; -XtSelectionCallbackProc *callbacks; -XtPointer *closures; -int count; -Widget widget; -Time time; -Boolean *incremental; -Atom *properties; +static CallBackInfo MakeInfo( + Select ctx, + XtSelectionCallbackProc *callbacks, + XtPointer *closures, + int count, + Widget widget, + Time time, + Boolean *incremental, + Atom *properties) { CallBackInfo info = XtNew(CallBackInfoRec); info->ctx = ctx; info->callbacks = (XtSelectionCallbackProc *) __XtMalloc((unsigned) (count * sizeof(XtSelectionCallbackProc))); - (void) memmove((char*)info->callbacks, (char*)callbacks, + (void) memmove((char*)info->callbacks, (char*)callbacks, count * sizeof(XtSelectionCallbackProc)); info->req_closure = (XtPointer*)__XtMalloc((unsigned) (count * sizeof(XtPointer))); - (void) memmove((char*)info->req_closure, (char*)closures, + (void) memmove((char*)info->req_closure, (char*)closures, count * sizeof(XtPointer)); if (count == 1 && properties != NULL && properties[0] != None) info->property = properties[0]; @@ -293,28 +292,28 @@ Atom *properties; return (info); } -static void RequestSelectionValue(info, selection, target) -CallBackInfo info; -Atom selection; -Atom target; +static void RequestSelectionValue( + CallBackInfo info, + Atom selection, + Atom target) { #ifndef DEBUG_WO_TIMERS XtAppContext app = XtWidgetToApplicationContext(info->widget); info->timeout = XtAppAddTimeOut(app, app->selectionTimeout, ReqTimedOut, (XtPointer)info); -#endif +#endif XtAddEventHandler(info->widget, (EventMask)0, TRUE, HandleSelectionReplies, (XtPointer)info); - XConvertSelection(info->ctx->dpy, selection, target, + XConvertSelection(info->ctx->dpy, selection, target, info->property, XtWindow(info->widget), info->time); } static XContext selectContext = 0; -static Select NewContext(dpy, selection) -Display *dpy; -Atom selection; +static Select NewContext( + Display *dpy, + Atom selection) { /* assert(selectContext != 0) */ Select ctx = XtNew(SelectRec); @@ -331,9 +330,9 @@ Atom selection; return ctx; } -static Select FindCtx(dpy, selection) -Display *dpy; -Atom selection; +static Select FindCtx( + Display *dpy, + Atom selection) { Select ctx; @@ -347,9 +346,9 @@ Atom selection; } /*ARGSUSED*/ -static void WidgetDestroyed(widget, closure, data) -Widget widget; -XtPointer closure, data; +static void WidgetDestroyed( + Widget widget, + XtPointer closure, XtPointer data) { Select ctx = (Select) closure; if (ctx->widget == widget) { @@ -362,13 +361,13 @@ XtPointer closure, data; /* Selection Owner code */ -static void HandleSelectionEvents(); +static void HandleSelectionEvents(Widget, XtPointer, XEvent *, Boolean *); -static Boolean LoseSelection(ctx, widget, selection, time) -Select ctx; -Widget widget; -Atom selection; -Time time; +static Boolean LoseSelection( + Select ctx, + Widget widget, + Atom selection, + Time time) { if ((ctx->widget == widget) && (ctx->selection == selection) && /* paranoia */ @@ -376,13 +375,13 @@ Time time; ((time == CurrentTime) || (time >= ctx->time))) { XtRemoveEventHandler(widget, (EventMask)0, TRUE, - HandleSelectionEvents, (XtPointer)ctx); - XtRemoveCallback(widget, XtNdestroyCallback, - WidgetDestroyed, (XtPointer)ctx); + HandleSelectionEvents, (XtPointer)ctx); + XtRemoveCallback(widget, XtNdestroyCallback, + WidgetDestroyed, (XtPointer)ctx); ctx->was_disowned = TRUE; /* widget officially loses ownership */ /* now inform widget */ - if (ctx->loses) { - if (ctx->incremental) + if (ctx->loses) { + if (ctx->incremental) (*(XtLoseSelectionIncrProc)ctx->loses) (widget, &ctx->selection, ctx->owner_closure); else (*ctx->loses)(widget, &ctx->selection); @@ -401,9 +400,9 @@ static xErrorHandler oldErrorHandler = NULL; static unsigned long firstProtectRequest; static Window errorWindow; -static int LocalErrorHandler (dpy, error) -Display *dpy; -XErrorEvent *error; +static int LocalErrorHandler ( + Display *dpy, + XErrorEvent *error) { int retval; @@ -428,9 +427,9 @@ XErrorEvent *error; return retval; } -static void StartProtectedSection(dpy, window) - Display *dpy; - Window window; +static void StartProtectedSection( + Display *dpy, + Window window) { /* protect ourselves against request window being destroyed * before completion of transfer */ @@ -442,8 +441,8 @@ static void StartProtectedSection(dpy, window) UNLOCK_PROCESS; } -static void EndProtectedSection(dpy) - Display *dpy; +static void EndProtectedSection( + Display *dpy) { /* flush any generated errors on requestor and * restore original error handler */ @@ -456,11 +455,11 @@ static void EndProtectedSection(dpy) UNLOCK_PROCESS; } -static void AddHandler(req, mask, proc, closure) -Request req; -EventMask mask; -XtEventHandler proc; -XtPointer closure; +static void AddHandler( + Request req, + EventMask mask, + XtEventHandler proc, + XtPointer closure) { Display *dpy = req->ctx->dpy; Window window = req->requestor; @@ -492,17 +491,17 @@ XtPointer closure; } } -static void RemoveHandler(req, mask, proc, closure) -Request req; -EventMask mask; -XtEventHandler proc; -XtPointer closure; +static void RemoveHandler( + Request req, + EventMask mask, + XtEventHandler proc, + XtPointer closure) { Display *dpy = req->ctx->dpy; Window window = req->requestor; Widget widget = req->widget; - if ((XtWindowToWidget(dpy, window) == widget) && + if ((XtWindowToWidget(dpy, window) == widget) && (XtWindow(widget) != window)) { /* we had to hang this window onto our widget; take it off */ RequestWindowRec* requestWindowRec; @@ -522,20 +521,20 @@ XtPointer closure; XtFree((char*)requestWindowRec); } } else { - XtRemoveEventHandler(widget, mask, TRUE, proc, closure); + XtRemoveEventHandler(widget, mask, TRUE, proc, closure); } } /* ARGSUSED */ -static void OwnerTimedOut(closure, id) -XtPointer closure; -XtIntervalId *id; +static void OwnerTimedOut( + XtPointer closure, + XtIntervalId *id) { Request req = (Request)closure; Select ctx = req->ctx; if (ctx->incremental && (ctx->owner_cancel != NULL)) { - (*ctx->owner_cancel)(ctx->widget, &ctx->selection, + (*ctx->owner_cancel)(ctx->widget, &ctx->selection, &req->target, (XtRequestId*)&req, ctx->owner_closure); } else { @@ -547,7 +546,7 @@ XtIntervalId *id; */ if (ctx->incremental) (*(XtSelectionDoneIncrProc)ctx->notify) - (ctx->widget, &ctx->selection, &req->target, + (ctx->widget, &ctx->selection, &req->target, (XtRequestId*)&req, ctx->owner_closure); else (*ctx->notify)(ctx->widget, &ctx->selection, &req->target); @@ -555,36 +554,36 @@ XtIntervalId *id; } RemoveHandler(req, (EventMask)PropertyChangeMask, - HandlePropertyGone, closure); + HandlePropertyGone, closure); XtFree((char*)req); if (--ctx->ref_count == 0 && ctx->free_when_done) XtFree((char*)ctx); } -static void SendIncrement(incr) - Request incr; +static void SendIncrement( + Request incr) { Display *dpy = incr->ctx->dpy; - int incrSize = MAX_SELECTION_INCR(dpy); - if (incrSize > incr->bytelength - incr->offset) + unsigned long incrSize = MAX_SELECTION_INCR(dpy); + if (incrSize > incr->bytelength - incr->offset) incrSize = incr->bytelength - incr->offset; StartProtectedSection(dpy, incr->requestor); - XChangeProperty(dpy, incr->requestor, incr->property, - incr->type, incr->format, PropModeReplace, + XChangeProperty(dpy, incr->requestor, incr->property, + incr->type, incr->format, PropModeReplace, (unsigned char *)incr->value + incr->offset, - NUMELEM(incrSize, incr->format)); + NUMELEM((int)incrSize, incr->format)); EndProtectedSection(dpy); incr->offset += incrSize; } -static void AllSent(req) -Request req; +static void AllSent( + Request req) { Select ctx = req->ctx; StartProtectedSection(ctx->dpy, req->requestor); - XChangeProperty(ctx->dpy, req->requestor, - req->property, req->type, req->format, + XChangeProperty(ctx->dpy, req->requestor, + req->property, req->type, req->format, PropModeReplace, (unsigned char *) NULL, 0); EndProtectedSection(ctx->dpy); req->allSent = TRUE; @@ -593,11 +592,11 @@ Request req; } /*ARGSUSED*/ -static void HandlePropertyGone(widget, closure, ev, cont) -Widget widget; -XtPointer closure; -XEvent *ev; -Boolean *cont; +static void HandlePropertyGone( + Widget widget, + XtPointer closure, + XEvent *ev, + Boolean *cont) { XPropertyEvent *event = (XPropertyEvent *) ev; Request req = (Request)closure; @@ -610,8 +609,8 @@ Boolean *cont; return; #ifndef DEBUG_WO_TIMERS XtRemoveTimeOut(req->timeout); -#endif - if (req->allSent) { +#endif + if (req->allSent) { if (ctx->notify) { if (ctx->incremental) { (*(XtSelectionDoneIncrProc)ctx->notify) @@ -621,11 +620,11 @@ Boolean *cont; else (*ctx->notify)(ctx->widget, &ctx->selection, &req->target); } RemoveHandler(req, (EventMask)PropertyChangeMask, - HandlePropertyGone, closure); + HandlePropertyGone, closure); XtFree((char*)req); if (--ctx->ref_count == 0 && ctx->free_when_done) XtFree((char*)ctx); - } else { /* is this part of an incremental transfer? */ + } else { /* is this part of an incremental transfer? */ if (ctx->incremental) { if (req->bytelength == 0) AllSent(req); @@ -633,8 +632,8 @@ Boolean *cont; unsigned long size = MAX_SELECTION_INCR(ctx->dpy); SendIncrement(req); (*(XtConvertSelectionIncrProc)ctx->convert) - (ctx->widget, &ctx->selection, &req->target, - &req->type, &req->value, + (ctx->widget, &ctx->selection, &req->target, + &req->type, &req->value, &req->bytelength, &req->format, &size, ctx->owner_closure, (XtPointer*)&req); if (req->bytelength) @@ -642,7 +641,7 @@ Boolean *cont; req->offset = 0; } } else { - if (req->offset < req->bytelength) + if (req->offset < req->bytelength) SendIncrement(req); else AllSent(req); } @@ -652,21 +651,20 @@ Boolean *cont; req->timeout = XtAppAddTimeOut(app, app->selectionTimeout, OwnerTimedOut, (XtPointer)req); } -#endif +#endif } } -static void PrepareIncremental(req, widget, window, property, target, - targetType, value, length, format) -Request req; -Widget widget; -Window window; -Atom target; -Atom property; -Atom targetType; -XtPointer value; -unsigned long length; -int format; +static void PrepareIncremental( + Request req, + Widget widget, + Window window, + Atom property, + Atom target, + Atom targetType, + XtPointer value, + unsigned long length, + int format) { req->type = targetType; req->value = value; @@ -682,22 +680,22 @@ int format; req->timeout = XtAppAddTimeOut(app, app->selectionTimeout, OwnerTimedOut, (XtPointer)req); } -#endif - AddHandler(req, (EventMask)PropertyChangeMask, +#endif + AddHandler(req, (EventMask)PropertyChangeMask, HandlePropertyGone, (XtPointer)req); /* now send client INCR property */ XChangeProperty(req->ctx->dpy, window, req->property, req->ctx->prop_list->incr_atom, - 32, PropModeReplace, + 32, PropModeReplace, (unsigned char *)&req->bytelength, 1); } -static Boolean GetConversion(ctx, event, target, property, widget) -Select ctx; /* logical owner */ -XSelectionRequestEvent* event; -Atom target; -Atom property; /* requestor's property */ -Widget widget; /* physical owner (receives events) */ +static Boolean GetConversion( + Select ctx, /* logical owner */ + XSelectionRequestEvent* event, + Atom target, + Atom property, /* requestor's property */ + Widget widget) /* physical owner (receives events) */ { XtPointer value = NULL; unsigned long length; @@ -747,7 +745,7 @@ Widget widget; /* physical owner (receives events) */ ctx->req = NULL; } StartProtectedSection(ctx->dpy, event->requestor); - if (BYTELENGTH(length,format) <= MAX_SELECTION_INCR(ctx->dpy)) { + if (BYTELENGTH(length,format) <= (unsigned long) MAX_SELECTION_INCR(ctx->dpy)) { if (! timestamp_target) { if (ctx->notify != NULL) { req->target = target; @@ -759,13 +757,13 @@ Widget widget; /* physical owner (receives events) */ req->timeout = XtAppAddTimeOut(app, app->selectionTimeout, OwnerTimedOut, (XtPointer)req); } -#endif - AddHandler(req, (EventMask)PropertyChangeMask, +#endif + AddHandler(req, (EventMask)PropertyChangeMask, HandlePropertyGone, (XtPointer)req); } else ctx->ref_count--; } - XChangeProperty(ctx->dpy, event->requestor, property, + XChangeProperty(ctx->dpy, event->requestor, property, targetType, format, PropModeReplace, (unsigned char *)value, (int)length); /* free storage for client if no notify proc */ @@ -781,11 +779,11 @@ Widget widget; /* physical owner (receives events) */ } /*ARGSUSED*/ -static void HandleSelectionEvents(widget, closure, event, cont) -Widget widget; -XtPointer closure; -XEvent *event; -Boolean *cont; +static void HandleSelectionEvents( + Widget widget, + XtPointer closure, + XEvent *event, + Boolean *cont) { Select ctx; XSelectionEvent ev; @@ -845,7 +843,7 @@ Boolean *cont; } } if (writeback) - XChangeProperty(ev.display, ev.requestor, + XChangeProperty(ev.display, ev.requestor, event->xselectionrequest.property, target, format, PropModeReplace, value, (int)length); XFree((char *)value); @@ -870,17 +868,16 @@ Boolean *cont; } } -static Boolean OwnSelection(widget, selection, time, convert, lose, notify, - cancel, closure, incremental) -Widget widget; -Atom selection; -Time time; -XtConvertSelectionProc convert; -XtLoseSelectionProc lose; -XtSelectionDoneProc notify; -XtCancelConvertSelectionProc cancel; -XtPointer closure; -Boolean incremental; +static Boolean OwnSelection( + Widget widget, + Atom selection, + Time time, + XtConvertSelectionProc convert, + XtLoseSelectionProc lose, + XtSelectionDoneProc notify, + XtCancelConvertSelectionProc cancel, + XtPointer closure, + Boolean incremental) { Select ctx; Select oldctx = NULL; @@ -952,8 +949,8 @@ Boolean incremental; ctx->was_disowned = FALSE; /* Defer calling the previous selection owner's lose selection procedure - * until the new selection is established, to allow the previous - * selection owner to ask for the new selection to be converted in + * until the new selection is established, to allow the previous + * selection owner to ask for the new selection to be converted in * the lose selection procedure. The context pointer is the closure * of the event handler and the destroy callback, so the old context * pointer and the record contents must be preserved for LoseSelection. @@ -967,13 +964,13 @@ Boolean incremental; } -Boolean XtOwnSelection(widget, selection, time, convert, lose, notify) -Widget widget; -Atom selection; -Time time; -XtConvertSelectionProc convert; -XtLoseSelectionProc lose; -XtSelectionDoneProc notify; +Boolean XtOwnSelection( + Widget widget, + Atom selection, + Time time, + XtConvertSelectionProc convert, + XtLoseSelectionProc lose, + XtSelectionDoneProc notify) { Boolean retval; WIDGET_TO_APPCON(widget); @@ -987,23 +984,22 @@ XtSelectionDoneProc notify; } -Boolean XtOwnSelectionIncremental(widget, selection, time, convert, - lose, notify, cancel, closure) -Widget widget; -Atom selection; -Time time; -XtConvertSelectionIncrProc convert; -XtLoseSelectionIncrProc lose; -XtSelectionDoneIncrProc notify; -XtCancelConvertSelectionProc cancel; -XtPointer closure; +Boolean XtOwnSelectionIncremental( + Widget widget, + Atom selection, + Time time, + XtConvertSelectionIncrProc convert, + XtLoseSelectionIncrProc lose, + XtSelectionDoneIncrProc notify, + XtCancelConvertSelectionProc cancel, + XtPointer closure) { Boolean retval; WIDGET_TO_APPCON(widget); LOCK_APP(app); - retval = OwnSelection(widget, selection, time, - (XtConvertSelectionProc)convert, + retval = OwnSelection(widget, selection, time, + (XtConvertSelectionProc)convert, (XtLoseSelectionProc)lose, (XtSelectionDoneProc)notify, cancel, closure, TRUE); @@ -1013,9 +1009,9 @@ XtPointer closure; void XtDisownSelection(widget, selection, time) -Widget widget; -Atom selection; -Time time; + Widget widget; + Atom selection; + Time time; { Select ctx; WIDGET_TO_APPCON(widget); @@ -1029,10 +1025,10 @@ Time time; /* Selection Requestor code */ -static Boolean IsINCRtype(info, window, prop) - CallBackInfo info; - Window window; - Atom prop; +static Boolean IsINCRtype( + CallBackInfo info, + Window window, + Atom prop) { unsigned long bytesafter; unsigned long length; @@ -1050,11 +1046,11 @@ static Boolean IsINCRtype(info, window, prop) } /*ARGSUSED*/ -static void ReqCleanup(widget, closure, ev, cont) -Widget widget; -XtPointer closure; -XEvent *ev; -Boolean *cont; +static void ReqCleanup( + Widget widget, + XtPointer closure, + XEvent *ev, + Boolean *cont) { CallBackInfo info = (CallBackInfo)closure; unsigned long bytesafter, length; @@ -1069,10 +1065,10 @@ Boolean *cont; ReqCleanup, (XtPointer) info ); if (IsINCRtype(info, XtWindow(widget), event->property)) { info->proc = HandleGetIncrement; - XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask, + XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask, FALSE, ReqCleanup, (XtPointer) info); } else { - if (event->property != None) + if (event->property != None) XDeleteProperty(event->display, XtWindow(widget), event->property); FreeSelectionProperty(XtDisplay(widget), info->property); @@ -1082,9 +1078,9 @@ Boolean *cont; (ev->xproperty.state == PropertyNewValue) && (ev->xproperty.atom == info->property)) { XPropertyEvent *event = (XPropertyEvent *) ev; - (void) XGetWindowProperty(event->display, XtWindow(widget), + (void) XGetWindowProperty(event->display, XtWindow(widget), event->atom, 0L, 1000000, True, AnyPropertyType, - &target, &format, &length, &bytesafter, + &target, &format, &length, &bytesafter, (unsigned char **) &value); XFree(value); if (length == 0) { @@ -1098,9 +1094,9 @@ Boolean *cont; } /* ARGSUSED */ -static void ReqTimedOut(closure, id) -XtPointer closure; -XtIntervalId *id; +static void ReqTimedOut( + XtPointer closure, + XtIntervalId *id) { XtPointer value = NULL; unsigned long length = 0; @@ -1115,45 +1111,45 @@ XtIntervalId *id; int i; if (*info->target == info->ctx->prop_list->indirect_atom) { - (void) XGetWindowProperty(XtDisplay(info->widget), + (void) XGetWindowProperty(XtDisplay(info->widget), XtWindow(info->widget), info->property, 0L, 10000000, True, AnyPropertyType, &type, &format, &proplength, &bytesafter, (unsigned char **) &pairs); XFree((char*)pairs); for (proplength = proplength / IndirectPairWordSize, i = 0, c = info->req_closure; - proplength; proplength--, c++, i++) - (*info->callbacks[i])(info->widget, *c, + proplength; proplength--, c++, i++) + (*info->callbacks[i])(info->widget, *c, &info->ctx->selection, &resulttype, value, &length, &format); } else { - (*info->callbacks[0])(info->widget, *info->req_closure, + (*info->callbacks[0])(info->widget, *info->req_closure, &info->ctx->selection, &resulttype, value, &length, &format); } /* change event handlers for straggler events */ if (info->proc == (XtEventHandler)HandleSelectionReplies) { - XtRemoveEventHandler(info->widget, (EventMask)0, + XtRemoveEventHandler(info->widget, (EventMask)0, TRUE, info->proc, (XtPointer) info); XtAddEventHandler(info->widget, (EventMask)0, TRUE, ReqCleanup, (XtPointer) info); } else { - XtRemoveEventHandler(info->widget,(EventMask) PropertyChangeMask, + XtRemoveEventHandler(info->widget,(EventMask) PropertyChangeMask, FALSE, info->proc, (XtPointer) info); - XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask, + XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask, FALSE, ReqCleanup, (XtPointer) info); } } /*ARGSUSED*/ -static void HandleGetIncrement(widget, closure, ev, cont) -Widget widget; -XtPointer closure; -XEvent *ev; -Boolean *cont; +static void HandleGetIncrement( + Widget widget, + XtPointer closure, + XEvent *ev, + Boolean *cont) { XPropertyEvent *event = (XPropertyEvent *) ev; CallBackInfo info = (CallBackInfo) closure; - Select ctx = info->ctx; + Select ctx = info->ctx; char *value; unsigned long bytesafter; unsigned long length; @@ -1165,23 +1161,23 @@ Boolean *cont; bad = XGetWindowProperty(event->display, XtWindow(widget), event->atom, 0L, - 10000000, True, AnyPropertyType, &info->type, - &info->format, &length, &bytesafter, + 10000000, True, AnyPropertyType, &info->type, + &info->format, &length, &bytesafter, (unsigned char **) &value); - if (bad) + if (bad) return; #ifndef DEBUG_WO_TIMERS - XtRemoveTimeOut(info->timeout); -#endif + XtRemoveTimeOut(info->timeout); +#endif if (length == 0) { unsigned long u_offset = NUMELEM(info->offset, info->format); - (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection, - &info->type, - (info->offset == 0 ? value : info->value), + (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection, + &info->type, + (info->offset == 0 ? value : info->value), &u_offset, &info->format); /* assert ((info->offset != 0) == (info->incremental[n]) */ if (info->offset != 0) XFree(value); - XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask, FALSE, + XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask, FALSE, HandleGetIncrement, (XtPointer) info); FreeSelectionProperty(event->display, info->property); FreeInfo(info); @@ -1194,7 +1190,7 @@ Boolean *cont; XFree(value); value = tmp; #endif - (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection, + (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection, &info->type, value, &length, &info->format); } else { int size = BYTELENGTH(length, info->format); @@ -1215,31 +1211,31 @@ Boolean *cont; info->timeout = XtAppAddTimeOut(app, app->selectionTimeout, ReqTimedOut, (XtPointer) info); } -#endif +#endif } } -static void HandleNone(widget, callback, closure, selection) -Widget widget; -XtSelectionCallbackProc callback; -XtPointer closure; -Atom selection; +static void HandleNone( + Widget widget, + XtSelectionCallbackProc callback, + XtPointer closure, + Atom selection) { unsigned long length = 0; int format = 8; Atom type = None; - (*callback)(widget, closure, &selection, + (*callback)(widget, closure, &selection, &type, NULL, &length, &format); } -static long IncrPropSize(widget, value, format, length) - Widget widget; - unsigned char* value; - int format; - unsigned long length; +static long IncrPropSize( + Widget widget, + unsigned char* value, + int format, + unsigned long length) { unsigned long size; if (format == 32) { @@ -1257,13 +1253,13 @@ static long IncrPropSize(widget, value, format, length) static -Boolean HandleNormal(dpy, widget, property, info, closure, selection) -Display *dpy; -Widget widget; -Atom property; -CallBackInfo info; -XtPointer closure; -Atom selection; +Boolean HandleNormal( + Display *dpy, + Widget widget, + Atom property, + CallBackInfo info, + XtPointer closure, + Atom selection) { unsigned long bytesafter; unsigned long length; @@ -1282,8 +1278,8 @@ Atom selection; if (info->property != property) { /* within MULTIPLE */ CallBackInfo ninfo; - ninfo = MakeInfo(info->ctx, &info->callbacks[number], - &info->req_closure[number], 1, widget, + ninfo = MakeInfo(info->ctx, &info->callbacks[number], + &info->req_closure[number], 1, widget, info->time, &info->incremental[number], &property); ninfo->target = (Atom *) __XtMalloc((unsigned) sizeof(Atom)); *ninfo->target = info->target[number + 1]; @@ -1303,7 +1299,7 @@ Atom selection; value = (unsigned char *) tmp; } #endif - (*info->callbacks[number])(widget, closure, &selection, + (*info->callbacks[number])(widget, closure, &selection, &type, (XtPointer)value, &length, &format); if (info->incremental[number]) { @@ -1316,16 +1312,16 @@ Atom selection; return TRUE; } -static void HandleIncremental(dpy, widget, property, info, size) -Display *dpy; -Widget widget; -Atom property; -CallBackInfo info; -unsigned long size; +static void HandleIncremental( + Display *dpy, + Widget widget, + Atom property, + CallBackInfo info, + unsigned long size) { XtAddEventHandler(widget, (EventMask) PropertyChangeMask, FALSE, HandleGetIncrement, (XtPointer) info); - + /* now start the transfer */ XDeleteProperty(dpy, XtWindow(widget), property); XFlush(dpy); @@ -1345,15 +1341,15 @@ unsigned long size; info->timeout = XtAppAddTimeOut(app, app->selectionTimeout, ReqTimedOut, (XtPointer) info); } -#endif +#endif } /*ARGSUSED*/ -static void HandleSelectionReplies(widget, closure, ev, cont) -Widget widget; -XtPointer closure; -XEvent *ev; -Boolean *cont; +static void HandleSelectionReplies( + Widget widget, + XtPointer closure, + XEvent *ev, + Boolean *cont) { XSelectionEvent *event = (XSelectionEvent *) ev; Display *dpy = event->display; @@ -1369,15 +1365,15 @@ Boolean *cont; if (event->type != SelectionNotify) return; if (!MATCH_SELECT(event, info)) return; /* not really for us */ #ifndef DEBUG_WO_TIMERS - XtRemoveTimeOut(info->timeout); -#endif + XtRemoveTimeOut(info->timeout); +#endif XtRemoveEventHandler(widget, (EventMask)0, TRUE, HandleSelectionReplies, (XtPointer) info ); if (event->target == ctx->prop_list->indirect_atom) { (void) XGetWindowProperty(dpy, XtWindow(widget), info->property, 0L, 10000000, True, AnyPropertyType, &type, &format, &length, &bytesafter, (unsigned char **) &pairs); - for (length = length / IndirectPairWordSize, p = pairs, + for (length = length / IndirectPairWordSize, p = pairs, c = info->req_closure; length; length--, p++, c++, info->current++) { if (event->property == None || format != 32 || p->target == None @@ -1387,7 +1383,7 @@ Boolean *cont; if (p->property != None) FreeSelectionProperty(XtDisplay(widget), p->property); } else { - if (HandleNormal(dpy, widget, p->property, info, *c, + if (HandleNormal(dpy, widget, p->property, info, *c, event->selection)) { FreeSelectionProperty(XtDisplay(widget), p->property); } @@ -1401,7 +1397,7 @@ Boolean *cont; FreeSelectionProperty(XtDisplay(widget), info->property); FreeInfo(info); } else { - if (HandleNormal(dpy, widget, event->property, info, + if (HandleNormal(dpy, widget, event->property, info, *info->req_closure, event->selection)) { FreeSelectionProperty(XtDisplay(widget), info->property); FreeInfo(info); @@ -1409,16 +1405,15 @@ Boolean *cont; } } -static void DoLocalTransfer(req, selection, target, widget, - callback, closure, incremental, property) -Request req; -Atom selection; -Atom target; -Widget widget; /* The widget requesting the value. */ -XtSelectionCallbackProc callback; -XtPointer closure; /* the closure for the callback, not the conversion */ -Boolean incremental; -Atom property; +static void DoLocalTransfer( + Request req, + Atom selection, + Atom target, + Widget widget, /* The widget requesting the value. */ + XtSelectionCallbackProc callback, + XtPointer closure, /* the closure for the callback, not the conversion */ + Boolean incremental, + Atom property) { Select ctx = req->ctx; XtPointer value = NULL, temp, total = NULL; @@ -1455,7 +1450,7 @@ Atom property; * they must return a value even if length==0 */ if (value == NULL) value = __XtMalloc((unsigned)1); - (*callback)(widget, closure, &selection, + (*callback)(widget, closure, &selection, &resulttype, value, &length, &format); if (length) { /* should owner be notified on end-of-piece? @@ -1472,29 +1467,29 @@ Atom property; } else { while (length) { int bytelength = BYTELENGTH(length, format); - total = XtRealloc(total, + total = XtRealloc(total, (unsigned) (totallength += bytelength)); (void) memmove((char*)total + totallength - bytelength, value, bytelength); (*(XtConvertSelectionIncrProc)ctx->convert) - (ctx->widget, &selection, &target, + (ctx->widget, &selection, &target, &resulttype, &value, &length, &format, &size, ctx->owner_closure, (XtRequestId*)&req); } if (total == NULL) total = __XtMalloc(1); - totallength = NUMELEM(totallength, format); - (*callback)(widget, closure, &selection, &resulttype, + totallength = NUMELEM(totallength, format); + (*callback)(widget, closure, &selection, &resulttype, total, &totallength, &format); } - if (ctx->notify) + if (ctx->notify) (*(XtSelectionDoneIncrProc)ctx->notify) - (ctx->widget, &selection, &target, + (ctx->widget, &selection, &target, (XtRequestId*)&req, ctx->owner_closure); else XtFree((char*)value); } } else { /* not incremental owner */ - if (!(*ctx->convert)(ctx->widget, &selection, &target, + if (!(*ctx->convert)(ctx->widget, &selection, &target, &resulttype, &value, &length, &format)) { HandleNone(widget, callback, closure, selection); } else { @@ -1506,7 +1501,7 @@ Atom property; value = temp; } if (value == NULL) value = __XtMalloc((unsigned)1); - (*callback)(widget, closure, &selection, &resulttype, + (*callback)(widget, closure, &selection, &resulttype, value, &length, &format); if (ctx->notify) (*ctx->notify)(ctx->widget, &selection, &target); @@ -1514,16 +1509,15 @@ Atom property; } } -static void GetSelectionValue(widget, selection, target, callback, - closure, time, incremental, property) -Widget widget; -Atom selection; -Atom target; -XtSelectionCallbackProc callback; -XtPointer closure; -Time time; -Boolean incremental; -Atom property; +static void GetSelectionValue( + Widget widget, + Atom selection, + Atom target, + XtSelectionCallbackProc callback, + XtPointer closure, + Time time, + Boolean incremental, + Atom property) { Select ctx; CallBackInfo info; @@ -1555,13 +1549,13 @@ Atom property; } -void XtGetSelectionValue(widget, selection, target, callback, closure, time) -Widget widget; -Atom selection; -Atom target; -XtSelectionCallbackProc callback; -XtPointer closure; -Time time; +void XtGetSelectionValue( + Widget widget, + Atom selection, + Atom target, + XtSelectionCallbackProc callback, + XtPointer closure, + Time time) { Atom property; Boolean incr = False; @@ -1582,14 +1576,13 @@ Time time; } -void XtGetSelectionValueIncremental(widget, selection, target, callback, - closure, time) -Widget widget; -Atom selection; -Atom target; -XtSelectionCallbackProc callback; -XtPointer closure; -Time time; +void XtGetSelectionValueIncremental( + Widget widget, + Atom selection, + Atom target, + XtSelectionCallbackProc callback, + XtPointer closure, + Time time) { Atom property; Boolean incr = TRUE; @@ -1603,7 +1596,7 @@ Time time; AddSelectionRequests(widget, selection, 1, &target, &callback, 1, &closure, &incr, &property); } else { - GetSelectionValue(widget, selection, target, callback, + GetSelectionValue(widget, selection, target, callback, closure, time, TRUE, property); } @@ -1611,19 +1604,17 @@ Time time; } -static void GetSelectionValues(widget, selection, targets, count, callbacks, - num_callbacks, closures, time, incremental, - properties) -Widget widget; -Atom selection; -Atom *targets; -int count; -XtSelectionCallbackProc *callbacks; -int num_callbacks; -XtPointer *closures; -Time time; -Boolean *incremental; -Atom *properties; +static void GetSelectionValues( + Widget widget, + Atom selection, + Atom *targets, + int count, + XtSelectionCallbackProc *callbacks, + int num_callbacks, + XtPointer *closures, + Time time, + Boolean *incremental, + Atom *properties) { Select ctx; CallBackInfo info; @@ -1643,7 +1634,7 @@ Atom *properties; if (j >= num_callbacks) j = 0; DoLocalTransfer(&req, selection, targets[i], widget, - callbacks[j], closures[i], incremental[i], + callbacks[j], closures[i], incremental[i], properties ? properties[i] : None); } @@ -1656,7 +1647,7 @@ Atom *properties; XtSelectionCallbackProc stack_cbs[32]; int i = 0, j = 0; - passed_callbacks = (XtSelectionCallbackProc *) + passed_callbacks = (XtSelectionCallbackProc *) XtStackAlloc(sizeof(XtSelectionCallbackProc) * count, stack_cbs); /* To deal with the old calls from XtGetSelectionValues* we @@ -1670,10 +1661,10 @@ Atom *properties; info = MakeInfo(ctx, passed_callbacks, closures, count, widget, time, incremental, properties); XtStackFree((XtPointer) passed_callbacks, stack_cbs); - + info->target = (Atom *)__XtMalloc((unsigned) ((count+1) * sizeof(Atom))); (*info->target) = ctx->prop_list->indirect_atom; - (void) memmove((char *) info->target+sizeof(Atom), (char *) targets, + (void) memmove((char *) info->target+sizeof(Atom), (char *) targets, count * sizeof(Atom)); pairs = (IndirectPair*)__XtMalloc((unsigned)(count*sizeof(IndirectPair))); for (p = &pairs[count-1], t = &targets[count-1], i = count - 1; @@ -1687,9 +1678,9 @@ Atom *properties; p->property = properties[i]; } } - XChangeProperty(XtDisplay(widget), XtWindow(widget), + XChangeProperty(XtDisplay(widget), XtWindow(widget), info->property, info->property, - 32, PropModeReplace, (unsigned char *) pairs, + 32, PropModeReplace, (unsigned char *) pairs, count * IndirectPairWordSize); XtFree((char*)pairs); RequestSelectionValue(info, selection, ctx->prop_list->indirect_atom); @@ -1697,15 +1688,14 @@ Atom *properties; } -void XtGetSelectionValues(widget, selection, targets, count, callback, - closures, time) -Widget widget; -Atom selection; -Atom *targets; -int count; -XtSelectionCallbackProc callback; -XtPointer *closures; -Time time; +void XtGetSelectionValues( + Widget widget, + Atom selection, + Atom *targets, + int count, + XtSelectionCallbackProc callback, + XtPointer *closures, + Time time) { Boolean incremental_values[32]; Boolean *incremental; @@ -1716,7 +1706,7 @@ Time time; incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values); for(i = 0; i < count; i++) incremental[i] = FALSE; if (IsGatheringRequest(widget, selection)) { - AddSelectionRequests(widget, selection, count, targets, &callback, + AddSelectionRequests(widget, selection, count, targets, &callback, 1, closures, incremental, NULL); } else { GetSelectionValues(widget, selection, targets, count, &callback, 1, @@ -1727,15 +1717,14 @@ Time time; } -void XtGetSelectionValuesIncremental(widget, selection, targets, count, - callback, closures, time) -Widget widget; -Atom selection; -Atom *targets; -int count; -XtSelectionCallbackProc callback; -XtPointer *closures; -Time time; +void XtGetSelectionValuesIncremental( + Widget widget, + Atom selection, + Atom *targets, + int count, + XtSelectionCallbackProc callback, + XtPointer *closures, + Time time) { Boolean incremental_values[32]; Boolean *incremental; @@ -1746,7 +1735,7 @@ Time time; incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values); for(i = 0; i < count; i++) incremental[i] = TRUE; if (IsGatheringRequest(widget, selection)) { - AddSelectionRequests(widget, selection, count, targets, &callback, + AddSelectionRequests(widget, selection, count, targets, &callback, 1, closures, incremental, NULL); } else { GetSelectionValues(widget, selection, targets, count, @@ -1757,11 +1746,11 @@ Time time; } -static Request GetRequestRecord(widget, selection, id) - Widget widget; - Atom selection; - XtRequestId id; -{ +static Request GetRequestRecord( + Widget widget, + Atom selection, + XtRequestId id) +{ Request req = (Request)id; Select ctx = NULL; @@ -1794,11 +1783,11 @@ static Request GetRequestRecord(widget, selection, id) return req; } -XSelectionRequestEvent *XtGetSelectionRequest(widget, selection, id) - Widget widget; - Atom selection; - XtRequestId id; -{ +XSelectionRequestEvent *XtGetSelectionRequest( + Widget widget, + Atom selection, + XtRequestId id) +{ Request req = (Request)id; WIDGET_TO_APPCON(widget); @@ -1810,7 +1799,7 @@ XSelectionRequestEvent *XtGetSelectionRequest(widget, selection, id) UNLOCK_APP(app); return (XSelectionRequestEvent*) NULL; } - + if (req->event.type == 0) { /* owner is local; construct the remainder of the event */ req->event.type = SelectionRequest; @@ -1825,15 +1814,15 @@ XSelectionRequestEvent *XtGetSelectionRequest(widget, selection, id) } /* Property atom access */ -Atom XtReservePropertyAtom(w) - Widget w; +Atom XtReservePropertyAtom( + Widget w) { return(GetSelectionProperty(XtDisplay(w))); } -void XtReleasePropertyAtom(w, atom) - Widget w; - Atom atom; +void XtReleasePropertyAtom( + Widget w, + Atom atom) { FreeSelectionProperty(XtDisplay(w), atom); } @@ -1841,23 +1830,22 @@ void XtReleasePropertyAtom(w, atom) /* Multiple utilities */ -/* All requests are put in a single list per widget. It is +/* All requests are put in a single list per widget. It is very unlikely anyone will be gathering multiple MULTIPLE requests at the same time, so the loss in efficiency for this case is acceptable */ /* Queue one or more requests to the one we're gathering */ -static void AddSelectionRequests(wid, sel, count, targets, callbacks, - num_cb, closures, incrementals, properties) - Widget wid; - Atom sel; - int count; - Atom *targets; - XtSelectionCallbackProc *callbacks; - int num_cb; - XtPointer *closures; - Boolean *incrementals; - Atom *properties; +static void AddSelectionRequests( + Widget wid, + Atom sel, + int count, + Atom *targets, + XtSelectionCallbackProc *callbacks, + int num_cb, + XtPointer *closures, + Boolean *incrementals, + Atom *properties) { QueuedRequestInfo qi; Window window = XtWindow(wid); @@ -1868,7 +1856,7 @@ static void AddSelectionRequests(wid, sel, count, targets, callbacks, qi = NULL; (void) XFindContext(dpy, window, multipleContext, (XPointer*) &qi); - + if (qi != NULL) { QueuedRequest *req = qi->requests; int start = qi->count; @@ -1876,11 +1864,11 @@ static void AddSelectionRequests(wid, sel, count, targets, callbacks, int j = 0; qi->count += count; - req = (QueuedRequest*) XtRealloc((char*) req, + req = (QueuedRequest*) XtRealloc((char*) req, (start + count) * sizeof(QueuedRequest)); while(i < count) { - QueuedRequest newreq = (QueuedRequest) + QueuedRequest newreq = (QueuedRequest) __XtMalloc(sizeof(QueuedRequestRec)); newreq->selection = sel; newreq->target = targets[i]; @@ -1911,9 +1899,9 @@ static void AddSelectionRequests(wid, sel, count, targets, callbacks, /* Only call IsGatheringRequest when we have a lock already */ -static Boolean IsGatheringRequest(wid, sel) - Widget wid; - Atom sel; +static Boolean IsGatheringRequest( + Widget wid, + Atom sel) { QueuedRequestInfo qi; Window window = XtWindow(wid); @@ -1925,7 +1913,7 @@ static Boolean IsGatheringRequest(wid, sel) qi = NULL; (void) XFindContext(dpy, window, multipleContext, (XPointer*) &qi); - + if (qi != NULL) { i = 0; while(qi->selections[i] != None) { @@ -1942,10 +1930,10 @@ static Boolean IsGatheringRequest(wid, sel) /* Cleanup request scans the request queue and releases any properties queued, and removes any requests queued */ -static void CleanupRequest(dpy, qi, sel) - Display *dpy; - QueuedRequestInfo qi; - Atom sel; +static void CleanupRequest( + Display *dpy, + QueuedRequestInfo qi, + Atom sel) { int i, j, n; @@ -1953,7 +1941,7 @@ static void CleanupRequest(dpy, qi, sel) /* Remove this selection from the list */ n = 0; - while(qi->selections[n] != sel && + while(qi->selections[n] != sel && qi->selections[n] != None) n++; if (qi->selections[n] == sel) { while(qi->selections[n] != None) { @@ -1981,9 +1969,9 @@ static void CleanupRequest(dpy, qi, sel) } } -extern void XtCreateSelectionRequest(widget, selection) - Widget widget; - Atom selection; +extern void XtCreateSelectionRequest( + Widget widget, + Atom selection) { QueuedRequestInfo queueInfo; Window window = XtWindow(widget); @@ -1997,7 +1985,7 @@ extern void XtCreateSelectionRequest(widget, selection) (void) XFindContext(dpy, window, multipleContext, (XPointer*) &queueInfo); /* If there is one, then cancel it */ - if (queueInfo != 0) + if (queueInfo != 0) CleanupRequest(dpy, queueInfo, selection); else { /* Create it */ @@ -2012,20 +2000,20 @@ extern void XtCreateSelectionRequest(widget, selection) /* Append this selection to list */ n = 0; while(queueInfo->selections[n] != None) n++; - queueInfo->selections = + queueInfo->selections = (Atom*) XtRealloc((char*) queueInfo->selections, (n + 2) * sizeof(Atom)); queueInfo->selections[n] = selection; queueInfo->selections[n + 1] = None; (void) XSaveContext(dpy, window, multipleContext, (char*) queueInfo); - UNLOCK_PROCESS; + UNLOCK_PROCESS; } -extern void XtSendSelectionRequest(widget, selection, time) - Widget widget; - Atom selection; - Time time; +extern void XtSendSelectionRequest( + Widget widget, + Atom selection, + Time time) { QueuedRequestInfo queueInfo; Window window = XtWindow(widget); @@ -2053,7 +2041,7 @@ extern void XtSendSelectionRequest(widget, selection, time) /* special case a multiple which isn't needed */ GetSelectionValue(widget, selection, req[i]->target, - req[i]->callback, req[i]->closure, time, + req[i]->callback, req[i]->closure, time, req[i]->incremental, req[i]->param); } else { Atom *targets; @@ -2071,7 +2059,7 @@ extern void XtSendSelectionRequest(widget, selection, time) /* Allocate */ targets = (Atom *) XtStackAlloc(count * sizeof(Atom), t); - cbs = (XtSelectionCallbackProc *) + cbs = (XtSelectionCallbackProc *) XtStackAlloc(count * sizeof(XtSelectionCallbackProc), c); closures = (XtPointer *) XtStackAlloc(count * sizeof(XtPointer), cs); incrs = (Boolean *) XtStackAlloc(count * sizeof(Boolean), ins); @@ -2100,16 +2088,16 @@ extern void XtSendSelectionRequest(widget, selection, time) XtStackFree((XtPointer) incrs, ins); XtStackFree((XtPointer) props, p); } - } + } } CleanupRequest(dpy, queueInfo, selection); - UNLOCK_PROCESS; + UNLOCK_PROCESS; } -extern void XtCancelSelectionRequest(widget, selection) - Widget widget; - Atom selection; +extern void XtCancelSelectionRequest( + Widget widget, + Atom selection) { QueuedRequestInfo queueInfo; Window window = XtWindow(widget); @@ -2121,9 +2109,9 @@ extern void XtCancelSelectionRequest(widget, selection) queueInfo = NULL; (void) XFindContext(dpy, window, multipleContext, (XPointer*) &queueInfo); /* If there is one, then cancel it */ - if (queueInfo != 0) + if (queueInfo != 0) CleanupRequest(dpy, queueInfo, selection); - UNLOCK_PROCESS; + UNLOCK_PROCESS; } /* Parameter utilities */ @@ -2132,13 +2120,13 @@ extern void XtCancelSelectionRequest(widget, selection) /* Places data on allocated parameter atom, then records the parameter atom data for use in the next call to one of the XtGetSelectionValue functions. */ -void XtSetSelectionParameters(requestor, selection, type, value, length, format) - Widget requestor; - Atom selection; - Atom type; - XtPointer value; - unsigned long length; - int format; +void XtSetSelectionParameters( + Widget requestor, + Atom selection, + Atom type, + XtPointer value, + unsigned long length, + int format) { Display *dpy = XtDisplay(requestor); Window window = XtWindow(requestor); @@ -2156,15 +2144,14 @@ void XtSetSelectionParameters(requestor, selection, type, value, length, format) /* Retrieves data passed in a parameter. Data for this is stored on the originator's window */ -void XtGetSelectionParameters(owner, selection, request_id, type_return, - value_return, length_return, format_return) - Widget owner; - Atom selection; - XtRequestId request_id; - Atom* type_return; - XtPointer* value_return; - unsigned long* length_return; - int* format_return; +void XtGetSelectionParameters( + Widget owner, + Atom selection, + XtRequestId request_id, + Atom* type_return, + XtPointer* value_return, + unsigned long* length_return, + int* format_return) { Request req; Display *dpy = XtDisplay(owner); @@ -2183,7 +2170,7 @@ void XtGetSelectionParameters(owner, selection, request_id, type_return, StartProtectedSection(dpy, req->requestor); XGetWindowProperty(dpy, req->requestor, req->property, 0L, 10000000, False, AnyPropertyType, type_return, format_return, - length_return, &bytes_after, + length_return, &bytes_after, (unsigned char**) value_return); EndProtectedSection(dpy); #ifdef XT_COPY_SELECTION @@ -2205,10 +2192,10 @@ void XtGetSelectionParameters(owner, selection, request_id, type_return, * context could be merged with other contexts used during selections. */ -static void AddParamInfo(w, selection, param_atom) - Widget w; - Atom selection; - Atom param_atom; +static void AddParamInfo( + Widget w, + Atom selection, + Atom param_atom) { int n; Param p; @@ -2247,9 +2234,9 @@ static void AddParamInfo(w, selection, param_atom) UNLOCK_PROCESS; } -static void RemoveParamInfo(w, selection) - Widget w; - Atom selection; +static void RemoveParamInfo( + Widget w, + Atom selection) { int n; Param p; @@ -2280,9 +2267,9 @@ static void RemoveParamInfo(w, selection) UNLOCK_PROCESS; } -static Atom GetParamInfo(w, selection) - Widget w; - Atom selection; +static Atom GetParamInfo( + Widget w, + Atom selection) { int n; Param p; diff --git a/src/SetValues.c b/src/SetValues.c index 60b6a62..32bb90a 100644 --- a/src/SetValues.c +++ b/src/SetValues.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -75,7 +75,7 @@ static void SetValues( Cardinal num_args) /* number of items in arg list */ { register ArgList arg; - register int i; + register Cardinal i; register XrmName argName; register XrmResourceList* xrmres; @@ -112,7 +112,7 @@ static Boolean CallSetValues ( superclass = class->core_class.superclass; UNLOCK_PROCESS; if (superclass) - redisplay = + redisplay = CallSetValues(superclass, current, request, new, args, num_args); LOCK_PROCESS; @@ -151,7 +151,7 @@ CallConstraintSetValues ( LOCK_PROCESS; superclass = (ConstraintWidgetClass) class->core_class.superclass; UNLOCK_PROCESS; - redisplay = + redisplay = CallConstraintSetValues(superclass, current, request, new, args, num_args); } @@ -163,12 +163,12 @@ CallConstraintSetValues ( return (redisplay); } -void XtSetSubvalues(base, resources, num_resources, args, num_args) - XtPointer base; /* Base address to write values to */ - register XtResourceList resources; /* The current resource values. */ - register Cardinal num_resources; /* number of items in resources */ - ArgList args; /* The resource values to set */ - Cardinal num_args; /* number of items in arg list */ +void XtSetSubvalues( + XtPointer base, /* Base address to write values to */ + register XtResourceList resources, /* The current resource values. */ + register Cardinal num_resources, /* number of items in resources */ + ArgList args, /* The resource values to set */ + Cardinal num_args) /* number of items in arg list */ { register XrmResourceList* xrmres; xrmres = _XtCreateIndirectionTable (resources, num_resources); @@ -177,10 +177,10 @@ void XtSetSubvalues(base, resources, num_resources, args, num_args) } -void XtSetValues(w, args, num_args) - register Widget w; - ArgList args; - Cardinal num_args; +void XtSetValues( + register Widget w, + ArgList args, + Cardinal num_args) { register Widget oldw, reqw; /* need to use strictest alignment rules possible in next two decls. */ @@ -236,12 +236,12 @@ void XtSetValues(w, args, num_args) UNLOCK_PROCESS; } else constraintSize = 0; } else constraintSize = 0; - + if (constraintSize) { /* Allocate and copy current constraints into oldw */ oldw->core.constraints = XtStackAlloc(constraintSize, oldcCache); reqw->core.constraints = XtStackAlloc(constraintSize, reqcCache); - (void) memmove((char *) oldw->core.constraints, + (void) memmove((char *) oldw->core.constraints, (char *) w->core.constraints, (int) constraintSize); /* Set constraint values */ @@ -250,7 +250,7 @@ void XtSetValues(w, args, num_args) (XrmResourceList *)(cwc->constraint_class.resources), cwc->constraint_class.num_resources, args, num_args); UNLOCK_PROCESS; - (void) memmove((char *) reqw->core.constraints, + (void) memmove((char *) reqw->core.constraints, (char *) w->core.constraints, (int) constraintSize); } @@ -271,8 +271,8 @@ void XtSetValues(w, args, num_args) call_data.type = XtHsetValues; call_data.widget = w; call_data.event_data = (XtPointer) &set_val; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } @@ -304,7 +304,7 @@ void XtSetValues(w, args, num_args) w->core.border_width = oldw->core.border_width; geoReq.request_mode |= CWBorderWidth; } - + if (geoReq.request_mode != 0) { /* Pass on any requests for unchanged geometry values */ if (geoReq.request_mode != @@ -334,7 +334,7 @@ void XtSetValues(w, args, num_args) } } CALLGEOTAT(_XtGeoTrace(w, - "\nXtSetValues sees some geometry changes for \"%s\".\n", + "\nXtSetValues sees some geometry changes for \"%s\".\n", XtName(w))); CALLGEOTAT(_XtGeoTab(1)); do { @@ -344,19 +344,19 @@ void XtSetValues(w, args, num_args) call_data.type = XtHpreGeometry; call_data.widget = w; call_data.request = &geoReq; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); call_data.result = result = _XtMakeGeometryRequest(w, &geoReq, &geoReply, &cleared_rect_obj); call_data.type = XtHpostGeometry; call_data.reply = &geoReply; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.geometryhook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.geometryhook_callbacks, (XtPointer)&call_data); } else { - result = _XtMakeGeometryRequest(w, &geoReq, &geoReply, + result = _XtMakeGeometryRequest(w, &geoReq, &geoReply, &cleared_rect_obj); } if (result == XtGeometryYes || result == XtGeometryDone) diff --git a/src/SetWMCW.c b/src/SetWMCW.c index 56ba936..44b0103 100644 --- a/src/SetWMCW.c +++ b/src/SetWMCW.c @@ -60,9 +60,10 @@ in this Software without prior written authorization from The Open Group. */ void -XtSetWMColormapWindows(widget, list, count) -Widget widget, *list; -Cardinal count; +XtSetWMColormapWindows( + Widget widget, + Widget *list, + Cardinal count) { Window *data; Widget *checked, *top, *temp, hookobj; @@ -81,7 +82,7 @@ Cardinal count; /* - * The specification calls for only adding the windows that have unique + * 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. * @@ -90,7 +91,7 @@ Cardinal count; for (checked_count = 0, i = 0; i < count; i++) { if (!XtIsRealized(list[i])) continue; - + *checked = list[i]; match = FALSE; @@ -99,7 +100,7 @@ Cardinal count; * to check it against. */ - if (checked != top) + if (checked != top) for (j = 0, temp = top; j < checked_count ; j++, temp++) if ( (*temp)->core.colormap == (*checked)->core.colormap) { match = TRUE; @@ -129,7 +130,7 @@ Cardinal count; xa_wm_colormap_windows = XInternAtom(XtDisplay(widget), "WM_COLORMAP_WINDOWS", FALSE); - XChangeProperty(XtDisplay(widget), XtWindow(widget), + XChangeProperty(XtDisplay(widget), XtWindow(widget), xa_wm_colormap_windows, XA_WINDOW, 32, PropModeReplace, (unsigned char *) data, (int) i); @@ -141,8 +142,8 @@ Cardinal count; call_data.widget = widget; call_data.event_data = (XtPointer) list; call_data.num_event_data = count; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } diff --git a/src/Shell.c b/src/Shell.c index 5d15625..12762d6 100644 --- a/src/Shell.c +++ b/src/Shell.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -100,15 +100,15 @@ in this Software without prior written authorization from The Open Group. ***************************************************************************/ #ifdef CRAY -void _XtShellDepth(); -void _XtShellColormap(); -void _XtShellAncestorSensitive(); -void _XtTitleEncoding(); +void _XtShellDepth(Widget, int, XrmValue *); +void _XtShellColormap(Widget, int, XrmValue *); +void _XtShellAncestorSensitive(Widget, int, XrmValue *); +void _XtTitleEncoding(Widget, int, XrmValue *); #else -static void _XtShellDepth(); -static void _XtShellColormap(); -static void _XtShellAncestorSensitive(); -static void _XtTitleEncoding(); +static void _XtShellDepth(Widget, int, XrmValue *); +static void _XtShellColormap(Widget, int, XrmValue *); +static void _XtShellAncestorSensitive(Widget, int, XrmValue *); +static void _XtTitleEncoding(Widget, int, XrmValue *); #endif /*************************************************************************** @@ -134,7 +134,7 @@ static XtResource shellResources[]= { XtNallowShellResize, XtCAllowShellResize, XtRBoolean, sizeof(Boolean), Offset(shell.allow_shell_resize), XtRImmediate, (XtPointer)False}, - { XtNgeometry, XtCGeometry, XtRString, sizeof(String), + { XtNgeometry, XtCGeometry, XtRString, sizeof(String), Offset(shell.geometry), XtRString, (XtPointer)NULL}, { XtNcreatePopupChildProc, XtCCreatePopupChildProc, XtRFunction, sizeof(XtCreatePopupChildProc), Offset(shell.create_popup_child_proc), @@ -152,14 +152,16 @@ static XtResource shellResources[]= Offset(shell.visual), XtRImmediate, CopyFromParent} }; -static void ClassPartInitialize(), Initialize(); -static void Realize(); -static void Resize(); -static Boolean SetValues(); -static void GetValuesHook(); -static void ChangeManaged(); /* XXX */ -static XtGeometryResult GeometryManager(), RootGeometryManager(); -static void Destroy(); +static void ClassPartInitialize(WidgetClass); +static void Initialize(Widget, Widget, ArgList, Cardinal *); +static void Realize(Widget, Mask *, XSetWindowAttributes *); +static void Resize(Widget); +static Boolean SetValues(Widget, Widget, Widget, ArgList , Cardinal *); +static void GetValuesHook(Widget, ArgList, Cardinal*); +static void ChangeManaged(Widget); +static XtGeometryResult GeometryManager(Widget, XtWidgetGeometry *, XtWidgetGeometry *); +static XtGeometryResult RootGeometryManager(Widget gw, XtWidgetGeometry *request, XtWidgetGeometry *reply); +static void Destroy(Widget); static ShellClassExtensionRec shellClassExtRec = { NULL, @@ -178,7 +180,7 @@ externaldef(shellclassrec) ShellClassRec shellClassRec = { /* class_part_initialize*/ ClassPartInitialize, /* Class init'ed ? */ FALSE, /* initialize */ Initialize, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, @@ -193,8 +195,8 @@ externaldef(shellclassrec) ShellClassRec shellClassRec = { /* resize */ Resize, /* expose */ NULL, /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ GetValuesHook, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, @@ -240,7 +242,7 @@ externaldef(overrideshellclassrec) OverrideShellClassRec overrideShellClassRec = /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ NULL, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -255,9 +257,9 @@ externaldef(overrideshellclassrec) OverrideShellClassRec overrideShellClassRec = /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -278,7 +280,7 @@ externaldef(overrideshellclassrec) OverrideShellClassRec overrideShellClassRec = } }; -externaldef(overrideshellwidgetclass) WidgetClass overrideShellWidgetClass = +externaldef(overrideshellwidgetclass) WidgetClass overrideShellWidgetClass = (WidgetClass) (&overrideShellClassRec); /*************************************************************************** @@ -317,7 +319,7 @@ static XtResource wmResources[]= Offset(wm.base_height), XtRInt, (XtPointer) &default_unspecified_shell_int}, { XtNwinGravity, XtCWinGravity, XtRGravity, sizeof(int), - Offset(wm.win_gravity), + Offset(wm.win_gravity), XtRGravity, (XtPointer) &default_unspecified_shell_int}, { XtNminWidth, XtCMinWidth, XtRInt, sizeof(int), Offset(wm.size_hints.min_width), @@ -378,9 +380,9 @@ static XtResource wmResources[]= Offset(wm.urgency), XtRImmediate, (XtPointer) False} }; -static void WMInitialize(); -static Boolean WMSetValues(); -static void WMDestroy(); +static void WMInitialize(Widget, Widget, ArgList, Cardinal *); +static Boolean WMSetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void WMDestroy(Widget); externaldef(wmshellclassrec) WMShellClassRec wmShellClassRec = { { @@ -391,7 +393,7 @@ externaldef(wmshellclassrec) WMShellClassRec wmShellClassRec = { /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ WMInitialize, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -406,9 +408,9 @@ externaldef(wmshellclassrec) WMShellClassRec wmShellClassRec = { /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ WMSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -450,8 +452,8 @@ static XtResource transientResources[]= Offset(shell.save_under), XtRImmediate, (XtPointer)True}, }; -static void TransientRealize(); -static Boolean TransientSetValues(); +static void TransientRealize(Widget, Mask *, XSetWindowAttributes *); +static Boolean TransientSetValues(Widget, Widget, Widget, ArgList, Cardinal *); externaldef(transientshellclassrec) TransientShellClassRec transientShellClassRec = { { @@ -462,7 +464,7 @@ externaldef(transientshellclassrec) TransientShellClassRec transientShellClassRe /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ NULL, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ TransientRealize, /* actions */ NULL, /* num_actions */ 0, @@ -477,9 +479,9 @@ externaldef(transientshellclassrec) TransientShellClassRec transientShellClassRe /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ TransientSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -527,9 +529,9 @@ static XtResource topLevelResources[]= Offset(topLevel.iconic), XtRImmediate, (XtPointer)False} }; -static void TopLevelInitialize(); -static Boolean TopLevelSetValues(); -static void TopLevelDestroy(); +static void TopLevelInitialize(Widget, Widget, ArgList, Cardinal *); +static Boolean TopLevelSetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void TopLevelDestroy(Widget); externaldef(toplevelshellclassrec) TopLevelShellClassRec topLevelShellClassRec = { { @@ -540,7 +542,7 @@ externaldef(toplevelshellclassrec) TopLevelShellClassRec topLevelShellClassRec = /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ TopLevelInitialize, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -555,9 +557,9 @@ externaldef(toplevelshellclassrec) TopLevelShellClassRec topLevelShellClassRec = /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ TopLevelSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -597,16 +599,16 @@ externaldef(toplevelshellwidgetclass) WidgetClass topLevelShellWidgetClass = static XtResource applicationResources[]= { {XtNargc, XtCArgc, XtRInt, sizeof(int), - Offset(application.argc), XtRImmediate, (XtPointer)0}, + Offset(application.argc), XtRImmediate, (XtPointer)0}, {XtNargv, XtCArgv, XtRStringArray, sizeof(String*), Offset(application.argv), XtRPointer, (XtPointer) NULL} }; #undef Offset -static void ApplicationInitialize(); -static void ApplicationDestroy(); -static Boolean ApplicationSetValues(); -static void ApplicationShellInsertChild(); +static void ApplicationInitialize(Widget, Widget, ArgList, Cardinal *); +static void ApplicationDestroy(Widget); +static Boolean ApplicationSetValues(Widget, Widget, Widget, ArgList, Cardinal *); +static void ApplicationShellInsertChild(Widget); static CompositeClassExtensionRec compositeClassExtension = { /* next_extension */ NULL, @@ -627,7 +629,7 @@ externaldef(applicationshellclassrec) ApplicationShellClassRec applicationShellC /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ ApplicationInitialize, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -642,9 +644,9 @@ externaldef(applicationshellclassrec) ApplicationShellClassRec applicationShellC /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ ApplicationSetValues, - /* set_values_hook */ NULL, + /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -727,9 +729,9 @@ static XtResource sessionResources[]= }; #undef Offset -static void SessionInitialize(); -static void SessionDestroy(); -static Boolean SessionSetValues(); +static void SessionInitialize(Widget, Widget, ArgList, Cardinal *); +static void SessionDestroy(Widget); +static Boolean SessionSetValues(Widget, Widget, Widget, ArgList, Cardinal *); static CompositeClassExtensionRec sessionCompositeClassExtension = { /* next_extension */ NULL, @@ -750,7 +752,7 @@ externaldef(sessionshellclassrec) SessionShellClassRec sessionShellClassRec = { /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ SessionInitialize, - /* initialize_notify */ NULL, + /* initialize_notify */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, @@ -765,7 +767,7 @@ externaldef(sessionshellclassrec) SessionShellClassRec sessionShellClassRec = { /* resize */ XtInheritResize, /* expose */ NULL, /* set_values */ SessionSetValues, - /* set_values_hook */ NULL, + /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, @@ -803,9 +805,9 @@ externaldef(sessionshellwidgetclass) WidgetClass sessionShellWidgetClass = * Whew! ****************************************************************************/ -static void ComputeWMSizeHints(w, hints) - WMShellWidget w; - XSizeHints *hints; +static void ComputeWMSizeHints( + WMShellWidget w, + XSizeHints *hints) { register long flags; hints->flags = flags = w->wm.size_hints.flags; @@ -847,8 +849,8 @@ static void ComputeWMSizeHints(w, hints) #undef copy } -static void _SetWMSizeHints(w) - WMShellWidget w; +static void _SetWMSizeHints( + WMShellWidget w) { XSizeHints *size_hints = XAllocSizeHints(); @@ -858,8 +860,8 @@ static void _SetWMSizeHints(w) XFree((char*)size_hints); } -static ShellClassExtension _FindClassExtension(widget_class) - WidgetClass widget_class; +static ShellClassExtension _FindClassExtension( + WidgetClass widget_class) { ShellClassExtension ext; for (ext = (ShellClassExtension)((ShellWidgetClass)widget_class) @@ -884,8 +886,7 @@ static ShellClassExtension _FindClassExtension(widget_class) return ext; } -static void ClassPartInitialize(widget_class) - WidgetClass widget_class; +static void ClassPartInitialize(WidgetClass widget_class) { ShellClassExtension ext = _FindClassExtension(widget_class); if (ext != NULL) { @@ -908,15 +909,15 @@ static void ClassPartInitialize(widget_class) } -static void EventHandler(); -static void _popup_set_prop(); +static void EventHandler(Widget wid, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); +static void _popup_set_prop(ShellWidget); /*ARGSUSED*/ -static void XtCopyDefaultDepth(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +static void XtCopyDefaultDepth( + Widget widget, + int offset, + XrmValue *value) { value->addr = (XPointer)(&DefaultDepthOfScreen(XtScreenOfObject(widget))); } @@ -924,20 +925,20 @@ static void XtCopyDefaultDepth(widget, offset, value) #ifndef CRAY static #endif -void _XtShellDepth(widget,closure,value) - Widget widget; - int closure; - XrmValue *value; +void _XtShellDepth( + Widget widget, + int closure, + XrmValue *value) { if (widget->core.parent == NULL) XtCopyDefaultDepth(widget,closure,value); else _XtCopyFromParent (widget,closure,value); } /*ARGSUSED*/ -static void XtCopyDefaultColormap(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +static void XtCopyDefaultColormap( + Widget widget, + int offset, + XrmValue *value) { value->addr = (XPointer)(&DefaultColormapOfScreen(XtScreenOfObject(widget))); } @@ -945,10 +946,10 @@ static void XtCopyDefaultColormap(widget, offset, value) #ifndef CRAY static #endif -void _XtShellColormap(widget,closure,value) - Widget widget; - int closure; - XrmValue *value; +void _XtShellColormap( + Widget widget, + int closure, + XrmValue *value) { if (widget->core.parent == NULL) XtCopyDefaultColormap(widget,closure,value); @@ -958,10 +959,10 @@ void _XtShellColormap(widget,closure,value) #ifndef CRAY static #endif -void _XtShellAncestorSensitive(widget,closure,value) - Widget widget; - int closure; - XrmValue *value; +void _XtShellAncestorSensitive( + Widget widget, + int closure, + XrmValue *value) { static Boolean true = True; if (widget->core.parent == NULL) value->addr = (XPointer)(&true); @@ -972,10 +973,10 @@ void _XtShellAncestorSensitive(widget,closure,value) #ifndef CRAY static #endif -void _XtTitleEncoding(widget, offset, value) - Widget widget; - int offset; - XrmValue *value; +void _XtTitleEncoding( + Widget widget, + int offset, + XrmValue *value) { static Atom atom; if (XtWidgetToApplicationContext(widget)->langProcRec.proc) atom = None; @@ -985,10 +986,11 @@ void _XtTitleEncoding(widget, offset, value) /* ARGSUSED */ -static void Initialize(req, new, args, num_args) - Widget req, new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static void Initialize( + Widget req, + Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { ShellWidget w = (ShellWidget) new; @@ -1008,16 +1010,16 @@ static void Initialize(req, new, args, num_args) TRUE, EventHandler, (XtPointer) NULL); #ifdef EDITRES - XtAddEventHandler(new, (EventMask) 0, TRUE, + XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); #endif } /* ARGSUSED */ -static void WMInitialize(req, new, args, num_args) - Widget req,new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static void WMInitialize( + Widget req, Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { WMShellWidget w = (WMShellWidget) new; TopLevelShellWidget tls = (TopLevelShellWidget) new; /* maybe */ @@ -1041,10 +1043,10 @@ static void WMInitialize(req, new, args, num_args) /* ARGSUSED */ -static void TopLevelInitialize(req, new, args, num_args) - Widget req, new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static void TopLevelInitialize( + Widget req, Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { TopLevelShellWidget w = (TopLevelShellWidget) new; @@ -1058,15 +1060,15 @@ static void TopLevelInitialize(req, new, args, num_args) w->wm.wm_hints.initial_state = IconicState; } -static String *NewArgv(); -static String *NewStringArray(); -static void FreeStringArray(); +static String *NewArgv(int, String *); +static String *NewStringArray(String *); +static void FreeStringArray(String *); /* ARGSUSED */ -static void ApplicationInitialize(req, new, args, num_args) - Widget req, new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static void ApplicationInitialize( + Widget req, Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { ApplicationShellWidget w = (ApplicationShellWidget)new; @@ -1090,9 +1092,9 @@ static void ApplicationInitialize(req, new, args, num_args) #define XtRestartStyleHintMask (1L<<7) #define XtShutdownCommandMask (1L<<8) -static void JoinSession(); -static void SetSessionProperties(); -static void StopManagingSession(); +static void JoinSession(SessionShellWidget); +static void SetSessionProperties(SessionShellWidget, Boolean, unsigned long, unsigned long); +static void StopManagingSession(SessionShellWidget, SmcConn); typedef struct _XtSaveYourselfRec { XtSaveYourself next; @@ -1101,7 +1103,7 @@ typedef struct _XtSaveYourselfRec { Boolean shutdown; Boolean fast; Boolean cancel_shutdown; - int phase; + int phase; int interact_dialog_type; Boolean request_cancel; Boolean request_next_phase; @@ -1111,10 +1113,10 @@ typedef struct _XtSaveYourselfRec { } XtSaveYourselfRec; /* ARGSUSED */ -static void SessionInitialize(req, new, args, num_args) - Widget req, new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static void SessionInitialize( + Widget req, Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { #ifndef XT_NO_SM SessionShellWidget w = (SessionShellWidget)new; @@ -1123,7 +1125,7 @@ static void SessionInitialize(req, new, args, num_args) XtNewString(w->session.session_id); if (w->session.restart_command) w->session.restart_command = NewStringArray(w->session.restart_command); - if (w->session.clone_command) w->session.clone_command = + if (w->session.clone_command) w->session.clone_command = NewStringArray(w->session.clone_command); if (w->session.discard_command) w->session.discard_command = NewStringArray(w->session.discard_command); @@ -1135,7 +1137,7 @@ static void SessionInitialize(req, new, args, num_args) NewStringArray(w->session.environment); if (w->session.current_dir) w->session.current_dir = XtNewString(w->session.current_dir); - if (w->session.program_path) w->session.program_path = + if (w->session.program_path) w->session.program_path = XtNewString(w->session.program_path); w->session.checkpoint_state = XtSaveInactive; @@ -1151,12 +1153,12 @@ static void SessionInitialize(req, new, args, num_args) #endif /* !XT_NO_SM */ } -static void Resize(w) - Widget w; +static void Resize( + Widget w) { - register ShellWidget sw = (ShellWidget)w; + register ShellWidget sw = (ShellWidget)w; Widget childwid; - int i; + Cardinal i; for(i = 0; i < sw->composite.num_children; i++) { if (XtIsManaged(sw->composite.children[i])) { childwid = sw->composite.children[i]; @@ -1167,12 +1169,12 @@ static void Resize(w) } } -static void GetGeometry(); +static void GetGeometry(Widget, Widget); -static void Realize(wid, vmask, attr) - Widget wid; - Mask *vmask; - XSetWindowAttributes *attr; +static void Realize( + Widget wid, + Mask *vmask, + XSetWindowAttributes *attr) { ShellWidget w = (ShellWidget) wid; Mask mask = *vmask; @@ -1206,8 +1208,8 @@ static void Realize(wid, vmask, attr) w->core.background_pixmap = (*childP)->core.background_pixmap; } else { - attr->background_pixel = - w->core.background_pixel = + attr->background_pixel = + w->core.background_pixel = (*childP)->core.background_pixel; } break; @@ -1240,9 +1242,9 @@ static void Realize(wid, vmask, attr) } -static void _SetTransientForHint(w, delete) - TransientShellWidget w; - Boolean delete; +static void _SetTransientForHint( + TransientShellWidget w, + Boolean delete) { Window window_group; @@ -1268,15 +1270,15 @@ static void _SetTransientForHint(w, delete) } -static void TransientRealize(w, vmask, attr) - Widget w; - Mask *vmask; - XSetWindowAttributes *attr; +static void TransientRealize( + Widget w, + Mask *vmask, + XSetWindowAttributes *attr) { XtRealizeProc realize; LOCK_PROCESS; - realize = + realize = transientShellWidgetClass->core_class.superclass->core_class.realize; UNLOCK_PROCESS; (*realize) (w, vmask, attr); @@ -1284,9 +1286,9 @@ static void TransientRealize(w, vmask, attr) _SetTransientForHint((TransientShellWidget)w, False); } -static Widget GetClientLeader(w) - Widget w; -{ +static Widget GetClientLeader( + Widget w) +{ while ((! XtIsWMShell(w) || ! ((WMShellWidget)w)->wm.client_leader) && w->core.parent) w = w->core.parent; @@ -1298,8 +1300,8 @@ static Widget GetClientLeader(w) return w; } -static void EvaluateWMHints(w) - WMShellWidget w; +static void EvaluateWMHints( + WMShellWidget w) { XWMHints *hintp = &w->wm.wm_hints; @@ -1335,8 +1337,8 @@ static void EvaluateWMHints(w) } -static void EvaluateSizeHints(w) - WMShellWidget w; +static void EvaluateSizeHints( + WMShellWidget w) { struct _OldXSizeHints *sizep = &w->wm.size_hints; @@ -1397,8 +1399,8 @@ static void EvaluateSizeHints(w) } } -static void _popup_set_prop(w) - ShellWidget w; +static void _popup_set_prop( + ShellWidget w) { Widget p; WMShellWidget wmshell = (WMShellWidget) w; @@ -1520,7 +1522,7 @@ static void _popup_set_prop(w) if (p == (Widget) w) { for ( ; p->core.parent != NULL; p = p->core.parent); if (XtIsSubclass(p, sessionShellWidgetClass)) { - String sm_client_id = + String sm_client_id = ((SessionShellWidget)p)->session.session_id; if (sm_client_id != NULL) { XChangeProperty(XtDisplay((Widget)w), XtWindow((Widget)w), @@ -1544,11 +1546,11 @@ static void _popup_set_prop(w) } /* ARGSUSED */ -static void EventHandler(wid, closure, event, continue_to_dispatch) - Widget wid; - XtPointer closure; /* unused */ - XEvent *event; - Boolean *continue_to_dispatch; /* unused */ +static void EventHandler( + Widget wid, + XtPointer closure, /* unused */ + XEvent *event, + Boolean *continue_to_dispatch) /* unused */ { register ShellWidget w = (ShellWidget) wid; WMShellWidget wmshell = (WMShellWidget) w; @@ -1592,19 +1594,19 @@ static void EventHandler(wid, closure, event, continue_to_dispatch) wmshell->wm.wait_for_wm = TRUE; } #undef EQ - } + } break; case ReparentNotify: if (event->xreparent.window == XtWindow(w)) { if (event->xreparent.parent != RootWindowOfScreen(XtScreen(w))) - w->shell.client_specified &= + w->shell.client_specified &= ~(_XtShellNotReparented | _XtShellPositionValid); else { w->core.x = event->xreparent.x; w->core.y = event->xreparent.y; - w->shell.client_specified |= + w->shell.client_specified |= (_XtShellNotReparented | _XtShellPositionValid); } } @@ -1624,7 +1626,7 @@ static void EventHandler(wid, closure, event, continue_to_dispatch) if (XtIsTopLevelShell(wid)) ((TopLevelShellWidget)wid)->topLevel.iconic = TRUE; - + pdi = _XtGetPerDisplayInput(event->xunmap.display); device = &pdi->pointer; @@ -1651,7 +1653,7 @@ static void EventHandler(wid, closure, event, continue_to_dispatch) } default: return; - } + } { XtWidgetProc resize; @@ -1661,22 +1663,22 @@ static void EventHandler(wid, closure, event, continue_to_dispatch) if (sizechanged && resize) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "Shell \"%s\" is being resized to %d %d.\n", + "Shell \"%s\" is being resized to %d %d.\n", XtName(wid), wid->core.width, wid->core.height )); (*resize)(wid); } } } -static void Destroy(wid) - Widget wid; +static void Destroy( + Widget wid) { if (XtIsRealized(wid)) XDestroyWindow( XtDisplay(wid), XtWindow(wid) ); } -static void WMDestroy(wid) - Widget wid; +static void WMDestroy( + Widget wid) { WMShellWidget w = (WMShellWidget) wid; @@ -1684,24 +1686,24 @@ static void WMDestroy(wid) XtFree((char *) w->wm.window_role); } -static void TopLevelDestroy(wid) - Widget wid; +static void TopLevelDestroy( + Widget wid) { TopLevelShellWidget w = (TopLevelShellWidget) wid; XtFree((char *) w->topLevel.icon_name); } -static void ApplicationDestroy(wid) - Widget wid; +static void ApplicationDestroy( + Widget wid) { ApplicationShellWidget w = (ApplicationShellWidget) wid; if (w->application.argc > 0) FreeStringArray(w->application.argv); } -static void SessionDestroy(wid) - Widget wid; +static void SessionDestroy( + Widget wid) { #ifndef XT_NO_SM SessionShellWidget w = (SessionShellWidget) wid; @@ -1725,8 +1727,8 @@ static void SessionDestroy(wid) * match the child before parsing the geometry resource. * */ -static void GetGeometry(W, child) - Widget W, child; +static void GetGeometry( + Widget W, Widget child) { register ShellWidget w = (ShellWidget)W; Boolean is_wmshell = XtIsWMShell(W); @@ -1749,7 +1751,7 @@ static void GetGeometry(W, child) if (is_wmshell) { WMShellPart* wm = &((WMShellWidget)w)->wm; EvaluateSizeHints((WMShellWidget)w); - (void) memmove((char*)&hints, (char*)&wm->size_hints, + (void) memmove((char*)&hints, (char*)&wm->size_hints, sizeof(struct _OldXSizeHints)); hints.win_gravity = wm->win_gravity; if (wm->size_hints.flags & PBaseSize) { @@ -1815,12 +1817,11 @@ static void GetGeometry(W, child) } -static void ChangeManaged(wid) - Widget wid; +static void ChangeManaged(Widget wid) { ShellWidget w = (ShellWidget) wid; Widget child = NULL; - int i; + Cardinal i; for (i = 0; i < w->composite.num_children; i++) { if (XtIsManaged(w->composite.children[i])) { @@ -1844,12 +1845,12 @@ static void ChangeManaged(wid) * it is possible that some time in the future the request will be * asynchronusly denied and the window reverted to it's old size/shape. */ - + /*ARGSUSED*/ -static XtGeometryResult GeometryManager( wid, request, reply ) - Widget wid; - XtWidgetGeometry *request; - XtWidgetGeometry *reply; +static XtGeometryResult GeometryManager( + Widget wid, + XtWidgetGeometry *request, + XtWidgetGeometry *reply) { ShellWidget shell = (ShellWidget)(wid->core.parent); XtWidgetGeometry my_request; @@ -1883,7 +1884,7 @@ static XtGeometryResult GeometryManager( wid, request, reply ) * so, whatever the WM sized us to (if the Shell requested * only one of the two) is now the correct child size */ - + if (!(request->request_mode & XtCWQueryOnly)) { wid->core.width = shell->core.width; wid->core.height = shell->core.height; @@ -1901,14 +1902,14 @@ typedef struct { Boolean done; } QueryStruct; -static Bool isMine(dpy, event, arg) - Display *dpy; - register XEvent *event; - char *arg; +static Bool isMine( + Display *dpy, + register XEvent *event, + char *arg) { QueryStruct *q = (QueryStruct *) arg; register Widget w = q->w; - + if ( (dpy != XtDisplay(w)) || (event->xany.window != XtWindow(w)) ) { return FALSE; } @@ -1916,7 +1917,7 @@ static Bool isMine(dpy, event, arg) if (event->type == ConfigureNotify) { q->done = TRUE; return TRUE; - } + } } else if (event->type == ConfigureNotify) return TRUE; /* flush old events */ @@ -1934,10 +1935,10 @@ static Bool isMine(dpy, event, arg) return FALSE; } -static Boolean _wait_for_response(w, event, request_num) - ShellWidget w; - XEvent *event; - unsigned long request_num; +static Boolean _wait_for_response( + ShellWidget w, + XEvent *event, + unsigned long request_num) { XtAppContext app = XtWidgetToApplicationContext((Widget) w); QueryStruct q; @@ -1959,13 +1960,13 @@ static Boolean _wait_for_response(w, event, request_num) while (XCheckIfEvent(XtDisplay(w),event,isMine,(char*)&q)) { if (q.done) return TRUE; } - + while (timeout > 0) { - if (_XtWaitForSomething (app, - FALSE, TRUE, TRUE, TRUE, - TRUE, + if (_XtWaitForSomething (app, + FALSE, TRUE, TRUE, TRUE, + TRUE, #ifdef XTHREADS - FALSE, + FALSE, #endif &timeout) != -1) { while (XCheckIfEvent(XtDisplay(w),event,isMine,(char*)&q)) { @@ -1977,9 +1978,9 @@ static Boolean _wait_for_response(w, event, request_num) } /*ARGSUSED*/ -static XtGeometryResult RootGeometryManager(gw, request, reply) - Widget gw; - XtWidgetGeometry *request, *reply; +static XtGeometryResult RootGeometryManager( + Widget gw, + XtWidgetGeometry *request, XtWidgetGeometry *reply) { register ShellWidget w = (ShellWidget)gw; XWindowChanges values; @@ -1991,7 +1992,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) unsigned long request_num; CALLGEOTAT(_XtGeoTab(1)); - + if (XtIsWMShell(gw)) { wm = True; hintp = &((WMShellWidget)w)->wm.size_hints; @@ -2003,7 +2004,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) hintp->height = w->core.height; } else wm = False; - + oldx = w->core.x; oldy = w->core.y; oldwidth = w->core.width; @@ -2077,7 +2078,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) if (!XtIsRealized((Widget)w)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "Shell \"%s\" is not realized, return XtGeometryYes.\n", + "Shell \"%s\" is not realized, return XtGeometryYes.\n", XtName((Widget)w))); CALLGEOTAT(_XtGeoTab(-1)); return XtGeometryYes; @@ -2098,7 +2099,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) "border_width = %d\n",values.border_width));} #endif CALLGEOTAT(_XtGeoTab(-1)); - + XConfigureWindow(XtDisplay((Widget)w), XtWindow((Widget)w), mask,&values); if (wm && !w->shell.override_redirect @@ -2120,12 +2121,12 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) if (wm && ((WMShellWidget)w)->wm.wait_for_wm == FALSE) { /* the window manager is sick - * so I will do the work and + * so I will do the work and * say no so if a new WM starts up, * or the current one recovers * my size requests will be visible */ - CALLGEOTAT(_XtGeoTrace((Widget)w,"Shell \"%s\" has wait_for_wm == FALSE, return XtGeometryNo.\n", + CALLGEOTAT(_XtGeoTrace((Widget)w,"Shell \"%s\" has wait_for_wm == FALSE, return XtGeometryNo.\n", XtName((Widget)w))); CALLGEOTAT(_XtGeoTab(-1)); @@ -2137,7 +2138,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) /* got an event */ if (event.type == ConfigureNotify) { -#define NEQ(x, msk) ((mask & msk) && (values.x != event.xconfigure.x)) +#define NEQ(x, msk) ((mask & msk) && (values.x != event.xconfigure.x)) if (NEQ(x, CWX) || NEQ(y, CWY) || NEQ(width, CWWidth) || @@ -2146,27 +2147,27 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) #ifdef XT_GEO_TATTLER if (NEQ(x, CWX)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "received Configure X %d\n", + "received Configure X %d\n", event.xconfigure.x)); } if (NEQ(y, CWY)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "received Configure Y %d\n", + "received Configure Y %d\n", event.xconfigure.y)); } if (NEQ(width, CWWidth)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "received Configure Width %d\n", + "received Configure Width %d\n", event.xconfigure.width)); } if (NEQ(height, CWHeight)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "received Configure Height %d\n", + "received Configure Height %d\n", event.xconfigure.height)); } if (NEQ(border_width, CWBorderWidth)) { CALLGEOTAT(_XtGeoTrace((Widget)w, - "received Configure BorderWidth %d\n", + "received Configure BorderWidth %d\n", event.xconfigure.border_width)); } #endif @@ -2213,7 +2214,7 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) "internalError", "shell", XtCXtToolkitError, "Shell's window manager interaction is broken", (String *)NULL, (Cardinal *)NULL); - } else if (wm) { /* no event */ + } else if (wm) { /* no event */ ((WMShellWidget)w)->wm.wait_for_wm = FALSE; /* timed out; must be broken */ } PutBackGeometry(); @@ -2225,10 +2226,10 @@ static XtGeometryResult RootGeometryManager(gw, request, reply) } /* ARGSUSED */ -static Boolean SetValues(old, ref, new, args, num_args) - Widget old, ref, new; - ArgList args; - Cardinal *num_args; +static Boolean SetValues( + Widget old, Widget ref, Widget new, + ArgList args, + Cardinal *num_args) { ShellWidget nw = (ShellWidget) new; ShellWidget ow = (ShellWidget) old; @@ -2271,10 +2272,10 @@ static Boolean SetValues(old, ref, new, args, num_args) } /* ARGSUSED */ -static Boolean WMSetValues(old, ref, new, args, num_args) - Widget old, ref, new; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static Boolean WMSetValues( + Widget old, Widget ref, Widget new, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { WMShellWidget nwmshell = (WMShellWidget) new; WMShellWidget owmshell = (WMShellWidget) old; @@ -2352,7 +2353,7 @@ static Boolean WMSetValues(old, ref, new, args, num_args) if (nwmshell->wm.transient) { if (!XtIsTransientShell(new) && !nwmshell->shell.override_redirect && - nwmshell->wm.wm_hints.window_group != + nwmshell->wm.wm_hints.window_group != XtUnspecifiedWindowGroup) XSetTransientForHint(XtDisplay(new), XtWindow(new), nwmshell->wm.wm_hints.window_group); @@ -2392,14 +2393,14 @@ static Boolean WMSetValues(old, ref, new, args, num_args) } /*ARGSUSED*/ -static Boolean TransientSetValues(oldW, refW, newW, args, num_args) - Widget oldW, refW, newW; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static Boolean TransientSetValues( + Widget oldW, Widget refW, Widget newW, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { TransientShellWidget old = (TransientShellWidget)oldW; TransientShellWidget new = (TransientShellWidget)newW; - + if (XtIsRealized(newW) && ((new->wm.transient && !old->wm.transient) || ((new->transient.transient_for != old->transient.transient_for) @@ -2414,10 +2415,10 @@ static Boolean TransientSetValues(oldW, refW, newW, args, num_args) /* ARGSUSED */ -static Boolean TopLevelSetValues(oldW, refW, newW, args, num_args) - Widget oldW, refW, newW; - ArgList args; /* unused */ - Cardinal *num_args; /* unused */ +static Boolean TopLevelSetValues( + Widget oldW, Widget refW, Widget newW, + ArgList args, /* unused */ + Cardinal *num_args) /* unused */ { TopLevelShellWidget old = (TopLevelShellWidget)oldW; TopLevelShellWidget new = (TopLevelShellWidget)newW; @@ -2474,9 +2475,9 @@ static Boolean TopLevelSetValues(oldW, refW, newW, args, num_args) return False; } -static String * NewArgv(count, str) - int count; - String *str; /* do not assume it's terminated by a NULL element */ +static String * NewArgv( + int count, + String *str) /* do not assume it's terminated by a NULL element */ { Cardinal nbytes = 0; Cardinal num = 0; @@ -2507,10 +2508,10 @@ static String * NewArgv(count, str) /*ARGSUSED*/ -static Boolean ApplicationSetValues(current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; +static Boolean ApplicationSetValues( + Widget current, Widget request, Widget new, + ArgList args, + Cardinal *num_args) { ApplicationShellWidget nw = (ApplicationShellWidget) new; ApplicationShellWidget cw = (ApplicationShellWidget) current; @@ -2536,16 +2537,16 @@ static Boolean ApplicationSetValues(current, request, new, args, num_args) } /*ARGSUSED*/ -static Boolean SessionSetValues(current, request, new, args, num_args) - Widget current, request, new; - ArgList args; - Cardinal *num_args; +static Boolean SessionSetValues( + Widget current, Widget request, Widget new, + ArgList args, + Cardinal *num_args) { #ifndef XT_NO_SM SessionShellWidget nw = (SessionShellWidget) new; SessionShellWidget cw = (SessionShellWidget) current; - unsigned long set_mask = 0L; - unsigned long unset_mask = 0L; + unsigned long set_mask = 0UL; + unsigned long unset_mask = 0UL; Boolean initialize = False; if (cw->session.session_id != nw->session.session_id) { @@ -2564,7 +2565,7 @@ static Boolean SessionSetValues(current, request, new, args, num_args) if (cw->session.current_dir != nw->session.current_dir) { if (nw->session.current_dir) { - nw->session.current_dir = + nw->session.current_dir = XtNewString(nw->session.current_dir); set_mask |= XtCurrentDirectoryMask; } else unset_mask |= XtCurrentDirectoryMask; @@ -2582,7 +2583,7 @@ static Boolean SessionSetValues(current, request, new, args, num_args) if (cw->session.environment != nw->session.environment) { if (nw->session.environment) { - nw->session.environment = + nw->session.environment = NewStringArray(nw->session.environment); set_mask |= XtEnvironmentMask; } else unset_mask |= XtEnvironmentMask; @@ -2591,7 +2592,7 @@ static Boolean SessionSetValues(current, request, new, args, num_args) if (cw->session.program_path != nw->session.program_path) { if (nw->session.program_path) { - nw->session.program_path = + nw->session.program_path = XtNewString(nw->session.program_path); set_mask |= XtProgramMask; } else unset_mask |= XtProgramMask; @@ -2635,7 +2636,7 @@ static Boolean SessionSetValues(current, request, new, args, num_args) } if (nw->session.connection && (set_mask || unset_mask || initialize)) - SetSessionProperties(new, initialize, set_mask, unset_mask); + SetSessionProperties((SessionShellWidget) new, initialize, set_mask, unset_mask); if ((cw->session.join_session && !nw->session.join_session) || (cw->session.connection && !nw->session.connection)) @@ -2666,17 +2667,17 @@ static Boolean SessionSetValues(current, request, new, args, num_args) return False; } -void _XtShellGetCoordinates( widget, x, y) - Widget widget; - Position* x; - Position* y; +void _XtShellGetCoordinates( + Widget widget, + Position* x, + Position* y) { ShellWidget w = (ShellWidget)widget; - if (XtIsRealized(widget) && + if (XtIsRealized(widget) && !(w->shell.client_specified & _XtShellPositionValid)) { int tmpx, tmpy; Window tmpchild; - (void) XTranslateCoordinates(XtDisplay(w), XtWindow(w), + (void) XTranslateCoordinates(XtDisplay(w), XtWindow(w), RootWindowOfScreen(XtScreen(w)), (int) -w->core.border_width, (int) -w->core.border_width, @@ -2689,10 +2690,10 @@ void _XtShellGetCoordinates( widget, x, y) *y = w->core.y; } -static void GetValuesHook(widget, args, num_args) - Widget widget; - ArgList args; - Cardinal* num_args; +static void GetValuesHook( + Widget widget, + ArgList args, + Cardinal* num_args) { ShellWidget w = (ShellWidget) widget; @@ -2714,8 +2715,8 @@ static void GetValuesHook(widget, args, num_args) } } -static void ApplicationShellInsertChild(widget) - Widget widget; +static void ApplicationShellInsertChild( + Widget widget) { if (! XtIsWidget(widget) && XtIsRectObj(widget)) { XtAppWarningMsg(XtWidgetToApplicationContext(widget), @@ -2727,7 +2728,7 @@ static void ApplicationShellInsertChild(widget) XtWidgetProc insert_child; LOCK_PROCESS; - insert_child = + insert_child = ((CompositeWidgetClass)applicationShellClassRec.core_class. superclass)->composite_class.insert_child; UNLOCK_PROCESS; @@ -2736,28 +2737,28 @@ static void ApplicationShellInsertChild(widget) } /************************************************************************** - - Session Protocol Participation + + Session Protocol Participation *************************************************************************/ #define XtSessionCheckpoint 0 #define XtSessionInteract 1 -static void CallSaveCallbacks(); -static String *EditCommand(); -static Boolean ExamineToken(); -static void GetIceEvent(); -static XtCheckpointToken GetToken(); -static void XtCallCancelCallbacks(); -static void XtCallDieCallbacks(); -static void XtCallSaveCallbacks(); -static void XtCallSaveCompleteCallbacks(); +static void CallSaveCallbacks(SessionShellWidget ); +static String *EditCommand(String, String *, String *); +static Boolean ExamineToken(XtPointer); +static void GetIceEvent(XtPointer, int *, XtInputId *); +static XtCheckpointToken GetToken(Widget, int); +static void XtCallCancelCallbacks(SmcConn, SmPointer); +static void XtCallDieCallbacks(SmcConn, SmPointer); +static void XtCallSaveCallbacks(SmcConn, SmPointer, int, Bool, int, Bool); +static void XtCallSaveCompleteCallbacks(SmcConn, SmPointer); #ifndef XT_NO_SM -static void StopManagingSession(w, connection) - SessionShellWidget w; - SmcConn connection; /* connection to close, if any */ +static void StopManagingSession( + SessionShellWidget w, + SmcConn connection) /* connection to close, if any */ { if (connection) SmcCloseConnection(connection, 0, NULL); @@ -2770,8 +2771,8 @@ static void StopManagingSession(w, connection) } #define XT_MSG_LENGTH 256 -static void JoinSession(w) - SessionShellWidget w; +static void JoinSession( + SessionShellWidget w) { IceConn ice_conn; SmcCallbacks smcb; @@ -2784,7 +2785,7 @@ static void JoinSession(w) smcb.save_complete.callback = XtCallSaveCompleteCallbacks; smcb.shutdown_cancelled.callback = XtCallCancelCallbacks; smcb.save_yourself.client_data = smcb.die.client_data = - smcb.save_complete.client_data = + smcb.save_complete.client_data = smcb.shutdown_cancelled.client_data = (SmPointer) w; mask = SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask; @@ -2841,8 +2842,7 @@ static void JoinSession(w) #endif /* !XT_NO_SM */ -static String * NewStringArray(str) - String *str; +static String * NewStringArray(String *str) { Cardinal nbytes = 0; Cardinal num = 0; @@ -2871,8 +2871,7 @@ static String * NewStringArray(str) return newarray; } -static void FreeStringArray(str) - String *str; +static void FreeStringArray(String *str) { if (str) XtFree((char *) str); @@ -2880,9 +2879,9 @@ static void FreeStringArray(str) #ifndef XT_NO_SM -static SmProp * CardPack(name, closure) - char *name; - XtPointer closure; +static SmProp * CardPack( + char *name, + XtPointer closure) { unsigned char *prop = (unsigned char *) closure; SmProp *p; @@ -2912,9 +2911,9 @@ static SmProp * ArrayPack(char *name, XtPointer closure) return p; } -static SmProp * ListPack(name, closure) - char *name; - XtPointer closure; +static SmProp * ListPack( + char *name, + XtPointer closure) { String *prop = *(String **) closure; SmProp *p; @@ -2936,15 +2935,15 @@ static SmProp * ListPack(name, closure) return p; } -static void FreePacks(props, num_props) - SmProp **props; - int num_props; +static void FreePacks( + SmProp **props, + int num_props) { while (--num_props >= 0) XtFree((char *) props[num_props]); } -typedef SmProp* (*PackProc)(); +typedef SmProp* (*PackProc)(char *, XtPointer); typedef struct PropertyRec { char * name; @@ -2968,11 +2967,11 @@ static PropertyRec propertyTable[] = { #define XT_NUM_SM_PROPS 11 -static void SetSessionProperties(w, initialize, set_mask, unset_mask) - SessionShellWidget w; - Boolean initialize; - unsigned long set_mask; - unsigned long unset_mask; +static void SetSessionProperties( + SessionShellWidget w, + Boolean initialize, + unsigned long set_mask, + unsigned long unset_mask) { PropertyTable p = propertyTable; int n; @@ -3013,7 +3012,7 @@ static void SetSessionProperties(w, initialize, set_mask, unset_mask) FreePacks(props, num_props); } return; - } + } if (set_mask) { mask = 1L; @@ -3030,17 +3029,17 @@ static void SetSessionProperties(w, initialize, set_mask, unset_mask) mask = 1L; num_props = 0; for (n = XtNumber(propertyTable); n; n--, p++, mask <<= 1) - if (mask & unset_mask) + if (mask & unset_mask) pnames[num_props++] = p->name; SmcDeleteProperties(w->session.connection, num_props, pnames); } } /*ARGSUSED*/ -static void GetIceEvent(client_data, source, id) - XtPointer client_data; - int * source; - XtInputId * id; +static void GetIceEvent( + XtPointer client_data, + int * source, + XtInputId * id) { SessionShellWidget w = (SessionShellWidget) client_data; IceProcessMessagesStatus status; @@ -3055,8 +3054,8 @@ static void GetIceEvent(client_data, source, id) } } -static void CleanUpSave(w) - SessionShellWidget w; +static void CleanUpSave( + SessionShellWidget w) { XtSaveYourself next = w->session.save->next; XtFree((char *)w->session.save); @@ -3064,9 +3063,9 @@ static void CleanUpSave(w) if (w->session.save) CallSaveCallbacks(w); } - -static void CallSaveCallbacks(w) - SessionShellWidget w; + +static void CallSaveCallbacks( + SessionShellWidget w) { XtCheckpointToken token; @@ -3084,14 +3083,13 @@ static void CallSaveCallbacks(w) } /*ARGSUSED*/ -static void XtCallSaveCallbacks(connection, client_data, save_type, shutdown, - interact, fast) - SmcConn connection; /* unused */ - SmPointer client_data; - int save_type; - Bool shutdown; - int interact; - Bool fast; +static void XtCallSaveCallbacks( + SmcConn connection, /* unused */ + SmPointer client_data, + int save_type, + Bool shutdown, + int interact, + Bool fast) { SessionShellWidget w = (SessionShellWidget) client_data; XtSaveYourself save; @@ -3119,9 +3117,9 @@ static void XtCallSaveCallbacks(connection, client_data, save_type, shutdown, CallSaveCallbacks(w); } -static void XtInteractPermission(connection, data) - SmcConn connection; - SmPointer data; +static void XtInteractPermission( + SmcConn connection, + SmPointer data) { Widget w = (Widget) data; SessionShellWidget sw = (SessionShellWidget) data; @@ -3129,7 +3127,7 @@ static void XtInteractPermission(connection, data) XtCallbackProc callback; XtPointer client_data; - + _XtPeekCallback(w, sw->session.interact_callbacks, &callback, &client_data); if (callback) { @@ -3143,9 +3141,9 @@ static void XtInteractPermission(connection, data) } /*ARGSUSED*/ -static void XtCallSaveCompleteCallbacks(connection, client_data) - SmcConn connection; - SmPointer client_data; +static void XtCallSaveCompleteCallbacks( + SmcConn connection, + SmPointer client_data) { SessionShellWidget w = (SessionShellWidget) client_data; @@ -3154,9 +3152,9 @@ static void XtCallSaveCompleteCallbacks(connection, client_data) } /*ARGSUSED*/ -static void XtCallNextPhaseCallbacks(connection, client_data) - SmcConn connection; /* unused */ - SmPointer client_data; +static void XtCallNextPhaseCallbacks( + SmcConn connection, /* unused */ + SmPointer client_data) { SessionShellWidget w = (SessionShellWidget) client_data; w->session.save->phase = 2; @@ -3164,9 +3162,9 @@ static void XtCallNextPhaseCallbacks(connection, client_data) } /*ARGSUSED*/ -static void XtCallDieCallbacks(connection, client_data) - SmcConn connection; /* unused */ - SmPointer client_data; +static void XtCallDieCallbacks( + SmcConn connection, /* unused */ + SmPointer client_data) { SessionShellWidget w = (SessionShellWidget) client_data; @@ -3176,9 +3174,9 @@ static void XtCallDieCallbacks(connection, client_data) } /*ARGSUSED*/ -static void XtCallCancelCallbacks(connection, client_data) - SmcConn connection; /* unused */ - SmPointer client_data; +static void XtCallCancelCallbacks( + SmcConn connection, /* unused */ + SmPointer client_data) { SessionShellWidget w = (SessionShellWidget) client_data; Boolean call_interacts = False; @@ -3208,19 +3206,19 @@ static void XtCallCancelCallbacks(connection, client_data) } } -static XtCheckpointToken GetToken(widget, type) - Widget widget; - int type; +static XtCheckpointToken GetToken( + Widget widget, + int type) { SessionShellWidget w = (SessionShellWidget) widget; XtCheckpointToken token; XtSaveYourself save = w->session.save; - + if (type == XtSessionCheckpoint) w->session.save->save_tokens++; else if (type == XtSessionInteract) w->session.save->interact_tokens++; - else + else return (XtCheckpointToken) NULL; token = (XtCheckpointToken) __XtMalloc(sizeof(XtCheckpointTokenRec)); @@ -3253,8 +3251,8 @@ XtCheckpointToken XtSessionGetToken(Widget widget) return token; } -static Boolean ExamineToken(call_data) - XtPointer call_data; +static Boolean ExamineToken( + XtPointer call_data) { XtCheckpointToken token = (XtCheckpointToken) call_data; SessionShellWidget w = (SessionShellWidget) token->widget; @@ -3321,11 +3319,11 @@ void XtSessionReturnToken(XtCheckpointToken token) } } - phase_done = (w->session.save->save_tokens == 0 && + phase_done = (w->session.save->save_tokens == 0 && w->session.checkpoint_state == XtSaveActive); if (phase_done) { - if (w->session.save->request_next_phase && + if (w->session.save->request_next_phase && w->session.save->phase == 1) { SmcRequestSaveYourselfPhase2(w->session.connection, XtCallNextPhaseCallbacks, @@ -3341,9 +3339,9 @@ void XtSessionReturnToken(XtCheckpointToken token) UNLOCK_APP(app); } -static Boolean IsInArray(str, sarray) - String str; - String *sarray; +static Boolean IsInArray( + String str, + String *sarray) { if (str == NULL || sarray == NULL) return False; @@ -3354,10 +3352,10 @@ static Boolean IsInArray(str, sarray) return False; } -static String* EditCommand(str, src1, src2) - String str; /* if not NULL, the sm_client_id */ - String *src1; /* first choice */ - String *src2; /* alternate */ +static String* EditCommand( + String str, /* if not NULL, the sm_client_id */ + String *src1, /* first choice */ + String *src2) /* alternate */ { Boolean have; Boolean want; @@ -3373,7 +3371,7 @@ static String* EditCommand(str, src1, src2) if ((want && have) || (!want && !have)) { if (sarray == src1) return src1; - else + else return NewStringArray(sarray); } @@ -3386,7 +3384,7 @@ static String* EditCommand(str, src1, src2) *s = *sarray; s++; sarray++; *s = "-xtsessionID"; s++; *s = str; s++; - for (; --count > 0; s++, sarray++) + for (; --count > 0; s++, sarray++) *s = *sarray; *s = (String) NULL; } else { diff --git a/src/TMaction.c b/src/TMaction.c index 6cca270..68ca9c2 100644 --- a/src/TMaction.c +++ b/src/TMaction.c @@ -7,13 +7,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -87,17 +87,17 @@ typedef struct _CompiledAction{ ? (((TMClassCache)wc->core_class.actions)->actions) \ : NULL) -static CompiledActionTable CompileActionTable(actions, count, stat, perm) - register struct _XtActionsRec *actions; - register Cardinal count; /* may be 0 */ - Boolean stat; /* if False, copy before compiling in place */ - Boolean perm; /* if False, use XrmStringToQuark */ +static CompiledActionTable CompileActionTable( + register RConst struct _XtActionsRec *actions, + register Cardinal count, /* may be 0 */ + Boolean stat, /* if False, copy before compiling in place */ + Boolean perm) /* if False, use XrmStringToQuark */ { register CompiledActionTable cActions; register int i; CompiledAction hold; CompiledActionTable cTableHold; - XrmQuark (*func)(); + XrmQuark (*func)(_Xconst char*); if (!count) return (CompiledActionTable) NULL; @@ -115,14 +115,14 @@ static CompiledActionTable CompileActionTable(actions, count, stat, perm) cTableHold = (CompiledActionTable) actions; for (i=count; --i >= 0; actions++) - ((CompiledActionTable) actions)->signature = + ((CompiledActionTable) actions)->signature = (*func)(actions->string); } cActions = cTableHold; /* Insertion sort. Whatever sort is used, it must be stable. */ - for (i=1; i <= count - 1; i++) { - register int j; + for (i=1; (Cardinal) i <= count - 1; i++) { + register Cardinal j; hold = cActions[i]; j = i; while (j && cActions[j-1].signature > hold.signature) { @@ -143,9 +143,9 @@ typedef struct _ActionListRec { TMShortCard count; } ActionListRec; -static void ReportUnboundActions(xlations, bindData) - XtTranslations xlations; - TMBindData bindData; +static void ReportUnboundActions( + XtTranslations xlations, + TMBindData bindData) { TMSimpleStateTree stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0]; Cardinal num_unbound = 0; @@ -201,17 +201,17 @@ static void ReportUnboundActions(xlations, bindData) message[num_chars] = '\0'; params[0] = message; XtWarningMsg(XtNtranslationError,"unboundActions",XtCXtToolkitError, - "Actions not found: %s", + "Actions not found: %s", params, &num_params); XtStackFree (message, messagebuf); } } -static CompiledAction *SearchActionTable(signature, actionTable, numActions) - XrmQuark signature; - CompiledActionTable actionTable; - Cardinal numActions; +static CompiledAction *SearchActionTable( + XrmQuark signature, + CompiledActionTable actionTable, + Cardinal numActions) { register int i, left, right; @@ -232,18 +232,18 @@ static CompiledAction *SearchActionTable(signature, actionTable, numActions) return (CompiledAction *) NULL; } -static int BindActions(stateTree, procs, compiledActionTable, numActions, ndxP) - TMSimpleStateTree stateTree; - XtActionProc *procs; - CompiledActionTable compiledActionTable; - TMShortCard numActions; - Cardinal *ndxP; +static int BindActions( + TMSimpleStateTree stateTree, + XtActionProc *procs, + CompiledActionTable compiledActionTable, + TMShortCard numActions, + Cardinal *ndxP) { register int unbound = stateTree->numQuarks - *ndxP; CompiledAction* action; register Cardinal ndx; register Boolean savedNdx = False; - + for (ndx = *ndxP; ndx < stateTree->numQuarks; ndx++) { if (procs[ndx] == NULL) { /* attempt to bind it */ @@ -298,17 +298,17 @@ typedef struct _TMClassCacheRec { ((TMClassCache)w->core.widget_class->core_class.actions) -static int BindProcs(widget, stateTree, procs, bindStatus) - Widget widget; - TMSimpleStateTree stateTree; - XtActionProc *procs; - TMBindCacheStatus bindStatus; +static int BindProcs( + Widget widget, + TMSimpleStateTree stateTree, + XtActionProc *procs, + TMBindCacheStatus bindStatus) { register WidgetClass class; register ActionList actionList; int unbound = -1, newUnbound = -1; Cardinal ndx = 0; - Widget w = widget; + Widget w = widget; LOCK_PROCESS; do { @@ -331,7 +331,7 @@ static int BindProcs(widget, stateTree, procs, bindStatus) newUnbound = unbound; w = XtParent(w); } while (unbound != 0 && w != NULL); - + if (newUnbound > unbound) bindStatus->boundInHierarchy = True; else @@ -354,14 +354,16 @@ static int BindProcs(widget, stateTree, procs, bindStatus) else bindStatus->boundInContext = False; + } else { + bindStatus->boundInContext = False; } UNLOCK_PROCESS; return unbound; } -static XtActionProc *TryBindCache(widget, stateTree) - Widget widget; - TMStateTree stateTree; +static XtActionProc *TryBindCache( + Widget widget, + TMStateTree stateTree) { TMClassCache classCache; @@ -375,13 +377,13 @@ static XtActionProc *TryBindCache(widget, stateTree) wc->core_class.actions = (XtActionList) _XtInitializeActionData(NULL, 0, True); } - else + else { TMBindCache bindCache = (TMBindCache)(classCache->bindCache); for (; bindCache; bindCache = bindCache->next) { - if (IsPureClassBind(bindCache) && + if (IsPureClassBind(bindCache) && (stateTree == bindCache->stateTree)) { bindCache->status.refCount++; @@ -416,11 +418,11 @@ XtPointer _XtInitializeActionData( #define TM_BIND_CACHE_REALLOC 2 -static XtActionProc *EnterBindCache(w, stateTree, procs, bindStatus) - Widget w; - TMSimpleStateTree stateTree; - XtActionProc *procs; - TMBindCacheStatus bindStatus; +static XtActionProc *EnterBindCache( + Widget w, + TMSimpleStateTree stateTree, + XtActionProc *procs, + TMBindCacheStatus bindStatus) { TMClassCache classCache; TMBindCache* bindCachePtr; @@ -433,7 +435,7 @@ static XtActionProc *EnterBindCache(w, stateTree, procs, bindStatus) procsSize = stateTree->numQuarks * sizeof(XtActionProc); for (bindCache = *bindCachePtr; - (*bindCachePtr); + (*bindCachePtr); bindCachePtr = &(*bindCachePtr)->next, bindCache = *bindCachePtr) { TMBindCacheStatus cacheStatus = &bindCache->status; @@ -450,21 +452,21 @@ static XtActionProc *EnterBindCache(w, stateTree, procs, bindStatus) } if (*bindCachePtr == NULL) { - *bindCachePtr = + *bindCachePtr = bindCache = (TMBindCache) - __XtMalloc(sizeof(TMBindCacheRec) + + __XtMalloc(sizeof(TMBindCacheRec) + (procsSize - sizeof(XtActionProc))); bindCache->next = NULL; bindCache->status = *bindStatus; bindCache->status.refCount = 1; bindCache->stateTree = (TMStateTree)stateTree; -#ifdef TRACE_TM +#ifdef TRACE_TM bindCache->widgetClass = XtClass(w); if (_XtGlobalTM.numBindCache == _XtGlobalTM.bindCacheTblSize) { _XtGlobalTM.bindCacheTblSize += 16; _XtGlobalTM.bindCacheTbl = (TMBindCache *) - XtRealloc((char *)_XtGlobalTM.bindCacheTbl, + XtRealloc((char *)_XtGlobalTM.bindCacheTbl, ((_XtGlobalTM.bindCacheTblSize) * sizeof(TMBindCache))); } @@ -477,9 +479,9 @@ static XtActionProc *EnterBindCache(w, stateTree, procs, bindStatus) return &bindCache->procs[0]; } -static void RemoveFromBindCache(w,procs) - Widget w; - XtActionProc *procs; +static void RemoveFromBindCache( + Widget w, + XtActionProc *procs) { TMClassCache classCache; TMBindCache* bindCachePtr; @@ -498,7 +500,7 @@ static void RemoveFromBindCache(w,procs) { if (--bindCache->status.refCount == 0) { -#ifdef TRACE_TM +#ifdef TRACE_TM TMShortCard j; Boolean found = False; TMBindCache *tbl = _XtGlobalTM.bindCacheTbl; @@ -525,9 +527,9 @@ static void RemoveFromBindCache(w,procs) } /* ARGSUSED */ -static void RemoveAccelerators(widget,closure,data) - Widget widget; - XtPointer closure, data; +static void RemoveAccelerators( + Widget widget, + XtPointer closure, XtPointer data) { Widget destination = (Widget)closure; TMComplexBindProcs bindProcs; @@ -543,7 +545,7 @@ static void RemoveAccelerators(widget,closure,data) return; } - xlationsList = (XtTranslations *) + xlationsList = (XtTranslations *) XtStackAlloc((destXlations->numStateTrees * sizeof(XtTranslations)), stackXlations); @@ -576,9 +578,9 @@ static void RemoveAccelerators(widget,closure,data) XtStackFree((char *)xlationsList, stackXlations); } -void _XtBindActions(widget, tm) - Widget widget; - XtTM tm; +void _XtBindActions( + Widget widget, + XtTM tm) { XtTranslations xlations = tm->translations; TMSimpleStateTree stateTree; @@ -590,11 +592,11 @@ void _XtBindActions(widget, tm) XtActionProc *newProcs; Widget bindWidget; - if ((xlations == NULL) || widget->core.being_destroyed) + if ((xlations == NULL) || widget->core.being_destroyed) return; stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0]; - + for (i = 0; i < xlations->numStateTrees; i++) { stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i]; @@ -602,7 +604,7 @@ void _XtBindActions(widget, tm) complexBindProcs = TMGetComplexBindEntry(bindData, i); if (complexBindProcs->widget) { bindWidget = complexBindProcs->widget; - + if (bindWidget->core.destroy_callbacks != NULL) _XtAddCallbackOnce((InternalCallbackList *) &bindWidget->core.destroy_callbacks, @@ -621,7 +623,7 @@ void _XtBindActions(widget, tm) simpleBindProcs = TMGetSimpleBindEntry(bindData, i); bindWidget = widget; } - if ((newProcs = + if ((newProcs = TryBindCache(bindWidget,(TMStateTree)stateTree)) == NULL) { XtActionProc *procs, stackProcs[256]; @@ -634,8 +636,8 @@ void _XtBindActions(widget, tm) XtBZero((XtPointer)procs, stateTree->numQuarks * sizeof(XtActionProc)); - localUnbound = BindProcs(bindWidget, - stateTree, + localUnbound = BindProcs(bindWidget, + stateTree, procs, &bcStatusRec); @@ -645,8 +647,8 @@ void _XtBindActions(widget, tm) bcStatusRec.notFullyBound = False; newProcs = - EnterBindCache(bindWidget, - stateTree, + EnterBindCache(bindWidget, + stateTree, procs, &bcStatusRec); XtStackFree((XtPointer)procs, (XtPointer)stackProcs); @@ -657,16 +659,16 @@ void _XtBindActions(widget, tm) else simpleBindProcs->procs = newProcs; } - if (globalUnbound) + if (globalUnbound) ReportUnboundActions(xlations, (TMBindData)tm->proc_table); } -void _XtUnbindActions(widget, xlations, bindData) - Widget widget; - XtTranslations xlations; - TMBindData bindData; +void _XtUnbindActions( + Widget widget, + XtTranslations xlations, + TMBindData bindData) { Cardinal i; Widget bindWidget; @@ -681,9 +683,9 @@ void _XtUnbindActions(widget, xlations, bindData) complexBindProcs = TMGetComplexBindEntry(bindData, i); if (complexBindProcs->widget) { - /* + /* * check for this being an accelerator binding whose - * source is gone ( set by RemoveAccelerators) + * source is gone ( set by RemoveAccelerators) */ if (complexBindProcs->procs == NULL) continue; @@ -698,7 +700,7 @@ void _XtUnbindActions(widget, xlations, bindData) bindWidget = widget; procs = complexBindProcs->procs; complexBindProcs->procs = NULL; - } + } else { TMSimpleBindProcs simpleBindProcs; simpleBindProcs = TMGetSimpleBindEntry(bindData,i); @@ -711,10 +713,10 @@ void _XtUnbindActions(widget, xlations, bindData) } #ifdef notdef -void _XtRemoveBindProcsByIndex(w, bindData, ndx) - Widget w; - TMBindData bindData; - TMShortCard ndx; +void _XtRemoveBindProcsByIndex( + Widget w, + TMBindData bindData, + TMShortCard ndx) { TMShortCard i = ndx; TMBindProcs bindProcs = (TMBindProcs)&bindData->bindTbl[0]; @@ -730,8 +732,8 @@ void _XtRemoveBindProcsByIndex(w, bindData, ndx) /* * used to free all copied action tables, called from DestroyAppContext */ -void _XtFreeActions(actions) - ActionList actions; +void _XtFreeActions( + ActionList actions) { ActionList curr, next; @@ -743,17 +745,17 @@ void _XtFreeActions(actions) } } -void XtAddActions(actions, num_actions) - XtActionList actions; - Cardinal num_actions; +void XtAddActions( + XtActionList actions, + Cardinal num_actions) { XtAppAddActions(_XtDefaultAppContext(), actions, num_actions); } -void XtAppAddActions(app, actions, num_actions) - XtAppContext app; - XtActionList actions; - Cardinal num_actions; +void XtAppAddActions( + XtAppContext app, + XtActionList actions, + Cardinal num_actions) { register ActionList rec; @@ -766,10 +768,10 @@ void XtAppAddActions(app, actions, num_actions) UNLOCK_APP(app); } -void XtGetActionList(widget_class, actions_return, num_actions_return) - WidgetClass widget_class; - XtActionList* actions_return; - Cardinal* num_actions_return; +void XtGetActionList( + WidgetClass widget_class, + XtActionList* actions_return, + Cardinal* num_actions_return) { XtActionList list; CompiledActionTable table; @@ -789,7 +791,7 @@ void XtGetActionList(widget_class, actions_return, num_actions_return) } *num_actions_return = widget_class->core_class.num_actions; if (*num_actions_return) { - list = *actions_return = (XtActionList) + list = *actions_return = (XtActionList) __XtMalloc(*num_actions_return * sizeof(XtActionsRec)); table = GetClassActions(widget_class); for (i= (*num_actions_return); --i >= 0; list++, table++) { @@ -806,9 +808,9 @@ void XtGetActionList(widget_class, actions_return, num_actions_return) * ***********************************************************************/ -static Widget _XtFindPopup(widget, name) - Widget widget; - String name; +static Widget _XtFindPopup( + Widget widget, + String name) { register Cardinal i; register XrmQuark q; @@ -824,11 +826,11 @@ static Widget _XtFindPopup(widget, name) return NULL; } -void XtMenuPopupAction(widget, event, params, num_params) - Widget widget; - XEvent *event; - String *params; - Cardinal *num_params; +void XtMenuPopupAction( + Widget widget, + XEvent *event, + String *params, + Cardinal *num_params) { Boolean spring_loaded; register Widget popup_shell; @@ -874,11 +876,11 @@ void XtMenuPopupAction(widget, event, params, num_params) /*ARGSUSED*/ -static void _XtMenuPopdownAction(widget, event, params, num_params) - Widget widget; - XEvent *event; - String *params; - Cardinal *num_params; +static void _XtMenuPopdownAction( + Widget widget, + XEvent *event, + String *params, + Cardinal *num_params) { Widget popup_shell; @@ -915,8 +917,8 @@ static XtActionsRec RConst tmActions[] = { }; -void _XtPopupInitialize(app) - XtAppContext app; +void _XtPopupInitialize( + XtAppContext app) { register ActionList rec; @@ -967,10 +969,10 @@ void XtCallActionProc( WidgetClass class = XtClass(w); do { if ((actionP = GetClassActions(class)) != NULL) - for (i = 0; - i < class->core_class.num_actions; + for (i = 0; + i < class->core_class.num_actions; i++, actionP++) { - + if (actionP->signature == q) { ActionHook hook = app->action_hook_list; while (hook != NULL) { @@ -995,12 +997,12 @@ void XtCallActionProc( w = XtParent(w); } while (w != NULL); UNLOCK_PROCESS; - + for (actionList = app->action_table; actionList != NULL; actionList = actionList->next) { - - for (i = 0, actionP = actionList->table; + + for (i = 0, actionP = actionList->table; i < actionList->count; i++, actionP++) { if (actionP->signature == q) { @@ -1021,9 +1023,9 @@ void XtCallActionProc( return; } } - + } - + { String params[2]; Cardinal num_params = 2; @@ -1038,8 +1040,8 @@ void XtCallActionProc( UNLOCK_APP(app); } -void _XtDoFreeBindings(app) - XtAppContext app; +void _XtDoFreeBindings( + XtAppContext app) { TMBindCache bcp; diff --git a/src/TMgrab.c b/src/TMgrab.c index 7ccb187..601e0bb 100644 --- a/src/TMgrab.c +++ b/src/TMgrab.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -184,7 +184,7 @@ static Boolean DoGrab( UNLOCK_PROCESS; return False; } - + switch (typeMatch->eventType) { case ButtonPress: case ButtonRelease: @@ -207,15 +207,15 @@ static Boolean DoGrab( None ); break; - + case KeyPress: case KeyRelease: GrabAllCorrectKeys(widget, typeMatch, modMatch, grabP); break; - + case EnterNotify: break; - + default: XtAppWarningMsg(XtWidgetToApplicationContext(widget), "invalidPopup","unsupportedOperation",XtCXtToolkitError, @@ -227,8 +227,8 @@ static Boolean DoGrab( return False; } -void _XtRegisterGrabs(widget) - Widget widget; +void _XtRegisterGrabs( + Widget widget) { XtTranslations xlations = widget->core.tm.translations; TMComplexStateTree *stateTreePtr; @@ -243,14 +243,14 @@ void _XtRegisterGrabs(widget) /* walk the widget instance action bindings table looking for */ /* actions registered as grab actions. */ /* when you find one, do a grab on the triggering event */ - + if (xlations == NULL) return; stateTreePtr = (TMComplexStateTree *) xlations->stateTreeTbl; if (*stateTreePtr == NULL) return; for (i = 0; i < xlations->numStateTrees; i++, stateTreePtr++) { - if (bindData->simple.isComplex) + if (bindData->simple.isComplex) procs = TMGetComplexBindEntry(bindData, i)->procs; - else + else procs = TMGetSimpleBindEntry(bindData, i)->procs; for (count=0; count < (*stateTreePtr)->numQuarks; count++) { GrabActionRec* grabP; @@ -259,9 +259,9 @@ void _XtRegisterGrabs(widget) LOCK_PROCESS; for (grabP = grabActionList; grabP != NULL; grabP = grabP->next) { if (grabP->action_proc == procs[count]) { - /* we've found a "grabber" in the action table. Find the - * states that call this action. Note that if there is - * more than one "grabber" in the action table, we end + /* we've found a "grabber" in the action table. Find the + * states that call this action. Note that if there is + * more than one "grabber" in the action table, we end * up searching all of the states multiple times. */ doGrab.widget = widget; @@ -278,7 +278,7 @@ void _XtRegisterGrabs(widget) } void XtRegisterGrabAction( - XtActionProc action_proc, + XtActionProc action_proc, _XtBoolean owner_events, unsigned int event_mask, int pointer_mode, @@ -318,8 +318,8 @@ void XtRegisterGrabAction( } /*ARGSUSED*/ -void _XtGrabInitialize(app) - XtAppContext app; +void _XtGrabInitialize( + XtAppContext app) { LOCK_PROCESS; if (grabActionList == NULL) diff --git a/src/TMkey.c b/src/TMkey.c index 56227b6..7218c56 100644 --- a/src/TMkey.c +++ b/src/TMkey.c @@ -7,13 +7,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -153,10 +153,11 @@ FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe) /* usual number of expected keycodes in XtKeysymToKeycodeList */ #define KEYCODE_ARRAY_SIZE 10 -Boolean _XtComputeLateBindings(dpy, lateModifiers, computed, computedMask) - Display *dpy; - LateBindingsPtr lateModifiers; - Modifiers *computed,*computedMask; +Boolean _XtComputeLateBindings( + Display *dpy, + LateBindingsPtr lateModifiers, + Modifiers *computed, + Modifiers *computedMask) { int i,j,ref; ModToKeysymTable* temp; @@ -203,8 +204,8 @@ Boolean _XtComputeLateBindings(dpy, lateModifiers, computed, computedMask) return TRUE; } -void _XtAllocTMContext(pd) - XtPerDisplay pd; +void _XtAllocTMContext( + XtPerDisplay pd) { TMKeyContext ctx; ctx = (TMKeyContext)_XtHeapAlloc(&pd->heap, @@ -226,10 +227,10 @@ static unsigned int num_bits(unsigned long mask) return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); } -Boolean _XtMatchUsingDontCareMods(typeMatch, modMatch, eventSeq) - TMTypeMatch typeMatch; - TMModifierMatch modMatch; - TMEventPtr eventSeq; +Boolean _XtMatchUsingDontCareMods( + TMTypeMatch typeMatch, + TMModifierMatch modMatch, + TMEventPtr eventSeq) { Modifiers modifiers_return; KeySym keysym_return; @@ -241,22 +242,22 @@ Boolean _XtMatchUsingDontCareMods(typeMatch, modMatch, eventSeq) Display *dpy = eventSeq->xev->xany.display; XtPerDisplay pd; TMKeyContext tm_context; - + if (modMatch->lateModifiers != NULL) resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers, &computed, &computedMask); if (!resolved) return FALSE; computed |= modMatch->modifiers; computedMask |= modMatch->modifierMask; /* gives do-care mask */ - + if ( (computed & computedMask) == (eventSeq->event.modifiers & computedMask) ) { - + pd = _XtGetPerDisplay(dpy); tm_context = pd->tm_context; TRANSLATE(tm_context, pd, dpy, (KeyCode)eventSeq->event.eventCode, (unsigned)0, modifiers_return, keysym_return); - + if ((keysym_return & typeMatch->eventCodeMask) == typeMatch->eventCode ) { tm_context->event = eventSeq->xev; tm_context->serial = eventSeq->xev->xany.serial; @@ -270,10 +271,10 @@ Boolean _XtMatchUsingDontCareMods(typeMatch, modMatch, eventSeq) switch (num_modbits = num_bits(useful_mods)) { case 1: case 8: - /* + /* * one modbit should never happen, in fact the implementation * of XtTranslateKey and XmTranslateKey guarantee that it - * won't, so don't care if the loop is set up for the case + * won't, so don't care if the loop is set up for the case * when one modbit is set. * The performance implications of all eight modbits being * set is horrendous. This isn't a problem with Xt/Xaw based @@ -326,10 +327,11 @@ Boolean _XtMatchUsingDontCareMods(typeMatch, modMatch, eventSeq) return FALSE; } -void XtConvertCase(dpy,keysym,lower_return,upper_return) - Display *dpy; - KeySym keysym; - KeySym *lower_return, *upper_return; +void XtConvertCase( + Display *dpy, + KeySym keysym, + KeySym *lower_return, + KeySym *upper_return) { XtPerDisplay pd; CaseConverterPtr ptr; @@ -347,11 +349,11 @@ void XtConvertCase(dpy,keysym,lower_return,upper_return) XConvertCase(keysym, lower_return, upper_return); UNLOCK_APP(app); } - -Boolean _XtMatchUsingStandardMods (typeMatch, modMatch, eventSeq) - TMTypeMatch typeMatch; - TMModifierMatch modMatch; - TMEventPtr eventSeq; + +Boolean _XtMatchUsingStandardMods ( + TMTypeMatch typeMatch, + TMModifierMatch modMatch, + TMEventPtr eventSeq) { Modifiers modifiers_return; KeySym keysym_return; @@ -371,11 +373,11 @@ Boolean _XtMatchUsingStandardMods (typeMatch, modMatch, eventSeq) modifiers_return = MOD_RETURN(tm_context, eventSeq->event.eventCode); if (!modifiers_return) { - XtTranslateKeycode(dpy, (KeyCode)eventSeq->event.eventCode, + XtTranslateKeycode(dpy, (KeyCode)eventSeq->event.eventCode, eventSeq->event.modifiers, &modifiers_return, &keysym_return); translateModifiers = eventSeq->event.modifiers & modifiers_return; - UPDATE_CACHE(tm_context, pd, eventSeq->event.eventCode, + UPDATE_CACHE(tm_context, pd, eventSeq->event.eventCode, translateModifiers, modifiers_return, keysym_return); } else { translateModifiers = eventSeq->event.modifiers & modifiers_return; @@ -385,7 +387,7 @@ Boolean _XtMatchUsingStandardMods (typeMatch, modMatch, eventSeq) if ((typeMatch->eventCode & typeMatch->eventCodeMask) == (keysym_return & typeMatch->eventCodeMask)) { - if (modMatch->lateModifiers != NULL) + if (modMatch->lateModifiers != NULL) resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers, &computed, &computedMask); if (!resolved) return FALSE; @@ -405,9 +407,9 @@ Boolean _XtMatchUsingStandardMods (typeMatch, modMatch, eventSeq) } -void _XtBuildKeysymTables(dpy,pd) - Display *dpy; - register XtPerDisplay pd; +void _XtBuildKeysymTables( + Display *dpy, + register XtPerDisplay pd) { ModToKeysymTable *table; int maxCount,i,j,k,tempCount,idx; @@ -493,7 +495,7 @@ void _XtBuildKeysymTables(dpy,pd) } void XtTranslateKeycode ( - Display *dpy, + Display *dpy, _XtKeyCode keycode, Modifiers modifiers, Modifiers *modifiers_return, @@ -517,8 +519,8 @@ void XtTranslateKey( Modifiers modifiers, Modifiers *modifiers_return, KeySym *keysym_return) -#ifndef XKB { +#ifndef XKB XtPerDisplay pd; int per; register KeySym *syms; @@ -572,18 +574,14 @@ void XtTranslateKey( if (*keysym_return == XK_VoidSymbol) *keysym_return = NoSymbol; UNLOCK_APP(app); -} #else -{ XkbLookupKeySym(dpy, keycode, modifiers, modifiers_return, keysym_return); -} #endif +} -void XtSetKeyTranslator(dpy, translator) - - Display *dpy; - XtKeyProc translator; - +void XtSetKeyTranslator( + Display *dpy, + XtKeyProc translator) { XtPerDisplay pd; DPY_TO_APPCON(dpy); @@ -597,11 +595,11 @@ void XtSetKeyTranslator(dpy, translator) UNLOCK_APP(app); } -void XtRegisterCaseConverter(dpy, proc, start, stop) - Display *dpy; - XtCaseProc proc; - KeySym start; - KeySym stop; +void XtRegisterCaseConverter( + Display *dpy, + XtCaseProc proc, + KeySym start, + KeySym stop) { XtPerDisplay pd; CaseConverterPtr ptr, prev; @@ -623,7 +621,7 @@ void XtRegisterCaseConverter(dpy, proc, start, stop) if (start <= ptr->start && stop >= ptr->stop) { prev->next = ptr->next; XtFree((char *)ptr); - } + } else prev = ptr; } FLUSHKEYCACHE(pd->tm_context); @@ -631,10 +629,10 @@ void XtRegisterCaseConverter(dpy, proc, start, stop) UNLOCK_APP(app); } -KeySym *XtGetKeysymTable(dpy, min_keycode_return, keysyms_per_keycode_return) - Display *dpy; - KeyCode *min_keycode_return; - int *keysyms_per_keycode_return; +KeySym *XtGetKeysymTable( + Display *dpy, + KeyCode *min_keycode_return, + int *keysyms_per_keycode_return) { XtPerDisplay pd; KeySym* retval; @@ -650,11 +648,11 @@ KeySym *XtGetKeysymTable(dpy, min_keycode_return, keysyms_per_keycode_return) return retval; } -void XtKeysymToKeycodeList(dpy, keysym, keycodes_return, keycount_return) - Display *dpy; - KeySym keysym; - KeyCode **keycodes_return; - Cardinal *keycount_return; +void XtKeysymToKeycodeList( + Display *dpy, + KeySym keysym, + KeyCode **keycodes_return, + Cardinal *keycount_return) { XtPerDisplay pd; unsigned keycode; @@ -680,7 +678,7 @@ void XtKeysymToKeycodeList(dpy, keysym, keycodes_return, keycount_return) if (syms[j] == keysym) { match = 1; break; - } + } } if (!match) for (i = 1; i < 5; i += 2) { @@ -698,7 +696,7 @@ void XtKeysymToKeycodeList(dpy, keysym, keycodes_return, keycount_return) maxcodes += KEYCODE_ARRAY_SIZE; keycodes = (KeyCode*)__XtMalloc(maxcodes*sizeof(KeyCode)); if (ncodes) { - (void) memmove((char *)keycodes, (char *)old, + (void) memmove((char *)keycodes, (char *)old, ncodes*sizeof(KeyCode) ); XtFree((char *)old); } @@ -712,5 +710,3 @@ void XtKeysymToKeycodeList(dpy, keysym, keycodes_return, keycount_return) *keycount_return = ncodes; UNLOCK_APP(app); } - - diff --git a/src/TMparse.c b/src/TMparse.c index 47a3e8d..5aed5c4 100644 --- a/src/TMparse.c +++ b/src/TMparse.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -92,14 +92,14 @@ static String XtNtranslationParseError = "translationParseError"; typedef int EventType; -typedef String (*ParseProc)(); /* str, closure, event ,error */ - /* String str; */ - /* Opaque closure; */ - /* EventPtr event; */ - /* Boolean* error */ +typedef String (*ParseProc)( + String /* str; */, + Opaque /* closure; */, + EventPtr /* event; */, + Boolean* /* error */); -typedef void (*ModifierProc)(); typedef TMShortCard Value; +typedef void (*ModifierProc)(Value, LateBindingsPtr*, Boolean, Value*); typedef struct _ModifierRec { char* name; @@ -122,11 +122,11 @@ typedef struct { Value value; } NameValueRec, *NameValueTable; -static void ParseModImmed(); -static void ParseModSym(); -static String PanicModeRecovery(); -static String CheckForPoundSign(); -static KeySym StringToKeySym(); +static void ParseModImmed(Value, LateBindingsPtr*, Boolean, Value*); +static void ParseModSym(Value, LateBindingsPtr*, Boolean, Value*); +static String PanicModeRecovery(String); +static String CheckForPoundSign(String, _XtTranslateOp, _XtTranslateOp *); +static KeySym StringToKeySym(String, Boolean *); static ModifierRec modifiers[] = { {"Shift", 0, ParseModImmed,ShiftMask}, {"Lock", 0, ParseModImmed,LockMask}, @@ -217,13 +217,13 @@ static NameValueRec mappingNotify[] = { {NULL, NULLQUARK, 0}, }; -static String ParseKeySym(); -static String ParseKeyAndModifiers(); -static String ParseTable(); -static String ParseImmed(); -static String ParseAddModifier(); -static String ParseNone(); -static String ParseAtom(); +static String ParseKeySym(String, Opaque, EventPtr, Boolean*); +static String ParseKeyAndModifiers(String, Opaque, EventPtr, Boolean*); +static String ParseTable(String, Opaque, EventPtr, Boolean*); +static String ParseImmed(String, Opaque, EventPtr, Boolean*); +static String ParseAddModifier(String, Opaque, EventPtr, Boolean*); +static String ParseNone(String, Opaque, EventPtr, Boolean*); +static String ParseAtom(String, Opaque, EventPtr, Boolean*); static EventKey events[] = { @@ -399,8 +399,8 @@ static XrmQuark QCtrl; static XrmQuark QNone; static XrmQuark QAny; -static void FreeEventSeq(eventSeq) - EventSeqPtr eventSeq; +static void FreeEventSeq( + EventSeqPtr eventSeq) { register EventSeqPtr evs = eventSeq; @@ -421,8 +421,8 @@ static void FreeEventSeq(eventSeq) } } -static void CompileNameValueTable(table) - NameValueTable table; +static void CompileNameValueTable( + NameValueTable table) { register int i; @@ -436,9 +436,9 @@ static int OrderEvents(_Xconst void *a, _Xconst void *b) ((_Xconst EventKey *)b)->signature) ? -1 : 1); } -static void Compile_XtEventTable(table, count) - EventKeys table; - Cardinal count; +static void Compile_XtEventTable( + EventKeys table, + Cardinal count) { register int i; register EventKeys entry = table; @@ -454,9 +454,9 @@ static int OrderModifiers(_Xconst void *a, _Xconst void *b) ((_Xconst ModifierRec *)b)->signature) ? -1 : 1); } -static void Compile_XtModifierTable(table, count) - ModifierKeys table; - Cardinal count; +static void Compile_XtModifierTable( + ModifierKeys table, + Cardinal count) { register int i; register ModifierKeys entry = table; @@ -466,8 +466,8 @@ static void Compile_XtModifierTable(table, count) qsort(table, count, sizeof(ModifierRec), OrderModifiers); } -static String PanicModeRecovery(str) - String str; +static String PanicModeRecovery( + String str) { ScanFor(str,'\n'); if (*str == '\n') str++; @@ -476,8 +476,8 @@ static String PanicModeRecovery(str) } -static void Syntax(str0,str1) - String str0,str1; +static void Syntax( + String str0,String str1) { Cardinal num_params = 2; String params[2]; @@ -490,11 +490,11 @@ static void Syntax(str0,str1) -static Cardinal LookupTMEventType(eventStr,error) - String eventStr; - Boolean *error; +static Cardinal LookupTMEventType( + String eventStr, + Boolean *error) { - register int i, left, right; + register int i = 0, left, right; register XrmQuark signature; static int previous = 0; @@ -525,13 +525,12 @@ static Cardinal LookupTMEventType(eventStr,error) return (Cardinal) i; } -static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) - - KeySym keysymL; - Boolean notL; - KeySym keysymR; - Boolean notR; - LateBindingsPtr* lateBindings; +static void StoreLateBindings( + KeySym keysymL, + Boolean notL, + KeySym keysymR, + Boolean notR, + LateBindingsPtr* lateBindings) { LateBindingsPtr temp; Boolean pair = FALSE; @@ -547,7 +546,7 @@ static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) } else{ number = 2;pair = TRUE; } - + temp = (LateBindingsPtr)XtRealloc((char *)temp, (unsigned)((count+number+1) * sizeof(LateBindings)) ); *lateBindings = temp; @@ -566,14 +565,14 @@ static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings) temp[count].ref_count = 0; temp[count].keysym = 0; } -} - -static void _XtParseKeysymMod(name,lateBindings,notFlag,valueP,error) - String name; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value *valueP; - Boolean *error; +} + +static void _XtParseKeysymMod( + String name, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value *valueP, + Boolean *error) { KeySym keySym; keySym = StringToKeySym(name, error); @@ -583,13 +582,12 @@ static void _XtParseKeysymMod(name,lateBindings,notFlag,valueP,error) } } -static Boolean _XtLookupModifier(signature, lateBindings, notFlag, valueP, - constMask) - XrmQuark signature; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value *valueP; - Bool constMask; +static Boolean _XtLookupModifier( + XrmQuark signature, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value *valueP, + Bool constMask) { register int i, left, right; static int previous = 0; @@ -627,8 +625,8 @@ static Boolean _XtLookupModifier(signature, lateBindings, notFlag, valueP, } -static String ScanIdent(str) - register String str; +static String ScanIdent( + register String str) { ScanAlphanumeric(str); while ( @@ -642,9 +640,9 @@ static String ScanIdent(str) return str; } -static String FetchModifierToken(str, token_return) - String str; - XrmQuark *token_return; +static String FetchModifierToken( + String str, + XrmQuark *token_return) { String start = str; @@ -663,7 +661,7 @@ static String FetchModifierToken(str, token_return) char modStrbuf[100]; char* modStr; - modStr = XtStackAlloc (str - start + 1, modStrbuf); + modStr = XtStackAlloc ((size_t)(str - start + 1), modStrbuf); if (modStr == NULL) _XtAllocError (NULL); (void) memmove(modStr, start, str-start); modStr[str-start] = '\0'; @@ -672,18 +670,18 @@ static String FetchModifierToken(str, token_return) return str; } return str; -} - -static String ParseModifiers(str, event,error) - register String str; - EventPtr event; - Boolean* error; +} + +static String ParseModifiers( + register String str, + EventPtr event, + Boolean* error) { register String start; Boolean notFlag, exclusive, keysymAsMod; Value maskBit; XrmQuark Qmod; - + ScanWhitespace(str); start = str; str = FetchModifierToken(str, &Qmod); @@ -714,12 +712,12 @@ static String ParseModifiers(str, event,error) ScanWhitespace(str); } } - + while (*str != '<') { if (*str == '~') { notFlag = TRUE; str++; - } else + } else notFlag = FALSE; if (*str == '@') { keysymAsMod = TRUE; @@ -756,31 +754,31 @@ static String ParseModifiers(str, event,error) return str; } -static String ParseXtEventType(str, event, tmEventP,error) - register String str; - EventPtr event; - Cardinal *tmEventP; - Boolean* error; +static String ParseXtEventType( + register String str, + EventPtr event, + Cardinal *tmEventP, + Boolean* error) { String start = str; char eventTypeStrbuf[100]; char* eventTypeStr; ScanAlphanumeric(str); - eventTypeStr = XtStackAlloc (str - start + 1, eventTypeStrbuf); + eventTypeStr = XtStackAlloc ((size_t)(str - start + 1), eventTypeStrbuf); if (eventTypeStr == NULL) _XtAllocError (NULL); (void) memmove(eventTypeStr, start, str-start); eventTypeStr[str-start] = '\0'; *tmEventP = LookupTMEventType(eventTypeStr,error); XtStackFree (eventTypeStr, eventTypeStrbuf); - if (*error) + if (*error) return PanicModeRecovery(str); event->event.eventType = events[*tmEventP].eventType; return str; } -static unsigned long StrToHex(str) - String str; +static unsigned long StrToHex( + String str) { register char c; register unsigned long val = 0; @@ -796,8 +794,8 @@ static unsigned long StrToHex(str) return val; } -static unsigned long StrToOct(str) - String str; +static unsigned long StrToOct( + String str) { register char c; register unsigned long val = 0; @@ -810,8 +808,8 @@ static unsigned long StrToOct(str) return val; } -static unsigned long StrToNum(str) - String str; +static unsigned long StrToNum( + String str) { register char c; register unsigned long val = 0; @@ -831,9 +829,9 @@ static unsigned long StrToNum(str) return val; } -static KeySym StringToKeySym(str, error) - String str; - Boolean *error; +static KeySym StringToKeySym( + String str, + Boolean *error) { KeySym k; @@ -862,23 +860,23 @@ static KeySym StringToKeySym(str, error) return NoSymbol; } /* ARGSUSED */ -static void ParseModImmed(value, lateBindings, notFlag, valueP) - Value value; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value* valueP; +static void ParseModImmed( + Value value, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value* valueP) { *valueP = value; } -static void ParseModSym(value, lateBindings, notFlag, valueP) /* is only valid with keysyms that have an _L and _R in their name; * and ignores keysym lookup errors (i.e. assumes only valid keysyms) */ - Value value; - LateBindingsPtr* lateBindings; - Boolean notFlag; - Value* valueP; +static void ParseModSym( + Value value, + LateBindingsPtr* lateBindings, + Boolean notFlag, + Value* valueP) { register KeySym keysymL = (KeySym)value; register KeySym keysymR = keysymL + 1; /* valid for supported keysyms */ @@ -899,24 +897,24 @@ static String stupid_optimizer_kludge; #endif /* ARGSUSED */ -static String ParseImmed(str, closure, event,error) - register String str; - register Opaque closure; - register EventPtr event; - Boolean* error; +static String ParseImmed( + register String str, + register Opaque closure, + register EventPtr event, + Boolean* error) { event->event.eventCode = (unsigned long)closure; - event->event.eventCodeMask = (unsigned long)~0L; + event->event.eventCodeMask = ~0UL; return BROKEN_OPTIMIZER_HACK(str); } /* ARGSUSED */ -static String ParseAddModifier(str, closure, event, error) - register String str; - register Opaque closure; - register EventPtr event; - Boolean* error; +static String ParseAddModifier( + register String str, + register Opaque closure, + register EventPtr event, + Boolean* error) { register unsigned long modval = (unsigned long)closure; event->event.modifiers |= modval; @@ -927,11 +925,11 @@ static String ParseAddModifier(str, closure, event, error) } -static String ParseKeyAndModifiers(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseKeyAndModifiers( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { str = ParseKeySym(str, closure, event,error); if ((unsigned long) closure == 0) { @@ -946,11 +944,11 @@ static String ParseKeyAndModifiers(str, closure, event,error) } /*ARGSUSED*/ -static String ParseKeySym(str, closure, event,error) - register String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseKeySym( + register String str, + Opaque closure, + EventPtr event, + Boolean* error) { char *start; char keySymNamebuf[100]; @@ -985,7 +983,7 @@ static String ParseKeySym(str, closure, event,error) && !IsNewline(*str) && (*str != '(' || *(str+1) <= '0' || *(str+1) >= '9') && *str != '\0') str++; - keySymName = XtStackAlloc (str - start + 1, keySymNamebuf); + keySymName = XtStackAlloc ((size_t)(str - start + 1), keySymNamebuf); (void) memmove(keySymName, start, str-start); keySymName[str-start] = '\0'; event->event.eventCode = StringToKeySym(keySymName, error); @@ -1005,7 +1003,7 @@ static String ParseKeySym(str, closure, event,error) } if (event->event.standard) event->event.matchEvent = _XtMatchUsingStandardMods; - else + else event->event.matchEvent = _XtMatchUsingDontCareMods; XtStackFree (keySymName, keySymNamebuf); @@ -1013,11 +1011,11 @@ static String ParseKeySym(str, closure, event,error) return str; } -static String ParseTable(str, closure, event,error) - register String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseTable( + register String str, + Opaque closure, + EventPtr event, + Boolean* error) { register String start = str; register XrmQuark signature; @@ -1048,11 +1046,11 @@ static String ParseTable(str, closure, event,error) } /*ARGSUSED*/ -static String ParseNone(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseNone( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { event->event.eventCode = 0; event->event.eventCodeMask = 0; @@ -1061,11 +1059,11 @@ static String ParseNone(str, closure, event,error) } /*ARGSUSED*/ -static String ParseAtom(str, closure, event,error) - String str; - Opaque closure; - EventPtr event; - Boolean* error; +static String ParseAtom( + String str, + Opaque closure, + EventPtr event, + Boolean* error) { ScanWhitespace(str); @@ -1099,21 +1097,21 @@ static String ParseAtom(str, closure, event,error) static ModifierMask buttonModifierMasks[] = { 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask }; -static String ParseRepeat(); - -static String ParseEvent(str, event, reps, plus, error) - register String str; - EventPtr event; - int* reps; - Boolean* plus; - Boolean* error; +static String ParseRepeat(String, int *, Boolean *, Boolean *); + +static String ParseEvent( + register String str, + EventPtr event, + int* reps, + Boolean* plus, + Boolean* error) { Cardinal tmEvent; str = ParseModifiers(str, event,error); if (*error) return str; if (*str != '<') { - Syntax("Missing '<' while parsing event type.",""); + Syntax("Missing '<' while parsing event type.",""); *error = TRUE; return PanicModeRecovery(str); } @@ -1149,10 +1147,10 @@ static String ParseEvent(str, event, reps, plus, error) return str; } -static String ParseQuotedStringEvent(str, event,error) - register String str; - register EventPtr event; - Boolean *error; +static String ParseQuotedStringEvent( + register String str, + register EventPtr event, + Boolean *error) { Value metaMask; char s[2]; @@ -1182,16 +1180,16 @@ static String ParseQuotedStringEvent(str, event,error) static EventSeqRec timerEventRec = { - {0, 0, NULL, _XtEventTimerEventType, 0L, 0L, NULL}, + {0, 0, NULL, _XtEventTimerEventType, 0L, 0L, NULL, False}, /* (StatePtr) -1 */ NULL, NULL, NULL }; -static void RepeatDown(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatDown( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent; @@ -1235,10 +1233,10 @@ static void RepeatDown(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatDownPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatDownPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent, lastDownEvent = NULL; @@ -1285,10 +1283,10 @@ static void RepeatDownPlus(eventP, reps, actionsP) *actionsP = &lastDownEvent->actions; } -static void RepeatUp(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatUp( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent; @@ -1341,10 +1339,10 @@ static void RepeatUp(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatUpPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatUpPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { EventRec upEventRec; register EventPtr event, downEvent, lastUpEvent = NULL; @@ -1392,10 +1390,10 @@ static void RepeatUpPlus(eventP, reps, actionsP) *actionsP = &lastUpEvent->actions; } -static void RepeatOther(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatOther( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { register EventPtr event, tempEvent; register int i; @@ -1415,10 +1413,10 @@ static void RepeatOther(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatOtherPlus(eventP, reps, actionsP) - EventPtr *eventP; - int reps; - ActionPtr **actionsP; +static void RepeatOtherPlus( + EventPtr *eventP, + int reps, + ActionPtr **actionsP) { register EventPtr event, tempEvent; register int i; @@ -1439,11 +1437,11 @@ static void RepeatOtherPlus(eventP, reps, actionsP) *actionsP = &event->actions; } -static void RepeatEvent(eventP, reps, plus, actionsP) - EventPtr *eventP; - int reps; - Boolean plus; - ActionPtr **actionsP; +static void RepeatEvent( + EventPtr *eventP, + int reps, + Boolean plus, + ActionPtr **actionsP) { switch ((*eventP)->event.eventType) { @@ -1465,10 +1463,10 @@ static void RepeatEvent(eventP, reps, plus, actionsP) } } -static String ParseRepeat(str, reps, plus, error) - register String str; - int *reps; - Boolean *plus, *error; +static String ParseRepeat( + register String str, + int *reps, + Boolean *plus, Boolean *error) { /*** Parse the repetitions, for double click etc... ***/ @@ -1478,7 +1476,7 @@ static String ParseRepeat(str, reps, plus, error) if (isdigit(*str)) { String start = str; char repStr[7]; - int len; + size_t len; ScanNumeric(str); len = (str - start); @@ -1517,14 +1515,14 @@ static String ParseRepeat(str, reps, plus, error) * Parses the left hand side of a translation table production * up to, and consuming the ":". * Takes a pointer to a char* (where to start parsing) and returns an - * event seq (in a passed in variable), having updated the String + * event seq (in a passed in variable), having updated the String **********************************************************************/ -static String ParseEventSeq(str, eventSeqP, actionsP,error) - register String str; - EventSeqPtr *eventSeqP; - ActionPtr **actionsP; - Boolean *error; +static String ParseEventSeq( + register String str, + EventSeqPtr *eventSeqP, + ActionPtr **actionsP, + Boolean *error) { EventSeqPtr *nextEvent = eventSeqP; @@ -1593,7 +1591,7 @@ static String ParseEventSeq(str, eventSeqP, actionsP,error) } if (*str != ':') { - Syntax("Missing ':'after event sequence.",""); + Syntax("Missing ':'after event sequence.",""); *error = TRUE; return PanicModeRecovery(str); } else str++; @@ -1602,10 +1600,10 @@ static String ParseEventSeq(str, eventSeqP, actionsP,error) } -static String ParseActionProc(str, actionProcNameP, error) - register String str; - XrmQuark *actionProcNameP; - Boolean *error; +static String ParseActionProc( + register String str, + XrmQuark *actionProcNameP, + Boolean *error) { register String start = str; char procName[200]; @@ -1623,9 +1621,9 @@ static String ParseActionProc(str, actionProcNameP, error) } -static String ParseString(str, strP) - register String str; - String *strP; +static String ParseString( + register String str, + String *strP) { register String start; @@ -1640,7 +1638,7 @@ static String ParseString(str, strP) /* \" produces double quote embedded in a quoted parameter * \\" produces backslash as last character of a quoted parameter */ - if (*str == '\\' && + if (*str == '\\' && (*(str+1) == '"' || (*(str+1) == '\\' && *(str+2) == '"'))) { len = prev_len + (str-start+2); *strP = XtRealloc(*strP, len); @@ -1650,7 +1648,7 @@ static String ParseString(str, strP) (*strP)[prev_len-1] = *str; (*strP)[prev_len] = '\0'; start = str+1; - } + } str++; } len = prev_len + (str-start+1); @@ -1678,10 +1676,10 @@ static String ParseString(str, strP) } -static String ParseParamSeq(str, paramSeqP, paramNumP) - register String str; - String **paramSeqP; - Cardinal *paramNumP; +static String ParseParamSeq( + register String str, + String **paramSeqP, + Cardinal *paramNumP) { typedef struct _ParamRec *ParamPtr; typedef struct _ParamRec { @@ -1735,11 +1733,11 @@ static String ParseParamSeq(str, paramSeqP, paramNumP) return str; } -static String ParseAction(str, actionP, quarkP, error) - String str; - ActionPtr actionP; - XrmQuark* quarkP; - Boolean* error; +static String ParseAction( + String str, + ActionPtr actionP, + XrmQuark* quarkP, + Boolean* error) { str = ParseActionProc(str, quarkP, error); if (*error) return str; @@ -1748,7 +1746,7 @@ static String ParseAction(str, actionP, quarkP, error) str++; str = ParseParamSeq(str, &actionP->params, &actionP->num_params); } else { - Syntax("Missing '(' while parsing action sequence",""); + Syntax("Missing '(' while parsing action sequence",""); *error = TRUE; return str; } @@ -1762,11 +1760,11 @@ static String ParseAction(str, actionP, quarkP, error) } -static String ParseActionSeq(parseTree, str, actionsP, error) - TMParseStateTree parseTree; - String str; - ActionPtr *actionsP; - Boolean *error; +static String ParseActionSeq( + TMParseStateTree parseTree, + String str, + ActionPtr *actionsP, + Boolean *error) { ActionPtr *nextActionP = actionsP; @@ -1794,12 +1792,12 @@ static String ParseActionSeq(parseTree, str, actionsP, error) } -static void ShowProduction(currentProduction) - String currentProduction; +static void ShowProduction( + String currentProduction) { Cardinal num_params = 1; String params[1]; - int len; + size_t len; char *eol, *production, productionbuf[500]; #ifdef __UNIXOS2__ @@ -1826,10 +1824,10 @@ static void ShowProduction(currentProduction) * Parses one line of event bindings. ***********************************************************************/ -static String ParseTranslationTableProduction(parseTree, str, error) - TMParseStateTree parseTree; - register String str; - Boolean* error; +static String ParseTranslationTableProduction( + TMParseStateTree parseTree, + register String str, + Boolean* error) { EventSeqPtr eventSeq = NULL; ActionPtr *actionsP; @@ -1854,15 +1852,15 @@ static String ParseTranslationTableProduction(parseTree, str, error) return (str); } -static String CheckForPoundSign(str, defaultOp, actualOpRtn) - String str; - _XtTranslateOp defaultOp; - _XtTranslateOp *actualOpRtn; +static String CheckForPoundSign( + String str, + _XtTranslateOp defaultOp, + _XtTranslateOp *actualOpRtn) { String start; char operation[20]; _XtTranslateOp opType; - + opType = defaultOp; ScanWhitespace(str); if (*str == '#') { @@ -1889,11 +1887,11 @@ static String CheckForPoundSign(str, defaultOp, actualOpRtn) return str; } -static XtTranslations ParseTranslationTable(source, isAccelerator, defaultOp, error) - String source; - Boolean isAccelerator; - _XtTranslateOp defaultOp; - Boolean* error; +static XtTranslations ParseTranslationTable( + String source, + Boolean isAccelerator, + _XtTranslateOp defaultOp, + Boolean* error) { XtTranslations xlations; TMStateTree stateTrees[8]; @@ -1954,12 +1952,13 @@ static XtTranslations ParseTranslationTable(source, isAccelerator, defaultOp, er /*** public procedures ***/ /*ARGSUSED*/ -Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) - Display* dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr from,to; - XtPointer *closure; +Boolean XtCvtStringToAcceleratorTable( + Display* dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *closure) { String str; Boolean error = FALSE; @@ -1982,17 +1981,17 @@ Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) to->size = sizeof(XtAccelerators); return FALSE; } - *(XtAccelerators*)to->addr = + *(XtAccelerators*)to->addr = (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error); } else { static XtAccelerators staticStateTable; - staticStateTable = + staticStateTable = (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error); to->addr = (XPointer) &staticStateTable; to->size = sizeof(XtAccelerators); } - if (error == TRUE) + if (error == TRUE) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "parseError","cvtStringToAcceleratorTable",XtCXtToolkitError, "String to AcceleratorTable conversion encountered errors", @@ -2003,16 +2002,17 @@ Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure) /*ARGSUSED*/ Boolean -XtCvtStringToTranslationTable(dpy, args, num_args, from, to, closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr from,to; - XtPointer *closure_ret; +XtCvtStringToTranslationTable( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *closure_ret) { String str; Boolean error = FALSE; - + if (*num_args != 0) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "wrongParameters","cvtStringToTranslationTable",XtCXtToolkitError, @@ -2031,17 +2031,17 @@ XtCvtStringToTranslationTable(dpy, args, num_args, from, to, closure_ret) to->size = sizeof(XtTranslations); return FALSE; } - *(XtTranslations*)to->addr = + *(XtTranslations*)to->addr = ParseTranslationTable(str, FALSE, XtTableReplace, &error); } else { static XtTranslations staticStateTable; - staticStateTable = + staticStateTable = ParseTranslationTable(str, FALSE, XtTableReplace, &error); to->addr = (XPointer) &staticStateTable; to->size = sizeof(XtTranslations); } - if (error == TRUE) + if (error == TRUE) XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "parseError","cvtStringToTranslationTable",XtCXtToolkitError, "String to TranslationTable conversion encountered errors", @@ -2058,8 +2058,8 @@ XtAccelerators XtParseAcceleratorTable( { Boolean error = FALSE; XtAccelerators ret = - (XtAccelerators) ParseTranslationTable (source, TRUE, XtTableAugment, &error); - if (error == TRUE) + (XtAccelerators) ParseTranslationTable ((char *)source, TRUE, XtTableAugment, &error); + if (error == TRUE) XtWarningMsg ("parseError", "cvtStringToAcceleratorTable", XtCXtToolkitError, "String to AcceleratorTable conversion encountered errors", @@ -2071,8 +2071,8 @@ XtTranslations XtParseTranslationTable( _Xconst char* source) { Boolean error = FALSE; - XtTranslations ret = ParseTranslationTable(source, FALSE, XtTableReplace, &error); - if (error == TRUE) + XtTranslations ret = ParseTranslationTable((char *)source, FALSE, XtTableReplace, &error); + if (error == TRUE) XtWarningMsg ("parseError", "cvtStringToTranslationTable", XtCXtToolkitError, "String to TranslationTable conversion encountered errors", @@ -2112,12 +2112,12 @@ void _XtTranslateInitialize(void) CompileNameValueTable( mappingNotify ); } -void _XtAddTMConverters(table) - ConverterTable table; +void _XtAddTMConverters( + ConverterTable table) { _XtTableAddConverter(table, _XtQString, - XrmPermStringToQuark(XtRTranslationTable), + XrmPermStringToQuark(XtRTranslationTable), XtCvtStringToTranslationTable, (XtConvertArgList) NULL, (Cardinal)0, True, CACHED, _XtFreeTranslations, True); _XtTableAddConverter(table, _XtQString, @@ -2126,7 +2126,7 @@ void _XtAddTMConverters(table) (Cardinal)0, True, CACHED, _XtFreeTranslations, True); _XtTableAddConverter(table, XrmPermStringToQuark( _XtRStateTablePair ), - XrmPermStringToQuark(XtRTranslationTable), + XrmPermStringToQuark(XtRTranslationTable), _XtCvtMergeTranslations, (XtConvertArgList) NULL, (Cardinal)0, True, CACHED, _XtFreeTranslations, True); } diff --git a/src/TMprint.c b/src/TMprint.c index 082d80e..ef1b763 100644 --- a/src/TMprint.c +++ b/src/TMprint.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -81,7 +81,7 @@ if (sb->current - sb->start > (int)sb->max - STR_THRESHOLD) \ } #define ExpandForChars(sb, nchars ) \ - if (sb->current - sb->start > sb->max - STR_THRESHOLD - nchars) { \ + if ((unsigned)(sb->current - sb->start) > sb->max - STR_THRESHOLD - nchars) { \ String old = sb->start; \ sb->start = XtRealloc(old, \ (Cardinal)(sb->max += STR_INCAMOUNT + nchars)); \ @@ -90,18 +90,18 @@ if (sb->current - sb->start > (int)sb->max - STR_THRESHOLD) \ #define ExpandToFit(sb, more) \ { \ - int l = strlen(more); \ + size_t l = strlen(more); \ ExpandForChars(sb, l); \ } -static void PrintModifiers(sb, mask, mod) - TMStringBuf sb; - unsigned long mask, mod; +static void PrintModifiers( + TMStringBuf sb, + unsigned long mask, unsigned long mod) { Boolean notfirst = False; CHECK_STR_OVERFLOW(sb); - if (mask == ~0L && mod == 0) { + if (mask == ~0UL && mod == 0) { *sb->current++ = '!'; *sb->current = '\0'; return; @@ -140,9 +140,9 @@ static void PrintModifiers(sb, mask, mod) #undef PRINTMOD } -static void PrintEventType(sb, event) - TMStringBuf sb; - unsigned long event; +static void PrintEventType( + TMStringBuf sb, + unsigned long event) { CHECK_STR_OVERFLOW(sb); switch (event) { @@ -189,22 +189,22 @@ static void PrintEventType(sb, event) sb->current += strlen(sb->current); } -static void PrintCode(sb, mask, code) - TMStringBuf sb; - unsigned long mask, code; +static void PrintCode( + TMStringBuf sb, + unsigned long mask, unsigned long code) { CHECK_STR_OVERFLOW(sb); if (mask != 0) { - if (mask != (unsigned long)~0L) + if (mask != ~0UL) (void) sprintf(sb->current, "0x%lx:0x%lx", mask, code); else (void) sprintf(sb->current, /*"0x%lx"*/ "%d", (unsigned)code); sb->current += strlen(sb->current); } } -static void PrintKeysym(sb, keysym) - TMStringBuf sb; - KeySym keysym; +static void PrintKeysym( + TMStringBuf sb, + KeySym keysym) { String keysymName; @@ -213,7 +213,7 @@ static void PrintKeysym(sb, keysym) CHECK_STR_OVERFLOW(sb); keysymName = XKeysymToString(keysym); if (keysymName == NULL) - PrintCode(sb,(unsigned long)~0L,(unsigned long)keysym); + PrintCode(sb,~0UL,(unsigned long)keysym); else { ExpandToFit(sb, keysymName); strcpy(sb->current, keysymName); @@ -221,10 +221,10 @@ static void PrintKeysym(sb, keysym) } } -static void PrintAtom(sb, dpy, atom) - TMStringBuf sb; - Display *dpy; - Atom atom; +static void PrintAtom( + TMStringBuf sb, + Display *dpy, + Atom atom) { String atomName; @@ -233,7 +233,7 @@ static void PrintAtom(sb, dpy, atom) atomName = (dpy ? XGetAtomName(dpy, atom) : NULL); if (! atomName) - PrintCode(sb,(unsigned long)~0L,(unsigned long)atom); + PrintCode(sb,~0UL,(unsigned long)atom); else { ExpandToFit( sb, atomName ); strcpy(sb->current, atomName); @@ -242,9 +242,9 @@ static void PrintAtom(sb, dpy, atom) } } -static void PrintLateModifiers(sb, lateModifiers) - TMStringBuf sb; - LateBindingsPtr lateModifiers; +static void PrintLateModifiers( + TMStringBuf sb, + LateBindingsPtr lateModifiers) { for (; lateModifiers->keysym; lateModifiers++) { CHECK_STR_OVERFLOW(sb); @@ -262,11 +262,11 @@ static void PrintLateModifiers(sb, lateModifiers) } } -static void PrintEvent(sb, typeMatch, modMatch, dpy) - TMStringBuf sb; - register TMTypeMatch typeMatch; - register TMModifierMatch modMatch; - Display *dpy; +static void PrintEvent( + TMStringBuf sb, + register TMTypeMatch typeMatch, + register TMModifierMatch modMatch, + Display *dpy) { if (modMatch->standard) *sb->current++ = ':'; @@ -293,10 +293,10 @@ static void PrintEvent(sb, typeMatch, modMatch, dpy) } } -static void PrintParams(sb, params, num_params) - TMStringBuf sb; - String *params; - Cardinal num_params; +static void PrintParams( + TMStringBuf sb, + String *params, + Cardinal num_params) { register Cardinal i; for (i = 0; i<num_params; i++) { @@ -313,11 +313,11 @@ static void PrintParams(sb, params, num_params) *sb->current = '\0'; } -static void PrintActions(sb, actions, quarkTbl, accelWidget) - TMStringBuf sb; - register ActionPtr actions; - XrmQuark *quarkTbl; - Widget accelWidget; +static void PrintActions( + TMStringBuf sb, + register ActionPtr actions, + XrmQuark *quarkTbl, + Widget accelWidget) { while (actions != NULL) { String proc; @@ -345,12 +345,11 @@ static void PrintActions(sb, actions, quarkTbl, accelWidget) *sb->current = '\0'; } -static Boolean LookAheadForCycleOrMulticlick(state, state_return, countP, - nextLevelP) - register StatePtr state; - StatePtr *state_return; /* state to print, usually startState */ - int *countP; - StatePtr *nextLevelP; +static Boolean LookAheadForCycleOrMulticlick( + register StatePtr state, + StatePtr *state_return, /* state to print, usually startState */ + int *countP, + StatePtr *nextLevelP) { int repeatCount = 0; StatePtr startState = state; @@ -408,13 +407,13 @@ static Boolean LookAheadForCycleOrMulticlick(state, state_return, countP, return isCycle; } -static void PrintComplexState(sb, includeRHS, state, stateTree, accelWidget, dpy) - TMStringBuf sb; - Boolean includeRHS; - StatePtr state; - TMStateTree stateTree; - Widget accelWidget; - Display *dpy; +static void PrintComplexState( + TMStringBuf sb, + Boolean includeRHS, + StatePtr state, + TMStateTree stateTree, + Widget accelWidget, + Display *dpy) { int clickCount = 0; Boolean cycle; @@ -441,18 +440,18 @@ static void PrintComplexState(sb, includeRHS, state, stateTree, accelWidget, dpy while (! state->actions && ! state->isCycleEnd) state = state->nextLevel; /* should be trigger state */ } - + if (state->actions) { if (includeRHS) { CHECK_STR_OVERFLOW(sb); *sb->current++ = ':'; - PrintActions(sb, + PrintActions(sb, state->actions, ((TMSimpleStateTree)stateTree)->quarkTbl, accelWidget); *sb->current++ = '\n'; } - } + } else { if (state->nextLevel && !cycle && !clickCount) *sb->current++ = ','; @@ -463,7 +462,7 @@ static void PrintComplexState(sb, includeRHS, state, stateTree, accelWidget, dpy } } *sb->current = '\0'; - + /* print succeeding states */ if (state->nextLevel && !cycle && !clickCount) PrintComplexState(sb, includeRHS, state->nextLevel, @@ -476,14 +475,13 @@ typedef struct{ TMShortCard bIndex; }PrintRec, *Print; -static int FindNextMatch(printData, numPrints, xlations, - branchHead, nextLevel, startIndex) - PrintRec *printData; - TMShortCard numPrints; - XtTranslations xlations; - TMBranchHead branchHead; - StatePtr nextLevel; - TMShortCard startIndex; +static int FindNextMatch( + PrintRec *printData, + TMShortCard numPrints, + XtTranslations xlations, + TMBranchHead branchHead, + StatePtr nextLevel, + TMShortCard startIndex) { TMShortCard i; TMComplexStateTree stateTree; @@ -494,7 +492,7 @@ static int FindNextMatch(printData, numPrints, xlations, for (i = startIndex; noMatch && i < numPrints; i++) { stateTree = (TMComplexStateTree) xlations->stateTreeTbl[printData[i].tIndex]; - prBranchHead = + prBranchHead = &(stateTree->branchHeadTbl[printData[i].bIndex]); if ((prBranchHead->typeIndex == branchHead->typeIndex) && @@ -524,20 +522,20 @@ static int FindNextMatch(printData, numPrints, xlations, } return TM_NO_MATCH; } - -static void ProcessLaterMatches(printData,xlations,tIndex,bIndex,numPrintsRtn) - PrintRec *printData; - XtTranslations xlations; - TMShortCard tIndex; - int bIndex; - TMShortCard *numPrintsRtn; + +static void ProcessLaterMatches( + PrintRec *printData, + XtTranslations xlations, + TMShortCard tIndex, + int bIndex, + TMShortCard *numPrintsRtn) { - TMComplexStateTree stateTree; + TMComplexStateTree stateTree; int i, j; TMBranchHead branchHead, matchBranch = NULL; for (i = tIndex; i < (int)xlations->numStateTrees; i++) { - stateTree = (TMComplexStateTree)xlations->stateTreeTbl[i]; + stateTree = (TMComplexStateTree)xlations->stateTreeTbl[i]; if (i == tIndex) { matchBranch = &stateTree->branchHeadTbl[bIndex]; j = bIndex+1; @@ -554,7 +552,7 @@ static void ProcessLaterMatches(printData,xlations,tIndex,bIndex,numPrintsRtn) else state = NULL; if ((!branchHead->isSimple || branchHead->hasActions) && - (FindNextMatch(printData, + (FindNextMatch(printData, *numPrintsRtn, xlations, branchHead, @@ -569,18 +567,18 @@ static void ProcessLaterMatches(printData,xlations,tIndex,bIndex,numPrintsRtn) } } -static void ProcessStateTree(printData, xlations, tIndex, numPrintsRtn) - PrintRec *printData; - XtTranslations xlations; - TMShortCard tIndex; - TMShortCard *numPrintsRtn; +static void ProcessStateTree( + PrintRec *printData, + XtTranslations xlations, + TMShortCard tIndex, + TMShortCard *numPrintsRtn) { - TMComplexStateTree stateTree; + TMComplexStateTree stateTree; int i; TMBranchHead branchHead; - stateTree = (TMComplexStateTree)xlations->stateTreeTbl[tIndex]; - + stateTree = (TMComplexStateTree)xlations->stateTreeTbl[tIndex]; + for (i = 0, branchHead = stateTree->branchHeadTbl; i < (int)stateTree->numBranchHeads; i++, branchHead++) { @@ -590,7 +588,7 @@ static void ProcessStateTree(printData, xlations, tIndex, numPrintsRtn) else state = NULL; if (FindNextMatch(printData, *numPrintsRtn, xlations, branchHead, - (state ? state->nextLevel : NULL), 0) + (state ? state->nextLevel : NULL), 0) == TM_NO_MATCH) { if (!branchHead->isSimple || branchHead->hasActions) { printData[*numPrintsRtn].tIndex = tIndex; @@ -599,9 +597,9 @@ static void ProcessStateTree(printData, xlations, tIndex, numPrintsRtn) } LOCK_PROCESS; if (_XtGlobalTM.newMatchSemantics == False) - ProcessLaterMatches(printData, - xlations, - tIndex, + ProcessLaterMatches(printData, + xlations, + tIndex, i, numPrintsRtn); UNLOCK_PROCESS; @@ -609,13 +607,13 @@ static void ProcessStateTree(printData, xlations, tIndex, numPrintsRtn) } } -static void PrintState(sb, tree, branchHead, includeRHS, accelWidget, dpy) - TMStringBuf sb; - TMStateTree tree; - TMBranchHead branchHead; - Boolean includeRHS; - Widget accelWidget; - Display *dpy; +static void PrintState( + TMStringBuf sb, + TMStateTree tree, + TMBranchHead branchHead, + Boolean includeRHS, + Widget accelWidget, + Display *dpy) { TMComplexStateTree stateTree = (TMComplexStateTree)tree; LOCK_PROCESS; @@ -626,14 +624,14 @@ static void PrintState(sb, tree, branchHead, includeRHS, accelWidget, dpy) dpy); if (includeRHS) { ActionRec actRec; - + CHECK_STR_OVERFLOW(sb); *sb->current++ = ':'; actRec.idx = TMBranchMore(branchHead); actRec.num_params = 0; actRec.params = NULL; actRec.next = NULL; - PrintActions(sb, + PrintActions(sb, &actRec, stateTree->quarkTbl, accelWidget); @@ -681,7 +679,7 @@ String _XtPrintXlations( sb->max = 1000; maxPrints = 0; for (i = 0; i < xlations->numStateTrees; i++) - maxPrints += + maxPrints += ((TMSimpleStateTree)(xlations->stateTreeTbl[i]))->numBranchHeads; prints = (PrintRec *) XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints); @@ -693,9 +691,9 @@ String _XtPrintXlations( for (i = 0; i < numPrints; i++) { TMSimpleStateTree stateTree = (TMSimpleStateTree) xlations->stateTreeTbl[prints[i].tIndex]; - TMBranchHead branchHead = + TMBranchHead branchHead = &stateTree->branchHeadTbl[prints[i].bIndex]; -#ifdef TRACE_TM +#ifdef TRACE_TM TMComplexBindProcs complexBindProcs; if (hasAccel == False) { @@ -716,11 +714,11 @@ String _XtPrintXlations( #ifndef NO_MIT_HACKS /*ARGSUSED*/ -void _XtDisplayTranslations(widget, event, params, num_params) - Widget widget; - XEvent *event; - String *params; - Cardinal *num_params; +void _XtDisplayTranslations( + Widget widget, + XEvent *event, + String *params, + Cardinal *num_params) { String xString; @@ -733,16 +731,16 @@ void _XtDisplayTranslations(widget, event, params, num_params) } /*ARGSUSED*/ -void _XtDisplayAccelerators(widget, event, params, num_params) - Widget widget; - XEvent *event; - String *params; - Cardinal *num_params; +void _XtDisplayAccelerators( + Widget widget, + XEvent *event, + String *params, + Cardinal *num_params) { String xString; - - xString = _XtPrintXlations(widget, + + xString = _XtPrintXlations(widget, widget->core.accelerators, NULL, True); @@ -751,11 +749,11 @@ void _XtDisplayAccelerators(widget, event, params, num_params) } /*ARGSUSED*/ -void _XtDisplayInstalledAccelerators(widget, event, params, num_params) - Widget widget; - XEvent *event; - String *params; - Cardinal *num_params; +void _XtDisplayInstalledAccelerators( + Widget widget, + XEvent *event, + String *params, + Cardinal *num_params) { Widget eventWidget = XtWindowToWidget(event->xany.display, event->xany.window); @@ -779,7 +777,7 @@ void _XtDisplayInstalledAccelerators(widget, event, params, num_params) sb->max = 1000; maxPrints = 0; for (i = 0; i < xlations->numStateTrees; i++) - maxPrints += + maxPrints += ((TMSimpleStateTree)xlations->stateTreeTbl[i])->numBranchHeads; prints = (PrintRec *) XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints); @@ -798,13 +796,13 @@ void _XtDisplayInstalledAccelerators(widget, event, params, num_params) for (i = 0; i < numPrints; i++) { TMSimpleStateTree stateTree = (TMSimpleStateTree) xlations->stateTreeTbl[prints[i].tIndex]; - TMBranchHead branchHead = + TMBranchHead branchHead = &stateTree->branchHeadTbl[prints[i].bIndex]; complexBindProcs = TMGetComplexBindEntry(bindData, 0); - - PrintState(sb, (TMStateTree)stateTree, branchHead, True, - complexBindProcs[prints[i].tIndex].widget, + + PrintState(sb, (TMStateTree)stateTree, branchHead, True, + complexBindProcs[prints[i].tIndex].widget, XtDisplay(widget)); } XtStackFree((XtPointer)prints, (XtPointer)stackPrints); @@ -813,24 +811,24 @@ void _XtDisplayInstalledAccelerators(widget, event, params, num_params) } #endif /*NO_MIT_HACKS*/ -String _XtPrintActions(actions, quarkTbl) - register ActionRec *actions; - XrmQuark *quarkTbl; +String _XtPrintActions( + register ActionRec *actions, + XrmQuark *quarkTbl) { TMStringBufRec sbRec, *sb = &sbRec; - + sb->max = 1000; sb->current = sb->start = __XtMalloc((Cardinal)1000); - PrintActions(sb, + PrintActions(sb, actions, quarkTbl, (Widget)NULL); return sb->start; } -String _XtPrintState(stateTree, branchHead) - TMStateTree stateTree; - TMBranchHead branchHead; +String _XtPrintState( + TMStateTree stateTree, + TMBranchHead branchHead) { TMStringBufRec sbRec, *sb = &sbRec; @@ -842,9 +840,9 @@ String _XtPrintState(stateTree, branchHead) } -String _XtPrintEventSeq(eventSeq, dpy) - register EventSeqPtr eventSeq; - Display *dpy; +String _XtPrintEventSeq( + register EventSeqPtr eventSeq, + Display *dpy) { TMStringBufRec sbRec, *sb = &sbRec; TMTypeMatch typeMatch; @@ -858,7 +856,7 @@ String _XtPrintEventSeq(eventSeq, dpy) sb->max = 1000; for (i = 0; i < MAXSEQS && eventSeq != NULL && !cycle; - eventSeq = eventSeq->next, i++) + eventSeq = eventSeq->next, i++) { eventSeqs[i] = eventSeq; for (j = 0; j < i && !cycle; j++) @@ -867,9 +865,9 @@ String _XtPrintEventSeq(eventSeq, dpy) } LOCK_PROCESS; for (j = 0; j < i; j++) { - typeMatch = + typeMatch = TMGetTypeMatch(_XtGetTypeIndex(&eventSeqs[j]->event)); - modMatch = + modMatch = TMGetModifierMatch(_XtGetModifierIndex(&eventSeqs[j]->event)); PrintEvent(sb, typeMatch, modMatch, dpy); if (j < i) @@ -878,4 +876,3 @@ String _XtPrintEventSeq(eventSeq, dpy) UNLOCK_PROCESS; return sb->start; } - diff --git a/src/TMstate.c b/src/TMstate.c index 732b28d..e0ca38d 100644 --- a/src/TMstate.c +++ b/src/TMstate.c @@ -6,13 +6,13 @@ Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Sun not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -60,7 +60,7 @@ in this Software without prior written authorization from The Open Group. */ -/* TMstate.c -- maintains the state table of actions for the translation +/* TMstate.c -- maintains the state table of actions for the translation * manager. */ /*LINTLIBRARY*/ @@ -72,7 +72,7 @@ in this Software without prior written authorization from The Open Group. #endif /* TM_NO_MATCH */ /* forward definitions */ -static StatePtr NewState(); +static StatePtr NewState(TMParseStateTree, TMShortCard, TMShortCard); static String XtNtranslationError = "translationError"; @@ -92,11 +92,11 @@ TMGlobalRec _XtGlobalTM = {0}; #define NumStateTrees(xlations) \ ((translateData->isSimple) ? 1 : (TMComplexXlations(xlations))->numTrees) -static TMShortCard GetBranchHead(parseTree, typeIndex, modIndex, isDummy) - TMParseStateTree parseTree; - TMShortCard typeIndex; - TMShortCard modIndex; - Boolean isDummy; +static TMShortCard GetBranchHead( + TMParseStateTree parseTree, + TMShortCard typeIndex, + TMShortCard modIndex, + Boolean isDummy) { #define TM_BRANCH_HEAD_TBL_ALLOC 8 #define TM_BRANCH_HEAD_TBL_REALLOC 8 @@ -131,8 +131,8 @@ static TMShortCard GetBranchHead(parseTree, typeIndex, modIndex, isDummy) parseTree->isStackBranchHeads = False; } else { - parseTree->branchHeadTbl = (TMBranchHead) - XtRealloc((char *)parseTree->branchHeadTbl, + parseTree->branchHeadTbl = (TMBranchHead) + XtRealloc((char *)parseTree->branchHeadTbl, (parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec))); } @@ -142,7 +142,7 @@ static TMShortCard GetBranchHead(parseTree, typeIndex, modIndex, isDummy) _XtGlobalTM.numBranchHeads++; UNLOCK_PROCESS; #endif /* TRACE_TM */ - branchHead = + branchHead = &parseTree->branchHeadTbl[parseTree->numBranchHeads++]; branchHead->typeIndex = typeIndex; branchHead->modIndex = modIndex; @@ -153,9 +153,9 @@ static TMShortCard GetBranchHead(parseTree, typeIndex, modIndex, isDummy) return parseTree->numBranchHeads-1; } -TMShortCard _XtGetQuarkIndex(parseTree, quark) - TMParseStateTree parseTree; - XrmQuark quark; +TMShortCard _XtGetQuarkIndex( + TMParseStateTree parseTree, + XrmQuark quark) { #define TM_QUARK_TBL_ALLOC 16 #define TM_QUARK_TBL_REALLOC 16 @@ -184,8 +184,8 @@ TMShortCard _XtGetQuarkIndex(parseTree, quark) parseTree->isStackQuarks = False; } else { - parseTree->quarkTbl = (XrmQuark *) - XtRealloc((char *)parseTree->quarkTbl, + parseTree->quarkTbl = (XrmQuark *) + XtRealloc((char *)parseTree->quarkTbl, (parseTree->quarkTblSize * sizeof(XrmQuark))); } @@ -200,45 +200,45 @@ TMShortCard _XtGetQuarkIndex(parseTree, quark) * there then allocate one */ /*ARGSUSED*/ -static TMShortCard GetComplexBranchIndex(parseTree, typeIndex, modIndex) - TMParseStateTree parseTree; - TMShortCard typeIndex; - TMShortCard modIndex; +static TMShortCard GetComplexBranchIndex( + TMParseStateTree parseTree, + TMShortCard typeIndex, + TMShortCard modIndex) { #define TM_COMPLEXBRANCH_HEAD_TBL_ALLOC 8 #define TM_COMPLEXBRANCH_HEAD_TBL_REALLOC 4 - + if (parseTree->numComplexBranchHeads == parseTree->complexBranchHeadTblSize) { TMShortCard newSize; - + if (parseTree->complexBranchHeadTblSize == 0) parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_ALLOC; else parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_REALLOC; - + newSize = (parseTree->complexBranchHeadTblSize * sizeof(StatePtr)); - + if (parseTree->isStackComplexBranchHeads) { - StatePtr *oldcomplexBranchHeadTbl + StatePtr *oldcomplexBranchHeadTbl = parseTree->complexBranchHeadTbl; parseTree->complexBranchHeadTbl = (StatePtr *) __XtMalloc(newSize); - XtMemmove(parseTree->complexBranchHeadTbl, + XtMemmove(parseTree->complexBranchHeadTbl, oldcomplexBranchHeadTbl, newSize); parseTree->isStackComplexBranchHeads = False; } else { - parseTree->complexBranchHeadTbl = (StatePtr *) - XtRealloc((char *)parseTree->complexBranchHeadTbl, + parseTree->complexBranchHeadTbl = (StatePtr *) + XtRealloc((char *)parseTree->complexBranchHeadTbl, (parseTree->complexBranchHeadTblSize * - sizeof(StatePtr))); + sizeof(StatePtr))); } } parseTree->complexBranchHeadTbl[parseTree->numComplexBranchHeads++] = NULL; return parseTree->numComplexBranchHeads-1; } -TMShortCard _XtGetTypeIndex(event) - Event *event; +TMShortCard _XtGetTypeIndex( + Event *event) { TMShortCard i, j = TM_TYPE_SEGMENT_SIZE; TMShortCard typeIndex = 0; @@ -248,13 +248,13 @@ TMShortCard _XtGetTypeIndex(event) LOCK_PROCESS; for (i = 0; i < _XtGlobalTM.numTypeMatchSegments; i++) { segment = _XtGlobalTM.typeMatchSegmentTbl[i]; - for (j = 0; + for (j = 0; typeIndex < _XtGlobalTM.numTypeMatches && j < TM_TYPE_SEGMENT_SIZE; - j++, typeIndex++) + j++, typeIndex++) { typeMatch = &(segment[j]); - if (event->eventType == typeMatch->eventType && - event->eventCode == typeMatch->eventCode && + if (event->eventType == typeMatch->eventType && + event->eventCode == typeMatch->eventCode && event->eventCodeMask == typeMatch->eventCodeMask && event->matchEvent == typeMatch->matchEvent) { UNLOCK_PROCESS; @@ -262,7 +262,7 @@ TMShortCard _XtGetTypeIndex(event) } } } - + if (j == TM_TYPE_SEGMENT_SIZE) { if (_XtGlobalTM.numTypeMatchSegments == _XtGlobalTM.typeMatchSegmentTblSize) { _XtGlobalTM.typeMatchSegmentTblSize += 4; @@ -270,7 +270,7 @@ TMShortCard _XtGetTypeIndex(event) XtRealloc((char *)_XtGlobalTM.typeMatchSegmentTbl, (_XtGlobalTM.typeMatchSegmentTblSize * sizeof(TMTypeMatch))); } - _XtGlobalTM.typeMatchSegmentTbl[_XtGlobalTM.numTypeMatchSegments++] = + _XtGlobalTM.typeMatchSegmentTbl[_XtGlobalTM.numTypeMatchSegments++] = segment = (TMTypeMatch) __XtMalloc(TM_TYPE_SEGMENT_SIZE * sizeof(TMTypeMatchRec)); j = 0; @@ -285,8 +285,9 @@ TMShortCard _XtGetTypeIndex(event) return typeIndex; } -static Boolean CompareLateModifiers(lateBind1P, lateBind2P) - LateBindingsPtr lateBind1P, lateBind2P; +static Boolean CompareLateModifiers( + LateBindingsPtr lateBind1P, + LateBindingsPtr lateBind2P) { LateBindingsPtr late1P = lateBind1P; LateBindingsPtr late2P = lateBind2P; @@ -320,8 +321,8 @@ static Boolean CompareLateModifiers(lateBind1P, lateBind2P) return TRUE; } -TMShortCard _XtGetModifierIndex(event) - Event *event; +TMShortCard _XtGetModifierIndex( + Event *event) { TMShortCard i, j = TM_MOD_SEGMENT_SIZE; TMShortCard modIndex = 0; @@ -331,14 +332,14 @@ TMShortCard _XtGetModifierIndex(event) LOCK_PROCESS; for (i = 0; i < _XtGlobalTM.numModMatchSegments; i++) { segment = _XtGlobalTM.modMatchSegmentTbl[i]; - for (j = 0; + for (j = 0; modIndex < _XtGlobalTM.numModMatches && j < TM_MOD_SEGMENT_SIZE; j++, modIndex++) { modMatch = &(segment[j]); - if (event->modifiers == modMatch->modifiers && - event->modifierMask == modMatch->modifierMask && - event->standard == modMatch->standard && - ((!event->lateModifiers && !modMatch->lateModifiers) || + if (event->modifiers == modMatch->modifiers && + event->modifierMask == modMatch->modifierMask && + event->standard == modMatch->standard && + ((!event->lateModifiers && !modMatch->lateModifiers) || CompareLateModifiers(event->lateModifiers, modMatch->lateModifiers))) { /* @@ -356,7 +357,7 @@ TMShortCard _XtGetModifierIndex(event) } } } - + if (j == TM_MOD_SEGMENT_SIZE) { if (_XtGlobalTM.numModMatchSegments == _XtGlobalTM.modMatchSegmentTblSize) { _XtGlobalTM.modMatchSegmentTblSize += 4; @@ -364,7 +365,7 @@ TMShortCard _XtGetModifierIndex(event) XtRealloc((char *)_XtGlobalTM.modMatchSegmentTbl, (_XtGlobalTM.modMatchSegmentTblSize * sizeof(TMModifierMatch))); } - _XtGlobalTM.modMatchSegmentTbl[_XtGlobalTM.numModMatchSegments++] = + _XtGlobalTM.modMatchSegmentTbl[_XtGlobalTM.numModMatchSegments++] = segment = (TMModifierMatch) __XtMalloc(TM_MOD_SEGMENT_SIZE * sizeof(TMModifierMatchRec)); j = 0; @@ -391,38 +392,38 @@ TMShortCard _XtGetModifierIndex(event) * This is called from the SimpleStateHandler to match a stateTree * entry to the event coming in */ -static int MatchBranchHead(stateTree, startIndex, event) - TMSimpleStateTree stateTree; - int startIndex; - TMEventPtr event; +static int MatchBranchHead( + TMSimpleStateTree stateTree, + int startIndex, + TMEventPtr event) { TMBranchHead branchHead = &stateTree->branchHeadTbl[startIndex]; int i; LOCK_PROCESS; for (i = startIndex; - i < (int)stateTree->numBranchHeads; + i < (int)stateTree->numBranchHeads; i++, branchHead++) { TMTypeMatch typeMatch; TMModifierMatch modMatch; - + typeMatch = TMGetTypeMatch(branchHead->typeIndex); modMatch = TMGetModifierMatch(branchHead->modIndex); - + if (MatchIncomingEvent(event, typeMatch, modMatch)) { UNLOCK_PROCESS; return i; } - } + } UNLOCK_PROCESS; return (TM_NO_MATCH); } -Boolean _XtRegularMatch(typeMatch, modMatch, eventSeq) - TMTypeMatch typeMatch; - TMModifierMatch modMatch; - TMEventPtr eventSeq; +Boolean _XtRegularMatch( + TMTypeMatch typeMatch, + TMModifierMatch modMatch, + TMEventPtr eventSeq) { Modifiers computed =0; Modifiers computedMask =0; @@ -442,14 +443,14 @@ Boolean _XtRegularMatch(typeMatch, modMatch, eventSeq) } /*ARGSUSED*/ -Boolean _XtMatchAtom(typeMatch, modMatch, eventSeq) - TMTypeMatch typeMatch; - TMModifierMatch modMatch; - TMEventPtr eventSeq; +Boolean _XtMatchAtom( + TMTypeMatch typeMatch, + TMModifierMatch modMatch, + TMEventPtr eventSeq) { Atom atom; - atom = XInternAtom(eventSeq->xev->xany.display, + atom = XInternAtom(eventSeq->xev->xany.display, XrmQuarkToString(typeMatch->eventCode), False); return (atom == eventSeq->event.eventCode); @@ -461,8 +462,8 @@ Boolean _XtMatchAtom(typeMatch, modMatch, eventSeq) * there are certain cases where you want to ignore the event and stay * in the same state. */ -static Boolean Ignore(event) - TMEventPtr event; +static Boolean Ignore( + TMEventPtr event) { Display *dpy; XtPerDisplay pd; @@ -479,9 +480,9 @@ static Boolean Ignore(event) } -static void XEventToTMEvent(event, tmEvent) - XEvent *event; - TMEventPtr tmEvent; +static void XEventToTMEvent( + XEvent *event, + TMEventPtr tmEvent) { tmEvent->xev = event; tmEvent->event.eventCodeMask = 0; @@ -560,9 +561,9 @@ static void XEventToTMEvent(event, tmEvent) } -static unsigned long GetTime(tm, event) - XtTM tm; - XEvent *event; +static unsigned long GetTime( + XtTM tm, + XEvent *event) { switch (event->type) { @@ -581,13 +582,13 @@ static unsigned long GetTime(tm, event) } -static void HandleActions(w, event, stateTree, accelWidget, procs, actions) - Widget w; - XEvent *event; - TMSimpleStateTree stateTree; - Widget accelWidget; - XtActionProc *procs; - ActionRec *actions; +static void HandleActions( + Widget w, + XEvent *event, + TMSimpleStateTree stateTree, + Widget accelWidget, + XtActionProc *procs, + ActionRec *actions) { ActionHook actionHookList; Widget bindWidget; @@ -611,10 +612,10 @@ static void HandleActions(w, event, stateTree, accelWidget, procs, actions) ActionHook next_hook; String procName = XrmQuarkToString(stateTree->quarkTbl[actions->idx] ); - + for (hook = actionHookList; hook != NULL; ) { /* - * Need to cache hook->next because the following action + * Need to cache hook->next because the following action * proc may free hook via XtRemoveActionHook making * hook->next invalid upon return from the action proc. */ @@ -630,7 +631,7 @@ static void HandleActions(w, event, stateTree, accelWidget, procs, actions) } } (*(procs[actions->idx])) - (bindWidget, event, + (bindWidget, event, actions->params, &actions->num_params ); } actions = actions->next; @@ -657,12 +658,12 @@ static TMContextRec contextCache[2]; #define TM_CONTEXT_MATCHES_ALLOC 4 #define TM_CONTEXT_MATCHES_REALLOC 2 -static void PushContext(contextPtr, newState) - TMContext *contextPtr; - StatePtr newState; +static void PushContext( + TMContext *contextPtr, + StatePtr newState) { TMContext context = *contextPtr; - + LOCK_PROCESS; if (context == NULL) { @@ -678,11 +679,11 @@ static void PushContext(contextPtr, newState) context->maxMatches = 0; } } - if (context->numMatches && + if (context->numMatches && context->matches[context->numMatches-1].isCycleEnd) { TMShortCard i; - for (i = 0; + for (i = 0; i < context->numMatches && !(context->matches[i].isCycleStart); i++){}; @@ -691,9 +692,9 @@ static void PushContext(contextPtr, newState) #ifdef DEBUG else XtWarning("pushing cycle end with no cycle start"); -#endif /* DEBUG */ +#endif /* DEBUG */ } - else + else { if (context->numMatches == context->maxMatches) { @@ -701,7 +702,7 @@ static void PushContext(contextPtr, newState) context->maxMatches += TM_CONTEXT_MATCHES_ALLOC; else context->maxMatches += TM_CONTEXT_MATCHES_REALLOC; - context->matches = (MatchPairRec *) + context->matches = (MatchPairRec *) XtRealloc((char *)context->matches, context->maxMatches * sizeof(MatchPairRec)); } @@ -714,8 +715,8 @@ static void PushContext(contextPtr, newState) UNLOCK_PROCESS; } -static void FreeContext(contextPtr) - TMContext *contextPtr; +static void FreeContext( + TMContext *contextPtr) { TMContext context = NULL; @@ -734,53 +735,54 @@ static void FreeContext(contextPtr) XtFree ((char *) ((*contextPtr)->matches)); XtFree((char *)*contextPtr); } - + *contextPtr = NULL; UNLOCK_PROCESS; } -static int MatchExact(stateTree, startIndex, typeIndex, modIndex) - TMSimpleStateTree stateTree; - int startIndex; - TMShortCard typeIndex, modIndex; +static int MatchExact( + TMSimpleStateTree stateTree, + int startIndex, + TMShortCard typeIndex, + TMShortCard modIndex) { TMBranchHead branchHead = &(stateTree->branchHeadTbl[startIndex]); int i; for (i = startIndex; - i < (int)stateTree->numBranchHeads; + i < (int)stateTree->numBranchHeads; i++, branchHead++) { if ((branchHead->typeIndex == typeIndex) && (branchHead->modIndex == modIndex)) return i; - } + } return (TM_NO_MATCH); } -static void HandleSimpleState(w, tmRecPtr, curEventPtr) - Widget w; - XtTM tmRecPtr; - TMEventRec *curEventPtr; -{ +static void HandleSimpleState( + Widget w, + XtTM tmRecPtr, + TMEventRec *curEventPtr) +{ XtTranslations xlations = tmRecPtr->translations; TMSimpleStateTree stateTree; TMContext *contextPtr = GetContextPtr(tmRecPtr); TMShortCard i; ActionRec *actions = NULL; Boolean matchExact = False; - Boolean match = False; + Boolean match = False; StatePtr complexMatchState = NULL; int currIndex; TMShortCard typeIndex = 0, modIndex = 0; int matchTreeIndex = TM_NO_MATCH; - + LOCK_PROCESS; stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0]; - - for (i = 0; + + for (i = 0; ((!match || !complexMatchState) && (i < xlations->numStateTrees)); i++){ stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i]; @@ -799,14 +801,14 @@ static void HandleSimpleState(w, tmRecPtr, curEventPtr) if (currIndex != TM_NO_MATCH) { TMBranchHead branchHead; StatePtr currState; - + branchHead = &stateTree->branchHeadTbl[currIndex]; if (branchHead->isSimple) currState = NULL; else currState = ((TMComplexStateTree)stateTree) ->complexBranchHeadTbl[TMBranchMore(branchHead)]; - + /* * first check for a complete match */ @@ -814,20 +816,20 @@ static void HandleSimpleState(w, tmRecPtr, curEventPtr) if (branchHead->hasActions) { if (branchHead->isSimple) { static ActionRec dummyAction; - + dummyAction.idx = TMBranchMore(branchHead); actions = &dummyAction; } - else + else actions = currState->actions; - tmRecPtr->lastEventTime = + tmRecPtr->lastEventTime = GetTime(tmRecPtr, curEventPtr->xev); FreeContext((TMContext *)&tmRecPtr->current_state); match = True; matchTreeIndex = i; } - /* + /* * if it doesn't have actions and * it's bc mode then it's a potential match node that is * used to match later sequences. @@ -840,11 +842,11 @@ static void HandleSimpleState(w, tmRecPtr, curEventPtr) } /* * check for it being an event sequence which can be - * a future match + * a future match */ if (!branchHead->isSimple && !branchHead->hasActions && - !complexMatchState) + !complexMatchState) complexMatchState = currState; } } @@ -862,14 +864,14 @@ static void HandleSimpleState(w, tmRecPtr, curEventPtr) accelWidget = bindProcs->widget; } else { - TMSimpleBindProcs bindProcs = + TMSimpleBindProcs bindProcs = TMGetSimpleBindEntry(bindData, matchTreeIndex); procs = bindProcs->procs; accelWidget = NULL; } HandleActions - (w, - curEventPtr->xev, + (w, + curEventPtr->xev, (TMSimpleStateTree)xlations->stateTreeTbl[matchTreeIndex], accelWidget, procs, @@ -880,11 +882,11 @@ static void HandleSimpleState(w, tmRecPtr, curEventPtr) UNLOCK_PROCESS; } -static int MatchComplexBranch(stateTree, startIndex, context, leafStateRtn) - TMComplexStateTree stateTree; - int startIndex; - TMContext context; - StatePtr *leafStateRtn; +static int MatchComplexBranch( + TMComplexStateTree stateTree, + int startIndex, + TMContext context, + StatePtr *leafStateRtn) { TMShortCard i; @@ -914,23 +916,23 @@ static int MatchComplexBranch(stateTree, startIndex, context, leafStateRtn) return (TM_NO_MATCH); } -static StatePtr TryCurrentTree(stateTreePtr, tmRecPtr, curEventPtr) - TMComplexStateTree *stateTreePtr; - XtTM tmRecPtr; - TMEventRec *curEventPtr; +static StatePtr TryCurrentTree( + TMComplexStateTree *stateTreePtr, + XtTM tmRecPtr, + TMEventRec *curEventPtr) { StatePtr candState = NULL, matchState = NULL; TMContext *contextPtr = GetContextPtr(tmRecPtr); TMTypeMatch typeMatch; TMModifierMatch modMatch; int currIndex = -1; - + /* * we want the first sequence that both matches and has actions. * we keep on looking till we find both */ LOCK_PROCESS; - while ((currIndex = + while ((currIndex = MatchComplexBranch(*stateTreePtr, ++currIndex, (*contextPtr), @@ -939,7 +941,7 @@ static StatePtr TryCurrentTree(stateTreePtr, tmRecPtr, curEventPtr) if (candState != NULL) { typeMatch = TMGetTypeMatch(candState->typeIndex); modMatch = TMGetModifierMatch(candState->modIndex); - + /* does this state's index match? --> done */ if (MatchIncomingEvent(curEventPtr, typeMatch, modMatch)) { @@ -953,24 +955,24 @@ static StatePtr TryCurrentTree(stateTreePtr, tmRecPtr, curEventPtr) /* is this an event timer? */ if (typeMatch->eventType == _XtEventTimerEventType) { StatePtr nextState = candState->nextLevel; - + /* does the succeeding state match? */ if (nextState != NULL) { TMTypeMatch nextTypeMatch; TMModifierMatch nextModMatch; - + nextTypeMatch = TMGetTypeMatch(nextState->typeIndex); nextModMatch = TMGetModifierMatch(nextState->modIndex); - + /* is it within the timeout? */ - if (MatchIncomingEvent(curEventPtr, - nextTypeMatch, + if (MatchIncomingEvent(curEventPtr, + nextTypeMatch, nextModMatch)) { XEvent *xev = curEventPtr->xev; unsigned long time = GetTime(tmRecPtr, xev); XtPerDisplay pd = _XtGetPerDisplay(xev->xany.display); unsigned long delta = pd->multi_click_time; - + if ((tmRecPtr->lastEventTime + delta) >= time) { if (nextState->actions) { UNLOCK_PROCESS; @@ -988,23 +990,23 @@ static StatePtr TryCurrentTree(stateTreePtr, tmRecPtr, curEventPtr) return matchState; } -static void HandleComplexState(w, tmRecPtr, curEventPtr) - Widget w; - XtTM tmRecPtr; - TMEventRec *curEventPtr; +static void HandleComplexState( + Widget w, + XtTM tmRecPtr, + TMEventRec *curEventPtr) { XtTranslations xlations = tmRecPtr->translations; TMContext *contextPtr = GetContextPtr(tmRecPtr); TMShortCard i, matchTreeIndex = 0; StatePtr matchState = NULL, candState; - TMComplexStateTree *stateTreePtr = + TMComplexStateTree *stateTreePtr = (TMComplexStateTree *)&xlations->stateTreeTbl[0]; LOCK_PROCESS; for (i = 0; i < xlations->numStateTrees; i++, stateTreePtr++) { - /* + /* * some compilers sign extend Boolean bit fields so test for * false ||| */ @@ -1033,7 +1035,7 @@ static void HandleComplexState(w, tmRecPtr, curEventPtr) XtActionProc *procs; Widget accelWidget; TMTypeMatch typeMatch; - + typeMatch = TMGetTypeMatch(matchState->typeIndex); PushContext(contextPtr, matchState); @@ -1050,13 +1052,13 @@ static void HandleComplexState(w, tmRecPtr, curEventPtr) accelWidget = bindProcs->widget; } else { - TMSimpleBindProcs bindProcs = + TMSimpleBindProcs bindProcs = TMGetSimpleBindEntry(bindData, matchTreeIndex); procs = bindProcs->procs; accelWidget = NULL; } - HandleActions(w, - curEventPtr->xev, + HandleActions(w, + curEventPtr->xev, (TMSimpleStateTree) xlations->stateTreeTbl[matchTreeIndex], accelWidget, @@ -1067,16 +1069,16 @@ static void HandleComplexState(w, tmRecPtr, curEventPtr) } -void _XtTranslateEvent (w, event) - Widget w; - XEvent * event; +void _XtTranslateEvent ( + Widget w, + XEvent * event) { XtTM tmRecPtr = &w->core.tm; TMEventRec curEvent; StatePtr current_state = tmRecPtr->current_state; XEventToTMEvent (event, &curEvent); - + if (! tmRecPtr->translations) { XtAppWarningMsg(XtWidgetToApplicationContext(w), XtNtranslationError,"nullTable",XtCXtToolkitError, @@ -1092,9 +1094,10 @@ void _XtTranslateEvent (w, event) /*ARGSUSED*/ -static StatePtr NewState(stateTree, typeIndex, modIndex) - TMParseStateTree stateTree; - TMShortCard typeIndex, modIndex; +static StatePtr NewState( + TMParseStateTree stateTree, + TMShortCard typeIndex, + TMShortCard modIndex) { StatePtr state = XtNew(StateRec); @@ -1115,10 +1118,10 @@ static StatePtr NewState(stateTree, typeIndex, modIndex) * This routine is an iterator for state trees. If the func returns * true then iteration is over. */ -void _XtTraverseStateTree(tree, func, data) - TMStateTree tree; - _XtTraversalProc func; - XtPointer data; +void _XtTraverseStateTree( + TMStateTree tree, + _XtTraversalProc func, + XtPointer data) { TMComplexStateTree stateTree = (TMComplexStateTree)tree; TMBranchHead currBH; @@ -1135,7 +1138,7 @@ void _XtTraverseStateTree(tree, func, data) for (; currState; currState = currState->nextLevel) { if (func(currState, data)) return; - if (currState->isCycleEnd) + if (currState->isCycleEnd) break; } } @@ -1163,9 +1166,9 @@ void _XtTraverseStateTree(tree, func, data) } } -static EventMask EventToMask(typeMatch, modMatch) - TMTypeMatch typeMatch; - TMModifierMatch modMatch; +static EventMask EventToMask( + TMTypeMatch typeMatch, + TMModifierMatch modMatch) { EventMask returnMask; unsigned long eventType = typeMatch->eventType; @@ -1205,20 +1208,20 @@ static EventMask EventToMask(typeMatch, modMatch) } /*ARGSUSED*/ -static void DispatchMappingNotify(widget, closure, call_data) - Widget widget; /* will be NULL from _RefreshMapping */ - XtPointer closure; /* real Widget */ - XtPointer call_data; /* XEvent* */ +static void DispatchMappingNotify( + Widget widget, /* will be NULL from _RefreshMapping */ + XtPointer closure, /* real Widget */ + XtPointer call_data) /* XEvent* */ { _XtTranslateEvent( (Widget)closure, (XEvent*)call_data); } - + /*ARGSUSED*/ -static void RemoveFromMappingCallbacks(widget, closure, call_data) - Widget widget; - XtPointer closure; /* target widget */ - XtPointer call_data; +static void RemoveFromMappingCallbacks( + Widget widget, + XtPointer closure, /* target widget */ + XtPointer call_data) { _XtRemoveCallback( &_XtGetPerDisplay(XtDisplay(widget))->mapping_callbacks, DispatchMappingNotify, @@ -1226,19 +1229,19 @@ static void RemoveFromMappingCallbacks(widget, closure, call_data) ); } -static Boolean AggregateEventMask(state, data) - StatePtr state; - XtPointer data; +static Boolean AggregateEventMask( + StatePtr state, + XtPointer data) { LOCK_PROCESS; - *((EventMask *)data) |= EventToMask(TMGetTypeMatch(state->typeIndex), + *((EventMask *)data) |= EventToMask(TMGetTypeMatch(state->typeIndex), TMGetModifierMatch(state->modIndex)); UNLOCK_PROCESS; return False; -} +} -void _XtInstallTranslations(widget) - Widget widget; +void _XtInstallTranslations( + Widget widget) { XtTranslations xlations; Cardinal i; @@ -1247,7 +1250,7 @@ void _XtInstallTranslations(widget) xlations = widget->core.tm.translations; if (xlations == NULL) return; - + /* * check for somebody stuffing the translations directly into the * instance structure. We will end up being called again out of @@ -1255,9 +1258,9 @@ void _XtInstallTranslations(widget) */ if (widget->core.tm.proc_table == NULL) { _XtMergeTranslations(widget, NULL, XtTableReplace); - /* + /* * if we're realized then we'll be called out of - * ComposeTranslations + * ComposeTranslations */ if (XtIsRealized(widget)) return; @@ -1270,7 +1273,7 @@ void _XtInstallTranslations(widget) { stateTree = xlations->stateTreeTbl[i]; _XtTraverseStateTree(stateTree, - AggregateEventMask, + AggregateEventMask, (XtPointer)&xlations->eventMask); mappingNotifyInterest |= stateTree->simple.mappingNotifyInterest; } @@ -1310,15 +1313,15 @@ void _XtInstallTranslations(widget) _XtRegisterGrabs(widget); } -void _XtRemoveTranslations(widget) - Widget widget; +void _XtRemoveTranslations( + Widget widget) { Cardinal i; TMSimpleStateTree stateTree; Boolean mappingNotifyInterest = False; XtTranslations xlations = widget->core.tm.translations; - - if (xlations == NULL) + + if (xlations == NULL) return; for (i = 0; @@ -1332,21 +1335,21 @@ void _XtRemoveTranslations(widget) RemoveFromMappingCallbacks(widget, (XtPointer)widget, NULL); } -static void _XtUninstallTranslations(widget) - Widget widget; +static void _XtUninstallTranslations( + Widget widget) { XtTranslations xlations = widget->core.tm.translations; - _XtUnbindActions(widget, - xlations, + _XtUnbindActions(widget, + xlations, (TMBindData)widget->core.tm.proc_table); _XtRemoveTranslations(widget); widget->core.tm.translations = NULL; FreeContext((TMContext *)&widget->core.tm.current_state); } -void _XtDestroyTMData(widget) - Widget widget; +void _XtDestroyTMData( + Widget widget) { TMComplexBindData cBindData; @@ -1355,7 +1358,7 @@ void _XtDestroyTMData(widget) if ((cBindData = (TMComplexBindData)widget->core.tm.proc_table)) { if (cBindData->isComplex) { ATranslations aXlations, nXlations; - + nXlations = (ATranslations) cBindData->accel_context; while (nXlations){ aXlations = nXlations; @@ -1370,8 +1373,8 @@ void _XtDestroyTMData(widget) /*** Public procedures ***/ -void XtUninstallTranslations(widget) - Widget widget; +void XtUninstallTranslations( + Widget widget) { EventMask oldMask; Widget hookobj; @@ -1385,7 +1388,7 @@ void XtUninstallTranslations(widget) oldMask = widget->core.tm.translations->eventMask; _XtUninstallTranslations(widget); if (XtIsRealized(widget) && oldMask) - XSelectInput(XtDisplay(widget), XtWindow(widget), + XSelectInput(XtDisplay(widget), XtWindow(widget), XtBuildEventMask(widget)); hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget)); if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { @@ -1393,8 +1396,8 @@ void XtUninstallTranslations(widget) call_data.type = XtHuninstallTranslations; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_APP(app); @@ -1439,8 +1442,8 @@ XtTranslations _XtCreateXlations( return xlations; } -TMStateTree _XtParseTreeToStateTree(parseTree) - TMParseStateTree parseTree; +TMStateTree _XtParseTreeToStateTree( + TMParseStateTree parseTree) { TMSimpleStateTree simpleTree; unsigned int tableSize; @@ -1450,12 +1453,12 @@ TMStateTree _XtParseTreeToStateTree(parseTree) complexTree = XtNew(TMComplexStateTreeRec); complexTree->isSimple = False; - tableSize = parseTree->numComplexBranchHeads * sizeof(StatePtr); + tableSize = parseTree->numComplexBranchHeads * sizeof(StatePtr); complexTree->complexBranchHeadTbl = (StatePtr *) __XtMalloc(tableSize); XtMemmove(complexTree->complexBranchHeadTbl, parseTree->complexBranchHeadTbl, tableSize); - complexTree->numComplexBranchHeads = + complexTree->numComplexBranchHeads = parseTree->numComplexBranchHeads; simpleTree = (TMSimpleStateTree)complexTree; } @@ -1481,8 +1484,8 @@ TMStateTree _XtParseTreeToStateTree(parseTree) return (TMStateTree)simpleTree; } -static void FreeActions(actions) - ActionPtr actions; +static void FreeActions( + ActionPtr actions) { ActionPtr action; TMShortCard i; @@ -1498,10 +1501,10 @@ static void FreeActions(actions) } /*ARGSUSED*/ -static void AmbigActions(initialEvent, state, stateTree) - EventSeqPtr initialEvent; - StatePtr *state; - TMParseStateTree stateTree; +static void AmbigActions( + EventSeqPtr initialEvent, + StatePtr *state, + TMParseStateTree stateTree) { String params[3]; Cardinal numParams = 0; @@ -1519,7 +1522,7 @@ static void AmbigActions(initialEvent, state, stateTree) XtWarningMsg (XtNtranslationError,"newActions",XtCXtToolkitError, "New actions are:%s", params, &numParams); XtFree((char *)params[0]); - XtWarningMsg (XtNtranslationError,"ambiguousActions", + XtWarningMsg (XtNtranslationError,"ambiguousActions", XtCXtToolkitError, "Overriding earlier translation manager actions.", (String *)NULL, (Cardinal *)NULL); @@ -1529,9 +1532,9 @@ static void AmbigActions(initialEvent, state, stateTree) } -void _XtAddEventSeqToStateTree(eventSeq, stateTree) - EventSeqPtr eventSeq; - TMParseStateTree stateTree; +void _XtAddEventSeqToStateTree( + EventSeqPtr eventSeq, + TMParseStateTree stateTree) { StatePtr *state; EventSeqPtr initialEvent = eventSeq; @@ -1555,13 +1558,13 @@ void _XtAddEventSeqToStateTree(eventSeq, stateTree) /* * Need to check for pre-existing actions with same lhs ||| */ - + /* * Check for optimized case. Don't assume that the eventSeq has actions. */ - if (!eventSeq->next && - eventSeq->actions && - !eventSeq->actions->next && + if (!eventSeq->next && + eventSeq->actions && + !eventSeq->actions->next && !eventSeq->actions->num_params) { if (eventSeq->event.eventType == MappingNotify) @@ -1572,22 +1575,22 @@ void _XtAddEventSeqToStateTree(eventSeq, stateTree) eventSeq->actions = NULL; return; } - + branchHead->isSimple = False; if (!eventSeq->next) branchHead->hasActions = True; branchHead->more = GetComplexBranchIndex(stateTree, typeIndex, modIndex); state = &stateTree->complexBranchHeadTbl[TMBranchMore(branchHead)]; - + for (;;) { *state = NewState(stateTree, typeIndex, modIndex); - + if (eventSeq->event.eventType == MappingNotify) stateTree->mappingNotifyInterest = True; - + /* *state now points at state record matching event */ eventSeq->state = *state; - + if (eventSeq->actions != NULL) { if ((*state)->actions != NULL) AmbigActions(initialEvent, state, stateTree); @@ -1607,7 +1610,7 @@ void _XtAddEventSeqToStateTree(eventSeq, stateTree) modIndex = _XtGetModifierIndex(&eventSeq->event); LOCK_PROCESS; if (!TMNewMatchSemantics()) { - /* + /* * force a potential empty entry into the branch head * table in order to emulate old matching behavior */ @@ -1631,12 +1634,13 @@ void _XtAddEventSeqToStateTree(eventSeq, stateTree) */ /*ARGSUSED*/ -Boolean _XtCvtMergeTranslations(dpy, args, num_args, from, to, closure_ret) - Display *dpy; - XrmValuePtr args; - Cardinal *num_args; - XrmValuePtr from,to; - XtPointer *closure_ret; +Boolean _XtCvtMergeTranslations( + Display *dpy, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *closure_ret) { XtTranslations first, second, xlations; TMStateTree *stateTrees, stackStateTrees[16]; @@ -1651,7 +1655,7 @@ Boolean _XtCvtMergeTranslations(dpy, args, num_args, from, to, closure_ret) to->size = sizeof(XtTranslations); return False; } - + first = ((TMConvertRec*)from->addr)->old; second = ((TMConvertRec*)from->addr)->new; @@ -1682,9 +1686,10 @@ Boolean _XtCvtMergeTranslations(dpy, args, num_args, from, to, closure_ret) } -static XtTranslations MergeThem(dest, first, second) - Widget dest; - XtTranslations first, second; +static XtTranslations MergeThem( + Widget dest, + XtTranslations first, + XtTranslations second) { XtCacheRef cache_ref; static XrmQuark from_type = NULLQUARK, to_type; @@ -1710,7 +1715,7 @@ static XtTranslations MergeThem(dest, first, second) UNLOCK_PROCESS; return NULL; } - UNLOCK_PROCESS; + UNLOCK_PROCESS; #ifndef REFCNT_TRANSLATIONS @@ -1730,21 +1735,22 @@ static XtTranslations MergeThem(dest, first, second) * the potential that an xlation will be both an accelerator and * normal. This is not supported by the spec anyway. */ -static XtTranslations UnmergeTranslations(widget, xlations, unmergeXlations, - currIndex, - oldBindings, numOldBindings, - newBindings, numNewBindingsRtn) - Widget widget; - XtTranslations xlations, unmergeXlations; - TMComplexBindProcs oldBindings, newBindings; - TMShortCard currIndex, numOldBindings, *numNewBindingsRtn; +static XtTranslations UnmergeTranslations( + Widget widget, + XtTranslations xlations, + XtTranslations unmergeXlations, + TMShortCard currIndex, + TMComplexBindProcs oldBindings, + TMShortCard numOldBindings, + TMComplexBindProcs newBindings, + TMShortCard *numNewBindingsRtn) { XtTranslations first, second, result; - + if (!xlations || (xlations == unmergeXlations)) return NULL; - + if (xlations->composers[0]) { first = UnmergeTranslations(widget, xlations->composers[0], unmergeXlations, currIndex, @@ -1753,11 +1759,11 @@ static XtTranslations UnmergeTranslations(widget, xlations, unmergeXlations, } else first = NULL; - + if (xlations->composers[1]) { second = UnmergeTranslations(widget, xlations->composers[1], - unmergeXlations, - currIndex + + unmergeXlations, + currIndex + xlations->composers[0]->numStateTrees, oldBindings, numOldBindings, newBindings, numNewBindingsRtn); @@ -1798,15 +1804,15 @@ typedef struct { TMComplexBindProcs bindings; }MergeBindRec, *MergeBind; -static XtTranslations MergeTranslations(widget, oldXlations, newXlations, - operation, source, oldBindings, - newBindings, numNewRtn) - Widget widget; - XtTranslations oldXlations, newXlations; - _XtTranslateOp operation; - TMComplexBindProcs oldBindings, newBindings; - Widget source; - TMShortCard *numNewRtn; +static XtTranslations MergeTranslations( + Widget widget, + XtTranslations oldXlations, + XtTranslations newXlations, + _XtTranslateOp operation, + Widget source, + TMComplexBindProcs oldBindings, + TMComplexBindProcs newBindings, + TMShortCard *numNewRtn) { XtTranslations newTable = NULL, xlations; TMComplexBindProcs bindings; @@ -1817,7 +1823,7 @@ static XtTranslations MergeTranslations(widget, oldXlations, newXlations, /* If the new translation has an accelerator context then pull it * off and pass it and the real xlations in to the caching merge - * routine. + * routine. */ if (newXlations->hasBindings) { xlations = ((ATranslations) newXlations)->xlations; @@ -1852,7 +1858,7 @@ static XtTranslations MergeTranslations(widget, oldXlations, newXlations, } if (!newTable) newTable = MergeThem(widget, bindPair[0].xlations, bindPair[1].xlations); - + for (i = 0, numNew = 0; i < 2; i++) { if (bindPair[i].xlations) for (j = 0; j < bindPair[i].xlations->numStateTrees; j++, numNew++) { @@ -1861,7 +1867,7 @@ static XtTranslations MergeTranslations(widget, oldXlations, newXlations, newBindings[numNew] = bindPair[i].bindings[j]; else { newBindings[numNew].widget = source; - newBindings[numNew].aXlations = + newBindings[numNew].aXlations = bindPair[i].xlations; } } @@ -1874,43 +1880,43 @@ static XtTranslations MergeTranslations(widget, oldXlations, newXlations, return newTable; } -static TMBindData MakeBindData(bindings, numBindings, oldBindData) - TMComplexBindProcs bindings; - TMShortCard numBindings; - TMBindData oldBindData; +static TMBindData MakeBindData( + TMComplexBindProcs bindings, + TMShortCard numBindings, + TMBindData oldBindData) { TMLongCard bytes; TMShortCard i; Boolean isComplex; TMBindData bindData; - if (numBindings == 0) + if (numBindings == 0) return NULL; for (i = 0; i < numBindings; i++) if (bindings[i].widget) break; isComplex = (i < numBindings); if (isComplex) - bytes = (sizeof(TMComplexBindDataRec) + - ((numBindings - 1) * + bytes = (sizeof(TMComplexBindDataRec) + + ((numBindings - 1) * sizeof(TMComplexBindProcsRec))); else - bytes = (sizeof(TMSimpleBindDataRec) + - ((numBindings - 1) * + bytes = (sizeof(TMSimpleBindDataRec) + + ((numBindings - 1) * sizeof(TMSimpleBindProcsRec))); bindData = (TMBindData) __XtCalloc(sizeof(char), bytes); bindData->simple.isComplex = isComplex; if (isComplex) { TMComplexBindData cBindData = (TMComplexBindData)bindData; - /* + /* * If there were any accelerator contexts in the old bindData * then propagate them to the new one. */ if (oldBindData && oldBindData->simple.isComplex) - cBindData->accel_context = + cBindData->accel_context = ((TMComplexBindData) oldBindData)->accel_context; - XtMemmove((char *)&cBindData->bindTbl[0], (char *)bindings, + XtMemmove((char *)&cBindData->bindTbl[0], (char *)bindings, numBindings * sizeof(TMComplexBindProcsRec)); } return bindData; @@ -1920,12 +1926,13 @@ static TMBindData MakeBindData(bindings, numBindings, oldBindData) * This routine is the central clearinghouse for merging translations * into a widget. It takes care of preping the action bindings for * realize time and calling the converter or doing a straight merge if - * the destination is empty. + * the destination is empty. */ -static Boolean ComposeTranslations(dest, operation, source, newXlations) - Widget dest, source; - _XtTranslateOp operation; - XtTranslations newXlations; +static Boolean ComposeTranslations( + Widget dest, + _XtTranslateOp operation, + Widget source, + XtTranslations newXlations) { XtTranslations newTable, oldXlations; XtTranslations accNewXlations; @@ -1956,11 +1963,11 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) if (!(oldXlations = dest->core.tm.translations)) operation = XtTableReplace; - /* + /* * try to avoid generation of duplicate state trees. If the source * isn't simple (1 state Tree) then it's too much hassle */ - if (((operation == XtTableAugment) || + if (((operation == XtTableAugment) || (operation == XtTableOverride)) && (newXlations->numStateTrees == 1)) { Cardinal i; @@ -1970,9 +1977,9 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) break; if (i < oldXlations->numStateTrees) { if (operation == XtTableAugment) { - /* + /* * we don't need to do anything since it's already - * there + * there */ return True; } @@ -2009,7 +2016,7 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) XtBZero((char *)newBindings, numBytes); if (operation == XtTableUnmerge) { - newTable = UnmergeTranslations(dest, + newTable = UnmergeTranslations(dest, oldXlations, newXlations, 0, @@ -2025,7 +2032,7 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) #endif /* DEBUG */ } else { - newTable = MergeTranslations(dest, + newTable = MergeTranslations(dest, oldXlations, accNewXlations, operation, @@ -2040,10 +2047,10 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) oldMask = oldXlations->eventMask; _XtUninstallTranslations(dest); } - - dest->core.tm.proc_table = + + dest->core.tm.proc_table = (XtActionProc *) MakeBindData(newBindings, numNewBindings, bindData); - + if (bindData) XtFree((char *)bindData); dest->core.tm.translations = newTable; @@ -2054,7 +2061,7 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) if (newTable) mask = newTable->eventMask; if (mask != oldMask) - XSelectInput(XtDisplay(dest), XtWindow(dest), + XSelectInput(XtDisplay(dest), XtWindow(dest), XtBuildEventMask(dest)); } XtStackFree((XtPointer)newBindings, (XtPointer)stackBindings); @@ -2069,8 +2076,8 @@ static Boolean ComposeTranslations(dest, operation, source, newXlations) * that we return (via a linked list pointed to from the bindData) and * free it at destroy time. */ -XtTranslations _XtGetTranslationValue(w) - Widget w; +XtTranslations _XtGetTranslationValue( + Widget w) { XtTM tmRecPtr = (XtTM) &w->core.tm; ATranslations *aXlationsPtr; @@ -2090,13 +2097,13 @@ XtTranslations _XtGetTranslationValue(w) ; if (*aXlationsPtr) return (XtTranslations) *aXlationsPtr; - else { + else { /* create a new aXlations context */ ATranslations aXlations; Cardinal numBindings = xlations->numStateTrees; (*aXlationsPtr) = aXlations = (ATranslations) - __XtMalloc(sizeof(ATranslationData) + + __XtMalloc(sizeof(ATranslationData) + (numBindings - 1) * sizeof(TMComplexBindProcsRec)); aXlations->hasBindings = True; @@ -2111,10 +2118,10 @@ XtTranslations _XtGetTranslationValue(w) /*ARGSUSED*/ -static void RemoveStateTree(tree) - TMStateTree tree; +static void RemoveStateTree( + TMStateTree tree) { -#ifdef REFCNT_TRANSLATIONS +#ifdef REFCNT_TRANSLATIONS TMComplexStateTree stateTree = (TMComplexStateTree)tree; if (--stateTree->refCount == 0) { @@ -2125,8 +2132,8 @@ static void RemoveStateTree(tree) StatePtr currState, nextState; TMShortCard i; for (i = 0; i < stateTree->numComplexBranchHeads; i++) { - currState = - nextState = + currState = + nextState = stateTree->complexBranchHeadTbl[i]; for (; nextState;){ FreeActions(currState->actions); @@ -2146,9 +2153,9 @@ static void RemoveStateTree(tree) #endif /* REFCNT_TRANSLATIONS */ } -void _XtRemoveStateTreeByIndex(xlations, i) - XtTranslations xlations; - TMShortCard i; +void _XtRemoveStateTreeByIndex( + XtTranslations xlations, + TMShortCard i) { TMStateTree *stateTrees = xlations->stateTreeTbl; @@ -2162,12 +2169,12 @@ void _XtRemoveStateTreeByIndex(xlations, i) } /* ARGSUSED */ -void _XtFreeTranslations(app, toVal, closure, args, num_args) - XtAppContext app; - XrmValuePtr toVal; - XtPointer closure; - XrmValuePtr args; - Cardinal *num_args; +void _XtFreeTranslations( + XtAppContext app, + XrmValuePtr toVal, + XtPointer closure, + XrmValuePtr args, + Cardinal *num_args) { XtTranslations xlations; int i; @@ -2187,8 +2194,8 @@ void _XtFreeTranslations(app, toVal, closure, args, num_args) /* The spec is not clear on when actions specified in accelerators are bound; * Bind them at Realize the same as translations */ -void XtInstallAccelerators(destination, source) - Widget destination, source; +void XtInstallAccelerators( + Widget destination, Widget source) { XtTranslations aXlations; _XtTranslateOp op; @@ -2202,20 +2209,20 @@ void XtInstallAccelerators(destination, source) */ LOCK_APP(app); LOCK_PROCESS; - if ((!XtIsWidget(source)) || + if ((!XtIsWidget(source)) || ((aXlations = source->core.accelerators) == NULL) || (aXlations->stateTreeTbl[0]->simple.isAccelerator == False)) { UNLOCK_PROCESS; UNLOCK_APP(app); return; } - + aXlations = source->core.accelerators; op = aXlations->operation; if (ComposeTranslations(destination, op, source, aXlations) && (XtClass(source)->core_class.display_accelerator != NULL)) { - + buf = _XtPrintXlations(destination, aXlations, source, False); (*(XtClass(source)->core_class.display_accelerator))(source,buf); XtFree(buf); @@ -2223,11 +2230,12 @@ void XtInstallAccelerators(destination, source) UNLOCK_PROCESS; UNLOCK_APP(app); } - -void XtInstallAllAccelerators(destination,source) - Widget destination,source; + +void XtInstallAllAccelerators( + Widget destination, + Widget source) { - int i; + Cardinal i; CompositeWidget cw; WIDGET_TO_APPCON(destination); @@ -2254,8 +2262,8 @@ void XtInstallAllAccelerators(destination,source) } #if 0 /* dead code */ -static _XtTranslateOp _XtGetTMOperation(xlations) - XtTranslations xlations; +static _XtTranslateOp _XtGetTMOperation( + XtTranslations xlations) { return ((xlations->hasBindings) ? ((ATranslations)xlations)->xlations->operation @@ -2263,9 +2271,9 @@ static _XtTranslateOp _XtGetTMOperation(xlations) } #endif -void XtAugmentTranslations(widget, new) - Widget widget; - XtTranslations new; +void XtAugmentTranslations( + Widget widget, + XtTranslations new) { Widget hookobj; WIDGET_TO_APPCON(widget); @@ -2279,17 +2287,17 @@ void XtAugmentTranslations(widget, new) call_data.type = XtHaugmentTranslations; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_PROCESS; UNLOCK_APP(app); } -void XtOverrideTranslations(widget, new) - Widget widget; - XtTranslations new; +void XtOverrideTranslations( + Widget widget, + XtTranslations new) { Widget hookobj; WIDGET_TO_APPCON(widget); @@ -2303,18 +2311,18 @@ void XtOverrideTranslations(widget, new) call_data.type = XtHoverrideTranslations; call_data.widget = widget; - XtCallCallbackList(hookobj, - ((HookObject)hookobj)->hooks.changehook_callbacks, + XtCallCallbackList(hookobj, + ((HookObject)hookobj)->hooks.changehook_callbacks, (XtPointer)&call_data); } UNLOCK_PROCESS; UNLOCK_APP(app); } -void _XtMergeTranslations(widget, newXlations, op) - Widget widget; - XtTranslations newXlations; - _XtTranslateOp op; +void _XtMergeTranslations( + Widget widget, + XtTranslations newXlations, + _XtTranslateOp op) { if (!newXlations){ if (!widget->core.tm.translations) @@ -2324,15 +2332,15 @@ void _XtMergeTranslations(widget, newXlations, op) widget->core.tm.translations = NULL; } } - (void) ComposeTranslations(widget, + (void) ComposeTranslations(widget, op, - (Widget)NULL, + (Widget)NULL, newXlations); } -void _XtUnmergeTranslations(widget, xlations) - Widget widget; - XtTranslations xlations; +void _XtUnmergeTranslations( + Widget widget, + XtTranslations xlations) { ComposeTranslations(widget, XtTableUnmerge, (Widget)NULL, xlations); } diff --git a/src/Threads.c b/src/Threads.c index 766ef1c..09af93d 100644 --- a/src/Threads.c +++ b/src/Threads.c @@ -10,11 +10,11 @@ software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- -mentation, and that the name Sun not be used in advertising -or publicity pertaining to distribution of the software -without specific prior written permission. Sun makes no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or +mentation, and that the name Sun not be used in advertising +or publicity pertaining to distribution of the software +without specific prior written permission. Sun makes no +representations about the suitability of this software for +any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, @@ -109,7 +109,7 @@ InitProcessLock(void) } } -static void +static void ProcessLock(void) { #ifdef _XMUTEX_NESTS @@ -117,31 +117,31 @@ ProcessLock(void) process_lock->level++; #else xthread_t this_thread = xthread_self(); - + xmutex_lock(process_lock->mutex); - + if (!xthread_have_id(process_lock->holder)) { process_lock->holder = this_thread; xmutex_unlock(process_lock->mutex); return; } - + if (xthread_equal(process_lock->holder,this_thread)) { process_lock->level++; xmutex_unlock(process_lock->mutex); return; } - + while(xthread_have_id(process_lock->holder)) xcondition_wait(process_lock->cond, process_lock->mutex); - + process_lock->holder = this_thread; assert(xthread_equal(process_lock->holder, this_thread)); xmutex_unlock(process_lock->mutex); #endif } -static void +static void ProcessUnlock(void) { #ifdef _XMUTEX_NESTS @@ -155,10 +155,10 @@ ProcessUnlock(void) xmutex_unlock(process_lock->mutex); return; } - + xthread_clear_id(process_lock->holder); xcondition_signal(process_lock->cond); - + xmutex_unlock(process_lock->mutex); #endif } @@ -236,10 +236,10 @@ YieldAppLock( *push_thread = FALSE; *pushed_thread = TRUE; - if(app_lock->stack.sp == app_lock->stack.size - 1) { - int ii; - app_lock->stack.st = (struct _Tstack *) - XtRealloc ((char *)app_lock->stack.st, + if(app_lock->stack.sp == (int)app_lock->stack.size - 1) { + unsigned ii; + app_lock->stack.st = (struct _Tstack *) + XtRealloc ((char *)app_lock->stack.st, (app_lock->stack.size + STACK_INCR) * sizeof (struct _Tstack)); ii = app_lock->stack.size; app_lock->stack.size += STACK_INCR; @@ -265,7 +265,7 @@ YieldAppLock( static void RestoreAppLock( - XtAppContext app, + XtAppContext app, int level, Boolean* pushed_thread) { @@ -301,7 +301,7 @@ RestoreAppLock( #else app_lock->holder = self; app_lock->level = level; - assert(xthread_equal(app_lock->holder, self)); + assert(xthread_equal(app_lock->holder, self)); #endif if (*pushed_thread) { *pushed_thread = FALSE; @@ -318,7 +318,7 @@ RestoreAppLock( static void FreeAppLock(XtAppContext app) { - int ii; + unsigned ii; LockPtr app_lock = app->lock_info; if(app_lock) { @@ -360,10 +360,10 @@ InitAppLock(XtAppContext app) app_lock->cond = xcondition_malloc(); xcondition_init(app_lock->cond); xthread_clear_id(app_lock->holder); -#endif +#endif app_lock->stack.size = STACK_INCR; app_lock->stack.sp = -1; - app_lock->stack.st = + app_lock->stack.st = (struct _Tstack *)__XtMalloc(sizeof(struct _Tstack)*STACK_INCR); for (ii = 0; ii < STACK_INCR; ii++) { app_lock->stack.st[ii].c = xcondition_malloc(); @@ -405,7 +405,7 @@ void XtProcessUnlock(void) #endif } -Boolean XtToolkitThreadInitialize() +Boolean XtToolkitThreadInitialize(void) { #ifdef XTHREADS if (_XtProcessLock == NULL) { diff --git a/src/VarGet.c b/src/VarGet.c index e87865f..37db500 100644 --- a/src/VarGet.c +++ b/src/VarGet.c @@ -79,17 +79,17 @@ XtVaGetSubresources( va_start(var, num_resources); _XtCountVaList(var, &total_count, &typed_count); va_end(var); - + va_start(var, num_resources); - + _XtVaToTypedArgList(var, total_count, &args, &num_args); - _XtGetSubresources(widget, base, name, class, resources, num_resources, + _XtGetSubresources(widget, base, name, class, resources, num_resources, NULL, 0, args, num_args); if (num_args != 0) { XtFree((XtPointer)args); - } + } va_end(var); UNLOCK_APP(app); @@ -100,8 +100,8 @@ void XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resources, Cardinal num_resources, ...) { va_list var; - XtTypedArgList args; - Cardinal num_args; + XtTypedArgList args; + Cardinal num_args; int total_count, typed_count; WIDGET_TO_APPCON(widget); @@ -109,34 +109,34 @@ XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resour va_start(var,num_resources); _XtCountVaList(var, &total_count, &typed_count); va_end(var); - - va_start(var,num_resources); + + va_start(var,num_resources); _XtVaToTypedArgList(var, total_count, &args, &num_args); - - _XtGetApplicationResources(widget, base, resources, num_resources, - NULL, 0, args, num_args); + + _XtGetApplicationResources(widget, base, resources, num_resources, + NULL, 0, args, num_args); if (num_args != 0) { XtFree((XtPointer)args); - } + } - va_end(var); + va_end(var); UNLOCK_APP(app); -} +} static void -GetTypedArg(widget, typed_arg, resources, num_resources) - Widget widget; - XtTypedArgList typed_arg; - XtResourceList resources; - Cardinal num_resources; +GetTypedArg( + Widget widget, + XtTypedArgList typed_arg, + XtResourceList resources, + Cardinal num_resources) { String from_type = NULL; Cardinal from_size = 0; XrmValue from_val, to_val; - register int i; + register Cardinal i; Arg arg; XtPointer value; @@ -148,7 +148,7 @@ GetTypedArg(widget, typed_arg, resources, num_resources) from_size = resources[i].resource_size; break; } - } + } if (i == num_resources) { XtAppWarningMsg(XtWidgetToApplicationContext(widget), @@ -170,7 +170,7 @@ GetTypedArg(widget, typed_arg, resources, num_resources) if (!XtConvertAndStore(widget, from_type, &from_val, typed_arg->type, &to_val)) { - if (to_val.size > typed_arg->size) { + if (to_val.size > (unsigned) typed_arg->size) { String params[2]; Cardinal num_params = 2; params[0] = typed_arg->type; @@ -196,15 +196,15 @@ GetTypedArg(widget, typed_arg, resources, num_resources) } static int -GetNestedArg(widget, avlist, args, resources, num_resources) - Widget widget; - XtTypedArgList avlist; - ArgList args; - XtResourceList resources; - Cardinal num_resources; +GetNestedArg( + Widget widget, + XtTypedArgList avlist, + ArgList args, + XtResourceList resources, + Cardinal num_resources) { int count = 0; - + for (; avlist->name != NULL; avlist++) { if (avlist->type != NULL) { GetTypedArg(widget, avlist, resources, num_resources); @@ -216,8 +216,8 @@ GetNestedArg(widget, avlist, args, resources, num_resources) (args+count)->value = avlist->value; ++count; } - } - + } + return(count); } @@ -239,7 +239,7 @@ XtVaGetValues(Widget widget, ...) _XtCountVaList(var, &total_count, &typed_count); if (total_count != typed_count) { - args = (ArgList)__XtMalloc((unsigned)((total_count - typed_count) + args = (ArgList)__XtMalloc((unsigned)((total_count - typed_count) * sizeof(Arg))); } else args = NULL; /* for lint; really unused */ @@ -274,8 +274,8 @@ XtVaGetValues(Widget widget, ...) } va_end(var); - if (resources != (XtResourceList)NULL) { - XtFree((XtPointer)resources); + if (resources != (XtResourceList)NULL) { + XtFree((XtPointer)resources); } if (total_count != typed_count) { @@ -291,7 +291,7 @@ XtVaGetSubvalues(XtPointer base,XtResourceList resources, Cardinal num_resource va_list var; ArgList args; Cardinal num_args; - int total_count, typed_count; + int total_count, typed_count; va_start(var,num_resources); @@ -310,5 +310,5 @@ XtVaGetSubvalues(XtPointer base,XtResourceList resources, Cardinal num_resource if (num_args != 0) { XtFree((XtPointer)args); - } + } } diff --git a/src/Varargs.c b/src/Varargs.c index d0db287..270391d 100644 --- a/src/Varargs.c +++ b/src/Varargs.c @@ -54,7 +54,7 @@ _XtCountNestedList( } ++(*total_count); } - } + } } @@ -68,10 +68,10 @@ void _XtCountVaList(va_list var, int* total_count, int* typed_count) { String attr; - + *total_count = 0; *typed_count = 0; - + for(attr = va_arg(var, String) ; attr != NULL; attr = va_arg(var, String)) { if (strcmp(attr, XtVaTypedArg) == 0) { @@ -92,9 +92,9 @@ _XtCountVaList(va_list var, int* total_count, int* typed_count) } -/* +/* * Given a variable length attribute-value list, XtVaCreateArgsList() - * constructs an attribute-value list of type XtTypedArgList and + * constructs an attribute-value list of type XtTypedArgList and * returns the list. */ XtVarArgsList @@ -140,7 +140,7 @@ XtTypedArgList _XtVaCreateTypedArgList(va_list var, register int count) avlist = (XtTypedArgList) __XtCalloc((int)count + 1, (unsigned)sizeof(XtTypedArg)); - for(attr = va_arg(var, String), count = 0; attr != NULL; + for(attr = va_arg(var, String), count = 0; attr != NULL; attr = va_arg(var, String)) { if (strcmp(attr, XtVaTypedArg) == 0) { avlist[count].name = va_arg(var, String); @@ -164,7 +164,7 @@ XtTypedArgList _XtVaCreateTypedArgList(va_list var, register int count) * TypedArgToArg() invokes a resource converter to convert the * passed typed arg into a name/value pair and stores the name/value * pair in the passed Arg structure. If memory is allocated for the - * converted value, the address is returned in the value field of + * converted value, the address is returned in the value field of * memory_return; otherwise that field is NULL. The function returns * 1 if the conversion succeeded and 0 if the conversion failed. */ @@ -176,10 +176,10 @@ TypedArgToArg( XtResourceList resources, Cardinal num_resources, ArgList memory_return) -{ +{ String to_type = NULL; XrmValue from_val, to_val; - + if (widget == NULL) { XtAppWarningMsg(XtWidgetToApplicationContext(widget), @@ -188,7 +188,7 @@ TypedArgToArg( (String *)NULL, (Cardinal *)NULL); return(0); } - + /* again we assume that the XtResourceList is un-compiled */ for (; num_resources--; resources++) @@ -204,11 +204,11 @@ TypedArgToArg( (String *)NULL, (Cardinal *)NULL); return(0); } - + to_val.addr = NULL; from_val.size = typed_arg->size; if ((strcmp(typed_arg->type, XtRString) == 0) || - (typed_arg->size > sizeof(XtArgVal))) { + ((unsigned) typed_arg->size > sizeof(XtArgVal))) { from_val.addr = (XPointer)typed_arg->value; } else { from_val.addr = (XPointer)&typed_arg->value; @@ -216,7 +216,7 @@ TypedArgToArg( LOCK_PROCESS; XtConvertAndStore(widget, typed_arg->type, &from_val, to_type, &to_val); - + if (to_val.addr == NULL) { UNLOCK_PROCESS; XtAppWarningMsg(XtWidgetToApplicationContext(widget), @@ -247,7 +247,7 @@ TypedArgToArg( } } UNLOCK_PROCESS; - + return(1); } @@ -266,7 +266,7 @@ NestedArgtoArg( ArgList memory_return) { int count = 0; - + for (; avlist->name != NULL; avlist++) { if (avlist->type != NULL) { /* If widget is NULL, the typed arg is ignored */ @@ -328,10 +328,10 @@ _XtFreeArgList( static void GetResources(Widget widget, XtResourceList *res_list, Cardinal *number); - -/* - * Given a variable argument list, _XtVaToArgList() returns the - * equivalent ArgList and count. _XtVaToArgList() handles nested + +/* + * Given a variable argument list, _XtVaToArgList() returns the + * equivalent ArgList and count. _XtVaToArgList() handles nested * lists and typed arguments. If typed arguments are present, the * ArgList should be freed with _XtFreeArgList. */ @@ -415,26 +415,26 @@ _XtVaToArgList( */ static void -GetResources(widget, res_list, number) -Widget widget; -XtResourceList * res_list; -Cardinal * number; +GetResources( + Widget widget, + XtResourceList * res_list, + Cardinal * number) { Widget parent = XtParent(widget); XtInitializeWidgetClass(XtClass(widget)); XtGetResourceList(XtClass(widget), res_list, number); - + if (!XtIsShell(widget) && parent && XtIsConstraint(parent)) { XtResourceList res, constraint, cons_top; Cardinal num_constraint, temp; - XtGetConstraintResourceList(XtClass(parent), &constraint, + XtGetConstraintResourceList(XtClass(parent), &constraint, &num_constraint); cons_top = constraint; - *res_list = (XtResourceList) XtRealloc((char*)*res_list, - ((*number + num_constraint) * + *res_list = (XtResourceList) XtRealloc((char*)*res_list, + ((*number + num_constraint) * sizeof(XtResource))); for (temp= num_constraint, res= *res_list + *number; temp != 0; temp--) @@ -448,32 +448,32 @@ Cardinal * number; static int NestedArgtoTypedArg( XtTypedArgList args, XtTypedArgList avlist) -{ +{ int count = 0; - - for (; avlist->name != NULL; avlist++) { - if (avlist->type != NULL) { - (args+count)->name = avlist->name; - (args+count)->type = avlist->type; + + for (; avlist->name != NULL; avlist++) { + if (avlist->type != NULL) { + (args+count)->name = avlist->name; + (args+count)->type = avlist->type; (args+count)->size = avlist->size; (args+count)->value = avlist->value; - ++count; - } else if(strcmp(avlist->name, XtVaNestedList) == 0) { - count += NestedArgtoTypedArg((args+count), - (XtTypedArgList)avlist->value); - } else { - (args+count)->name = avlist->name; + ++count; + } else if(strcmp(avlist->name, XtVaNestedList) == 0) { + count += NestedArgtoTypedArg((args+count), + (XtTypedArgList)avlist->value); + } else { + (args+count)->name = avlist->name; (args+count)->type = NULL; - (args+count)->value = avlist->value; + (args+count)->value = avlist->value; ++count; - } - } + } + } return(count); } /* - * Given a variable argument list, _XtVaToTypedArgList() returns + * Given a variable argument list, _XtVaToTypedArgList() returns * the equivalent TypedArgList. _XtVaToTypedArgList() handles nested * lists. * Note: _XtVaToTypedArgList() does not do type conversions. @@ -490,7 +490,7 @@ _XtVaToTypedArgList( int count; args = (XtTypedArgList) - __XtMalloc((unsigned)(max_count * sizeof(XtTypedArg))); + __XtMalloc((unsigned)(max_count * sizeof(XtTypedArg))); for(attr = va_arg(var, String), count = 0 ; attr != NULL; attr = va_arg(var, String)) { |