tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / hyperlayers / upfrontlayer.c
blob8b1083cb8201ed4365bb96f86c6df32d12ffbaae
1 /*
2 Copyright © 1995-2011, 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 <aros/libcall.h>
12 #include <proto/graphics.h>
13 #include <proto/layers.h>
15 #include "basicfuncs.h"
16 #include "layers_intern.h"
19 /*****************************************************************************
21 NAME */
23 AROS_LH2(LONG, UpfrontLayer,
25 /* SYNOPSIS */
26 AROS_LHA(LONG , dummy, A0),
27 AROS_LHA(struct Layer *, l , A1),
29 /* LOCATION */
30 struct LayersBase *, LayersBase, 8, Layers)
32 /* FUNCTION
33 Brings a layer to the front. If this layer is a backdrop layer
34 it is brought in front of all backdrop layers and behind the
35 last non-backdrop layer. By clearing the BACKDROP flag of a layer
36 a backdrop layer can be brought in front of all other layers.
37 Parts of a simple layer that become visible are added to the
38 damage list and the REFRESH flag is set.
40 INPUTS
41 dummy - unused
42 L - pointer to layer
44 RESULT
45 TRUE - layer was moved
46 FALSE - layer could not be moved (probably out of memory)
48 NOTES
50 EXAMPLE
52 BUGS
54 SEE ALSO
55 CreateUpfrontLayer(), CreateUpfrontHookLayer(), BehindLayer()
56 CreateBehindLayer(), CreateBehindHookLayer()
58 INTERNALS
60 HISTORY
61 27-11-96 digulla automatically created from
62 layers_lib.fd and clib/layers_protos.h
64 *****************************************************************************/
66 AROS_LIBFUNC_INIT
68 struct Layer * first, * _l;
69 int found = FALSE;
70 LONG ret;
72 //kprintf("\t\t%s called!\n",__FUNCTION__);
73 LockLayers(l->LayerInfo);
76 * Move the layer in front of that layer with the same
77 * priority.
78 * Also keep its children in front of itself.
80 first = GetFirstFamilyMember(l);
83 * If there is nobody in front of the first family member
84 * I don't have to do anything.
85 * first can also be l.
87 if (NULL == first->front)
89 UnlockLayers(l->LayerInfo);
90 return TRUE;
93 * Search for the new place
94 * search all layers that have the same priority.
95 * If I find another layer with the same nesting
96 * as the one to be moved I have a place to move.
97 * Stop at the frontmost layer
99 _l = first->front;
102 if (_l -> priority == l->priority)
104 while (1)
106 if (_l->nesting == l->nesting)
107 found = TRUE;
108 if (NULL == _l->front || _l->front->priority != l->priority)
109 break;
110 _l = _l->front;
114 if (FALSE == found)
116 UnlockLayers(l->LayerInfo);
117 return TRUE;
120 ret = _MoveLayerToFront(l,_l, LayersBase);
124 * Unlock all locked layers.
126 UnlockLayers(l->LayerInfo);
128 return ret;
130 AROS_LIBFUNC_EXIT
131 } /* UpfrontLayer */