Merge branch 'master' into cmd-alias
[screen-lua.git] / src / layer.h
blobd45a5c37c8f4c90b3ee4a77faee12f3f70076237
1 /* Copyright (c) 1995-2002
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Copyright (c) 1987 Oliver Laumann
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3, or (at your option)
9 * any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program (see the file COPYING); if not, see
18 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 ****************************************************************
22 * $Id$ FAU
26 * This is the overlay structure. It is used to create a seperate
27 * layer over the current windows.
30 struct mchar; /* forward declaration */
32 struct LayFuncs
34 void (*lf_LayProcess) __P((char **, int *));
35 void (*lf_LayAbort) __P((void));
36 void (*lf_LayRedisplayLine) __P((int, int, int, int));
37 void (*lf_LayClearLine) __P((int, int, int, int));
38 int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
39 int (*lf_LayResize) __P((int, int));
40 void (*lf_LayRestore) __P((void));
43 struct layer
45 struct canvas *l_cvlist; /* list of canvases displaying layer */
46 int l_width;
47 int l_height;
48 int l_x; /* cursor position */
49 int l_y;
50 int l_encoding;
51 struct LayFuncs *l_layfn;
52 char *l_data;
54 struct layer *l_next; /* layer stack, should be in data? */
55 struct layer *l_bottom; /* bottom element of layer stack */
56 int l_blocking;
59 #define LayProcess (*flayer->l_layfn->lf_LayProcess)
60 #define LayAbort (*flayer->l_layfn->lf_LayAbort)
61 #define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
62 #define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
63 #define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
64 #define LayResize (*flayer->l_layfn->lf_LayResize)
65 #define LayRestore (*flayer->l_layfn->lf_LayRestore)
67 #define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
68 #define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
70 /* XXX: AArgh! think again! */
72 #define LAY_CALL_UP(fn) do \
73 { \
74 struct layer *oldlay = flayer; \
75 struct canvas *oldcvlist, *cv; \
76 debug("LayCallUp\n"); \
77 flayer = flayer->l_next; \
78 oldcvlist = flayer->l_cvlist; \
79 debug1("oldcvlist: %x\n", oldcvlist); \
80 flayer->l_cvlist = oldlay->l_cvlist; \
81 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
82 cv->c_layer = flayer; \
83 fn; \
84 flayer = oldlay; \
85 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
86 cv->c_layer = flayer; \
87 flayer->l_next->l_cvlist = oldcvlist; \
88 } while(0)
90 #define LAY_DISPLAYS(l, fn) do \
91 { \
92 struct display *olddisplay = display; \
93 struct canvas *cv; \
94 for (display = displays; display; display = display->d_next) \
95 { \
96 for (cv = D_cvlist; cv; cv = cv->c_next) \
97 if (cv->c_layer == l) \
98 break; \
99 if (cv == 0) \
100 continue; \
101 fn; \
103 display = olddisplay; \
104 } while(0)