refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / rom / hyperlayers / whichlayer.c
blob4b1292fd41482074649d1fc26b1cea3e79d5734b
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/libcall.h>
9 #include <proto/graphics.h>
10 #include <proto/layers.h>
11 #include <graphics/clip.h>
12 #include <graphics/layers.h>
13 #include "layers_intern.h"
15 #define DEBUG 0
16 #include <aros/debug.h>
17 #undef kprintf
19 /*****************************************************************************
21 NAME */
23 AROS_LH3(struct Layer *, WhichLayer,
25 /* SYNOPSIS */
26 AROS_LHA(struct Layer_Info *, li, A0),
27 AROS_LHA(LONG , x, D0),
28 AROS_LHA(LONG , y, D1),
30 /* LOCATION */
31 struct LayersBase *, LayersBase, 22, Layers)
33 /* FUNCTION
34 Determines in which layer the point (x,y) is to be found.
35 Starts with the frontmost layer.
37 INPUTS
38 li - pointer to Layers_Info structure
39 x - x-coordinate
40 y - y-coordinate
42 RESULT
44 NOTES
45 The function does not lock Layer_Info structure. It is
46 the responsibility of the caller to issue the lock via
47 LockLayerInfo()/UnlockLayerInfo()
49 EXAMPLE
51 BUGS
53 SEE ALSO
55 INTERNALS
57 HISTORY
58 27-11-96 digulla automatically created from
59 layers_lib.fd and clib/layers_protos.h
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct Layer *l;
67 D(bug("WhichLayer(li @ $%lx, x %ld, y %ld)\n", li, x, y));
69 for
71 l = li->top_layer;
72 l != NULL && !(IS_VISIBLE(l) && IsPointInRegion(l->visibleshape, x, y));
73 l = l->back
76 return l;
78 AROS_LIBFUNC_EXIT
79 } /* WhichLayer */