xref: /netbsd-src/lib/libpanel/update.c (revision 5858a2db3d97dad7cb7e5425098a662ce159ce31)
1*5858a2dbSuwe /*	$NetBSD: update.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */
2*5858a2dbSuwe 
3*5858a2dbSuwe /*
4*5858a2dbSuwe  * Copyright (c) 2015 Valery Ushakov
5*5858a2dbSuwe  * All rights reserved.
6*5858a2dbSuwe  *
7*5858a2dbSuwe  * Redistribution and use in source and binary forms, with or without
8*5858a2dbSuwe  * modification, are permitted provided that the following conditions
9*5858a2dbSuwe  * are met:
10*5858a2dbSuwe  * 1. Redistributions of source code must retain the above copyright
11*5858a2dbSuwe  *    notice, this list of conditions and the following disclaimer.
12*5858a2dbSuwe  * 2. Redistributions in binary form must reproduce the above copyright
13*5858a2dbSuwe  *    notice, this list of conditions and the following disclaimer in the
14*5858a2dbSuwe  *    documentation and/or other materials provided with the distribution.
15*5858a2dbSuwe  *
16*5858a2dbSuwe  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*5858a2dbSuwe  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*5858a2dbSuwe  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*5858a2dbSuwe  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*5858a2dbSuwe  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*5858a2dbSuwe  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*5858a2dbSuwe  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*5858a2dbSuwe  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*5858a2dbSuwe  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*5858a2dbSuwe  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*5858a2dbSuwe  */
27*5858a2dbSuwe 
28*5858a2dbSuwe #include <sys/cdefs.h>
29*5858a2dbSuwe __RCSID("$NetBSD: update.c,v 1.1 2015/10/26 23:09:49 uwe Exp $");
30*5858a2dbSuwe 
31*5858a2dbSuwe #include "panel_impl.h"
32*5858a2dbSuwe 
33*5858a2dbSuwe 
34*5858a2dbSuwe void
update_panels(void)35*5858a2dbSuwe update_panels(void)
36*5858a2dbSuwe {
37*5858a2dbSuwe 	PANEL *p;
38*5858a2dbSuwe 
39*5858a2dbSuwe 	/*
40*5858a2dbSuwe 	 * For each panel tell panels above it they need to refresh
41*5858a2dbSuwe 	 * regions that overlap (are above) this panel.  This ensures
42*5858a2dbSuwe 	 * that even if a panel below was touched, it's still
43*5858a2dbSuwe 	 * overwritten by a panel above.
44*5858a2dbSuwe 	 *
45*5858a2dbSuwe 	 * Note that we also need to do this during "destructive"
46*5858a2dbSuwe 	 * operations (hide, move, replace window - which see).
47*5858a2dbSuwe 	 */
48*5858a2dbSuwe 	FOREACH_PANEL (p) {
49*5858a2dbSuwe 		PANEL *above = p;
50*5858a2dbSuwe 		while ((above = PANEL_ABOVE(above)) != NULL) {
51*5858a2dbSuwe 			touchoverlap(p->win, above->win);
52*5858a2dbSuwe 		}
53*5858a2dbSuwe 	}
54*5858a2dbSuwe 
55*5858a2dbSuwe 	/*
56*5858a2dbSuwe 	 * This is what effects Z-order: the window updated later
57*5858a2dbSuwe 	 * overwrites contents of the windows below (before) it.
58*5858a2dbSuwe 	 */
59*5858a2dbSuwe 	FOREACH_PANEL (p) {
60*5858a2dbSuwe 		wnoutrefresh(p->win);
61*5858a2dbSuwe 	}
62*5858a2dbSuwe }
63