Build contrib binary archive again because it isn't included in FreeBSD
[AROS.git] / rom / hyperlayers / isfrontmostlayer.c
blobe2ed6a31b3dd3fc7fa6da98be001ce362e6d270a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <layers_intern.h>
12 #include <aros/libcall.h>
13 #include <proto/graphics.h>
14 #include "basicfuncs.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/layers.h>
20 AROS_LH2(BOOL, IsFrontmostLayer,
22 /* SYNOPSIS */
23 AROS_LHA(struct Layer *, l , A0),
24 AROS_LHA(BOOL , check_invisible, D0),
26 /* LOCATION */
27 struct LayersBase *, LayersBase, 43, Layers)
29 /* FUNCTION
30 Checks whether this layer is the frontmost layer within
31 its priority. If this layer has children then all of
32 its children will be disregarded. Comparisons are only
33 done with layers that have the same 'depth' of relation-
34 ship (=nesting counter) to the root layer.
35 It can be specified whether invisible siblings are to be
36 considered in the comparison.
38 INPUTS
39 L - pointer to layer
40 check_invisible - whether invisible siblings are to be considered
43 RESULT
44 TRUE - layer is frontmost layer within its priority
45 FALSE - layer is not frontmost layer within its priority
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
55 INTERNALS
57 HISTORY
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
62 AROS_LIBBASE_EXT_DECL(struct LayersBase *,LayersBase)
64 struct Layer * _l;
65 BOOL result = TRUE;
67 if (NULL == l)
68 return FALSE;
70 LockLayers(l->LayerInfo);
72 _l = l->front;
74 while (NULL != _l) {
76 * If they differ in priority then return TRUE.
77 * I did not meet another (elegible) sibling so
78 * far.
80 if (_l->priority != l->priority)
81 break;
83 * If the nesting counter of one layer in front
84 * of the layer l is equal (or less) then return FALSE.
86 if (_l->nesting <= l->nesting &&
87 ( IS_VISIBLE(_l) || TRUE == check_invisible)) {
88 result = FALSE;
89 break;
91 _l = _l->front;
94 UnlockLayers(l->LayerInfo);
96 return result;
98 AROS_LIBFUNC_EXIT
99 } /* IsFrontmostLayer */