1*5858a2dbSuwe /* $NetBSD: hide.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: hide.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 int
hide_panel(PANEL * p)35*5858a2dbSuwe hide_panel(PANEL *p)
36*5858a2dbSuwe {
37*5858a2dbSuwe PANEL *other;
38*5858a2dbSuwe
39*5858a2dbSuwe if (__predict_false(p == NULL))
40*5858a2dbSuwe return ERR;
41*5858a2dbSuwe
42*5858a2dbSuwe if (__predict_false(PANEL_HIDDEN(p)))
43*5858a2dbSuwe return OK;
44*5858a2dbSuwe
45*5858a2dbSuwe DECK_REMOVE(p);
46*5858a2dbSuwe
47*5858a2dbSuwe /*
48*5858a2dbSuwe * The panel is no longer in the deck, so update_panels() will
49*5858a2dbSuwe * not handle it. Touch exposed areas now.
50*5858a2dbSuwe */
51*5858a2dbSuwe FOREACH_PANEL (other) {
52*5858a2dbSuwe touchoverlap(p->win, other->win);
53*5858a2dbSuwe }
54*5858a2dbSuwe
55*5858a2dbSuwe return OK;
56*5858a2dbSuwe }
57