Index: cmake/modules/LLDBConfig.cmake =================================================================== --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -399,14 +399,27 @@ if (NOT LLDB_DISABLE_CURSES) find_package(Curses REQUIRED) - find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library") - if (NOT CURSES_PANEL_LIBRARY) - message(FATAL_ERROR "A required curses' panel library not found.") + # LLDB ships with libpanel for NetBSD-7.0 + if (CMAKE_SYSTEM_NAME MATCHES "NetBSD") + if (EXISTS "/usr/include/panel.h") + add_definitions(-DNETBSD_HAS_LIBPANEL) + set(LLDB_NETBSD_HAS_LIBPANEL 1) + else () + set(LLDB_NETBSD_HAS_LIBPANEL 0) + endif () endif () - # Add panels to the library path - set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY}) + if (NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR LLDB_NETBSD_HAS_LIBPANEL) + find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library") + if (NOT CURSES_PANEL_LIBRARY) + message(FATAL_ERROR "A required curses' panel library not found.") + endif () + + # Add panels to the library path + set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY}) + + list(APPEND system_libs ${CURSES_LIBRARIES}) + endif () - list(APPEND system_libs ${CURSES_LIBRARIES}) include_directories(${CURSES_INCLUDE_DIR}) endif () Index: include/lldb/Host/HostLibPanel.h =================================================================== --- /dev/null +++ include/lldb/Host/HostLibPanel.h @@ -0,0 +1,19 @@ +//===-- LibPanel.h ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#pragma once + +#ifndef LLDB_DISABLE_CURSES + +#if !defined(__NetBSD__) +#include +#else +#include +#endif + +#endif Index: include/lldb/Host/netbsd/libpanel/panel.h =================================================================== --- /dev/null +++ include/lldb/Host/netbsd/libpanel/panel.h @@ -0,0 +1,66 @@ +/* $NetBSD: panel.h,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#if defined(NETBSD_HAS_LIBPANEL) + +#include + +#else + +#include +#include + +typedef struct __panel PANEL; + +__BEGIN_DECLS +PANEL *new_panel(WINDOW *); +int del_panel(PANEL *); + +int replace_panel(PANEL *, WINDOW *); +WINDOW *panel_window(PANEL *); + +int set_panel_userptr(PANEL *, char *); +char *panel_userptr(PANEL *); + +int hide_panel(PANEL *); +int show_panel(PANEL *); +int panel_hidden(PANEL *); + +int top_panel(PANEL *); +int bottom_panel(PANEL *); + +PANEL *panel_above(PANEL *); +PANEL *panel_below(PANEL *); + +int move_panel(PANEL *, int, int); + +void update_panels(void); +__END_DECLS + +#endif Index: source/Core/IOHandler.cpp =================================================================== --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -10,7 +10,7 @@ // C Includes #ifndef LLDB_DISABLE_CURSES #include -#include +#include #endif // C++ Includes Index: source/Host/CMakeLists.txt =================================================================== --- source/Host/CMakeLists.txt +++ source/Host/CMakeLists.txt @@ -154,6 +154,26 @@ netbsd/HostThreadNetBSD.cpp netbsd/ThisThread.cpp ) + if (NOT LLDB_NETBSD_HAS_LIBPANEL) + add_host_subdirectory(netbsd + netbsd/libpanel/_deck.cpp + netbsd/libpanel/above.cpp + netbsd/libpanel/below.cpp + netbsd/libpanel/bottom.cpp + netbsd/libpanel/del.cpp + netbsd/libpanel/getuser.cpp + netbsd/libpanel/hidden.cpp + netbsd/libpanel/hide.cpp + netbsd/libpanel/move.cpp + netbsd/libpanel/new.cpp + netbsd/libpanel/replace.cpp + netbsd/libpanel/setuser.cpp + netbsd/libpanel/show.cpp + netbsd/libpanel/top.cpp + netbsd/libpanel/update.cpp + netbsd/libpanel/window.cpp + ) + endif() endif() endif() Index: source/Host/netbsd/libpanel/_deck.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/_deck.cpp @@ -0,0 +1,34 @@ +/* $NetBSD: _deck.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: _deck.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + +struct deck _deck __dso_hidden = TAILQ_HEAD_INITIALIZER(_deck); +PANEL _stdscr_panel __dso_hidden; Index: source/Host/netbsd/libpanel/above.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/above.cpp @@ -0,0 +1,48 @@ +/* $NetBSD: above.c,v 1.2 2015/11/01 01:40:23 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: above.c,v 1.2 2015/11/01 01:40:23 uwe Exp $"); + +#include "panel_impl.h" + + +PANEL * +panel_above(PANEL *p) +{ + if (p == NULL) { + if (TAILQ_EMPTY(&_deck)) + return NULL; + + return PANEL_ABOVE(&_stdscr_panel); + } + + if (__predict_false(PANEL_HIDDEN(p))) + return NULL; + + return PANEL_ABOVE(p); +} Index: source/Host/netbsd/libpanel/below.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/below.cpp @@ -0,0 +1,50 @@ +/* $NetBSD: below.c,v 1.2 2015/11/01 01:40:23 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: below.c,v 1.2 2015/11/01 01:40:23 uwe Exp $"); + +#include "panel_impl.h" + + +PANEL * +panel_below(PANEL *p) +{ + PANEL *below; + + if (p == NULL) + below = TAILQ_LAST(&_deck, deck); + else if (__predict_true(!PANEL_HIDDEN(p))) + below = PANEL_BELOW(p); + else + return NULL; + + if (below == &_stdscr_panel) + return NULL; + else + return below; +} Index: source/Host/netbsd/libpanel/bottom.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/bottom.cpp @@ -0,0 +1,47 @@ +/* $NetBSD: bottom.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: bottom.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +bottom_panel(PANEL *p) +{ + if (__predict_false(p == NULL)) + return ERR; + + if (__predict_false(PANEL_HIDDEN(p))) + return ERR; + + (void) hide_panel(p); + + DECK_INSERT_BOTTOM(p); + return OK; +} Index: source/Host/netbsd/libpanel/del.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/del.cpp @@ -0,0 +1,62 @@ +/* $NetBSD: del.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: del.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + +#include +#include + + +int +del_panel(PANEL *p) +{ + if (__predict_false(p == NULL)) + return ERR; + + (void) hide_panel(p); + free(p); + + /* + * If the last panel is removed, remove the phantom stdscr + * panel as well. + * + * A program that wants to switch to a different screen with + * set_term(3), or ends and recreates curses session with + * endwin(3)/initscr(3), must delete all panels first, since + * their windows will become invalid. When it will create its + * first new panel afterwards, it will pick up new stdscr. + */ + if (TAILQ_LAST(&_deck, deck) == &_stdscr_panel) { + (void) hide_panel(&_stdscr_panel); + assert(TAILQ_EMPTY(&_deck)); + } + + return OK; +} Index: source/Host/netbsd/libpanel/getuser.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/getuser.cpp @@ -0,0 +1,41 @@ +/* $NetBSD: getuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: getuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +char * +panel_userptr(PANEL *p) +{ + if (p == NULL) + return NULL; + + return p->user; +} Index: source/Host/netbsd/libpanel/hidden.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/hidden.cpp @@ -0,0 +1,44 @@ +/* $NetBSD: hidden.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: hidden.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +panel_hidden(PANEL *p) +{ + if (p == NULL) + return ERR; + + if (PANEL_HIDDEN(p)) + return TRUE; + else + return FALSE; +} Index: source/Host/netbsd/libpanel/hide.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/hide.cpp @@ -0,0 +1,56 @@ +/* $NetBSD: hide.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: hide.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +hide_panel(PANEL *p) +{ + PANEL *other; + + if (__predict_false(p == NULL)) + return ERR; + + if (__predict_false(PANEL_HIDDEN(p))) + return OK; + + DECK_REMOVE(p); + + /* + * The panel is no longer in the deck, so update_panels() will + * not handle it. Touch exposed areas now. + */ + FOREACH_PANEL (other) { + touchoverlap(p->win, other->win); + } + + return OK; +} Index: source/Host/netbsd/libpanel/move.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/move.cpp @@ -0,0 +1,58 @@ +/* $NetBSD: move.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: move.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +move_panel(PANEL *p, int y, int x) +{ + int oldy, oldx; + + if (__predict_false(p == NULL)) + return ERR; + + getbegyx(p->win, oldy, oldx); + if (__predict_false(y == oldy && x == oldx)) + return OK; + + if (!PANEL_HIDDEN(p)) { + PANEL *other; + + /* touch exposed areas at the old location now */ + FOREACH_PANEL (other) { + if (other != p) { + touchoverlap(p->win, other->win); + } + } + } + + return mvwin(p->win, y, x); +} Index: source/Host/netbsd/libpanel/new.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/new.cpp @@ -0,0 +1,75 @@ +/* $NetBSD: new.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: new.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + +#include +#include + + +static PANEL * +_new_panel(WINDOW *w) +{ + PANEL *p; + + p = (PANEL *)malloc(sizeof(PANEL)); + if (__predict_false(p == NULL)) + return NULL; + + p->win = w; + p->user = NULL; + + DECK_INSERT_TOP(p); + return p; +} + + +PANEL * +new_panel(WINDOW *w) +{ + if (__predict_false(w == NULL)) + return NULL; + + if (__predict_false(w == stdscr)) + return NULL; + + /* + * Ensure there's phantom panel for stdscr at (below) the + * bottom. We explicitly re-assign stdscr in case it changed. + */ + if (TAILQ_EMPTY(&_deck)) { + assert(PANEL_HIDDEN(&_stdscr_panel)); + + _stdscr_panel.win = stdscr; + DECK_INSERT_TOP(&_stdscr_panel); + } + + return _new_panel(w); +} Index: source/Host/netbsd/libpanel/panel_impl.h =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/panel_impl.h @@ -0,0 +1,89 @@ +/* $NetBSD: panel_impl.h,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include + +#include + +#define DECK_HEAD(head) TAILQ_HEAD(head, __panel) +#define DECK_ENTRY TAILQ_ENTRY(__panel) + + +/* + * Panels are just curses windows with Z-order added. + * See update_panels() for details. + */ +struct __panel { + WINDOW *win; + char *user; + DECK_ENTRY zorder; +}; + + +/* Deck of panels in Z-order from bottom to top. */ +DECK_HEAD(deck); +extern struct deck _deck __dso_hidden; + +/* Fake stdscr panel at the bottom, not user visible */ +extern PANEL _stdscr_panel __dso_hidden; + + +/* + * Hidden panels are not in the deck. macros don't have + * a concept of an entry not on the list, so provide a kludge that + * digs into internals. + */ +#define TAILQ_REMOVE_NP(head, elm, field) do { \ + TAILQ_REMOVE((head), (elm), field); \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = NULL; \ +} while (/*CONSTCOND*/ 0) + +#define TAILQ_LINKED_NP(elm, field) \ + (((elm)->field.tqe_prev) != NULL) + + +#define DECK_INSERT_TOP(p) do { \ + TAILQ_INSERT_TAIL(&_deck, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + +#define DECK_INSERT_BOTTOM(p) do { \ + TAILQ_INSERT_AFTER(&_deck, &_stdscr_panel, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + +#define DECK_REMOVE(p) do { \ + TAILQ_REMOVE_NP(&_deck, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + + +#define PANEL_ABOVE(p) (TAILQ_NEXT((p), zorder)) +#define PANEL_BELOW(p) (TAILQ_PREV((p), deck, zorder)) +#define PANEL_HIDDEN(p) (!TAILQ_LINKED_NP((p), zorder)) + +#define FOREACH_PANEL(var) TAILQ_FOREACH(var, &_deck, zorder) Index: source/Host/netbsd/libpanel/replace.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/replace.cpp @@ -0,0 +1,52 @@ +/* $NetBSD: replace.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: replace.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +replace_panel(PANEL *p, WINDOW *w) +{ + if (__predict_false(p == NULL || w == NULL)) + return ERR; + + if (!PANEL_HIDDEN(p)) { + PANEL *other; + + /* touch exposed areas at the old location now */ + FOREACH_PANEL (other) { + if (other != p) + touchoverlap(p->win, other->win); + } + } + + p->win = w; + return OK; +} Index: source/Host/netbsd/libpanel/setuser.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/setuser.cpp @@ -0,0 +1,42 @@ +/* $NetBSD: setuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: setuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +set_panel_userptr(PANEL *p, char *u) +{ + if (p == NULL) + return ERR; + + p->user = u; + return OK; +} Index: source/Host/netbsd/libpanel/show.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/show.cpp @@ -0,0 +1,46 @@ +/* $NetBSD: show.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: show.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +show_panel(PANEL *p) +{ + if (__predict_false(p == NULL)) + return ERR; + + /* unlike top_panel() */ + if (__predict_false(!PANEL_HIDDEN(p))) + return ERR; + + DECK_INSERT_TOP(p); + return OK; +} Index: source/Host/netbsd/libpanel/top.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/top.cpp @@ -0,0 +1,48 @@ +/* $NetBSD: top.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: top.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +int +top_panel(PANEL *p) +{ + if (__predict_false(p == NULL)) + return ERR; + + /* unlike show_panel() */ + if (__predict_false(PANEL_HIDDEN(p))) + return ERR; + + /* XXX: use common internal functions instead */ + (void) hide_panel(p); + (void) show_panel(p); + return OK; +} Index: source/Host/netbsd/libpanel/update.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/update.cpp @@ -0,0 +1,62 @@ +/* $NetBSD: update.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: update.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +void +update_panels(void) +{ + PANEL *p; + + /* + * For each panel tell panels above it they need to refresh + * regions that overlap (are above) this panel. This ensures + * that even if a panel below was touched, it's still + * overwritten by a panel above. + * + * Note that we also need to do this during "destructive" + * operations (hide, move, replace window - which see). + */ + FOREACH_PANEL (p) { + PANEL *above = p; + while ((above = PANEL_ABOVE(above)) != NULL) { + touchoverlap(p->win, above->win); + } + } + + /* + * This is what effects Z-order: the window updated later + * overwrites contents of the windows below (before) it. + */ + FOREACH_PANEL (p) { + wnoutrefresh(p->win); + } +} Index: source/Host/netbsd/libpanel/window.cpp =================================================================== --- /dev/null +++ source/Host/netbsd/libpanel/window.cpp @@ -0,0 +1,41 @@ +/* $NetBSD: window.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__RCSID("$NetBSD: window.c,v 1.1 2015/10/26 23:09:49 uwe Exp $"); + +#include "panel_impl.h" + + +WINDOW * +panel_window(PANEL *p) +{ + if (p == NULL) + return NULL; + + return p->win; +}