Bring back --with-sys-screenrc configure flag.
[screen-lua.git] / src / layer.h
blob8c42d2b57f41684eda0080897a3435fc83a0c9dc
1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
14 * any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
27 * $Id$ GNU
30 #ifndef SCREEN_LAYER_H
31 #define SCREEN_LAYER_H
34 * This is the overlay structure. It is used to create a seperate
35 * layer over the current windows.
38 struct mchar; /* forward declaration */
40 struct LayFuncs
42 void (*lf_LayProcess) __P((char **, int *));
43 void (*lf_LayAbort) __P((void));
44 void (*lf_LayRedisplayLine) __P((int, int, int, int));
45 void (*lf_LayClearLine) __P((int, int, int, int));
46 int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
47 int (*lf_LayResize) __P((int, int));
48 void (*lf_LayRestore) __P((void));
49 void (*lf_LayFree) __P((void *)); /* Should only free any data kept in
50 flayer->l_data (but not flayer->l_data itself). */
53 struct layer
55 struct canvas *l_cvlist; /* list of canvases displaying layer */
56 int l_width;
57 int l_height;
58 int l_x; /* cursor position */
59 int l_y;
60 int l_encoding;
61 struct LayFuncs *l_layfn;
62 void *l_data;
64 struct layer *l_next; /* layer stack, should be in data? */
65 struct layer *l_bottom; /* bottom element of layer stack */
66 int l_blocking;
67 int l_mode; /* non-zero == edit mode */
69 struct {
70 unsigned char buffer[3]; /* [0]: the button
71 [1]: x
72 [2]: y
74 int len;
75 int start;
76 } l_mouseevent;
78 struct {
79 int d : 1; /* Is the output for the layer blocked? */
81 /* After unpausing, what region should we refresh? */
82 int *left, *right;
83 int top, bottom;
84 int lines;
85 } l_pause;
88 #define LayProcess (*flayer->l_layfn->lf_LayProcess)
89 #define LayAbort (*flayer->l_layfn->lf_LayAbort)
90 #define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
91 #define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
92 #define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
93 #define LayResize (*flayer->l_layfn->lf_LayResize)
94 #define LayRestore (*flayer->l_layfn->lf_LayRestore)
95 #define LayFree (*flayer->l_layfn->lf_LayFree)
97 #define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
98 #define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
100 /* XXX: AArgh! think again! */
102 #define LAY_CALL_UP(fn) do \
104 struct layer *oldlay = flayer; \
105 struct canvas *oldcvlist, *cv; \
106 debug("LayCallUp\n"); \
107 flayer = flayer->l_next; \
108 oldcvlist = flayer->l_cvlist; \
109 debug1("oldcvlist: %x\n", oldcvlist); \
110 flayer->l_cvlist = oldlay->l_cvlist; \
111 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
112 cv->c_layer = flayer; \
113 fn; \
114 flayer = oldlay; \
115 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
116 cv->c_layer = flayer; \
117 flayer->l_next->l_cvlist = oldcvlist; \
118 } while(0)
120 #define LAY_DISPLAYS(l, fn) do \
122 struct display *olddisplay = display; \
123 struct canvas *cv; \
124 for (display = displays; display; display = display->d_next) \
126 for (cv = D_cvlist; cv; cv = cv->c_next) \
127 if (cv->c_layer == l) \
128 break; \
129 if (cv == 0) \
130 continue; \
131 fn; \
133 display = olddisplay; \
134 } while(0)
136 #endif /* SCREEN_LAYER_H */
139 * (Un)Pauses a layer.
141 * @param layer The layer that should be (un)paused.
142 * @param pause Should we pause the layer?
144 void LayPause __P((struct layer *layer, int pause));
147 * Update the region to refresh after a layer is unpaused.
149 * @param layer The layer.
150 * @param xs The left-end of the region.
151 * @param xe The right-end of the region.
152 * @param ys The top-end of the region.
153 * @param ye The bottom-end of the region.
155 void LayPauseUpdateRegion __P((struct layer *layer, int xs, int xe, int ys, int ye));
158 * Free any internal memory for the layer.
160 * @param layer The layer.
162 void LayerCleanupMemory __P((struct layer *layer));