sup

A curses threads-with-tags style email client

ncursesw-ruby.git

git clone https://supmua.dev/git/ncursesw-ruby/
commit 74901a2641ab1a02bfafdcc461ebd4d5a3fe6b7f
parent d5e3aadcd99dd6b4663359f46840d278eaf10094
Author: Whyme.Lyu <callme5long@gmail.com>
Date:   Wed,  1 May 2013 06:59:53 -0700

Merge pull request #3 from gauteh/1_3_0

Initial stab at using version 1.3.0
Diffstat:
M README | 2 +-
M THANKS | 2 +-
M TODO | 2 +-
M VERSION | 2 +-
M compat.h | 2 +-
M examples/LICENSES_for_examples | 2 +-
M examples/example.rb | 4 ++--
M examples/form.rb | 2 +-
M examples/form2.rb | 2 +-
M examples/hello_ncurses.rb | 4 ++--
M examples/rain.rb | 4 ++--
M examples/read_line.rb | 2 +-
M examples/tclock.rb | 4 ++--
M examples/test_scanw.rb | 4 ++--
M extconf.rb | 6 +++---
M form_wrap.c | 8 +++++---
M form_wrap.h | 9 ++++++++-
A lib/ncurses_sugar.rb | 341 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M lib/ncursesw.rb | 327 +------------------------------------------------------------------------------
M make_dist.rb | 39 ++++++++++++++++-----------------------
M menu_wrap.c | 4 +++-
M menu_wrap.h | 8 +++++++-
M ncurses_wrap.c | 63 +++++++++++++++++++++++++++++++++++----------------------------
M ncurses_wrap.h | 9 +++++----
A ncurses_wrap.o | 0
M ncursesw.gemspec | 3 ++-
M panel_wrap.c | 5 +++--
M panel_wrap.h | 9 +++++++--
28 files changed, 457 insertions(+), 412 deletions(-)
diff --git a/README b/README
@@ -1,4 +1,4 @@
-$Id: README,v 1.16 2009/05/03 14:13:27 t-peters Exp $
+$Id: README,v 1.16 2009-05-03 14:13:27 t-peters Exp $
 ------------------------------------------------------------------------
 This directory contains a ruby module for accessing the FSF's ncurses
 library.
diff --git a/THANKS b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.9 2009/05/03 10:37:54 t-peters Exp $
+$Id: THANKS,v 1.9 2009-05-03 10:37:54 t-peters Exp $
 
 A list of people that helped me with ncurses-ruby
 
diff --git a/TODO b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.6 2003/03/22 22:55:27 t-peters Exp $
+$Id: TODO,v 1.6 2003-03-22 22:55:27 t-peters Exp $
 
 This is the complete list of functions present in ncurses that have not yet
 been wrapped by ncurses-ruby:
diff --git a/VERSION b/VERSION
@@ -1 +1 @@
-1.2.4
+1.3.0
diff --git a/compat.h b/compat.h
@@ -2,7 +2,7 @@
 #define _COMPAT_H
 
 #ifndef STR2CSTR
-#define STR2CSTR(x) ({ VALUE *y = (x); StringValuePtr(y); })
+#define STR2CSTR(x) ({ VALUE y = x; StringValuePtr (y); })
 #endif
 
 #endif
diff --git a/examples/LICENSES_for_examples b/examples/LICENSES_for_examples
@@ -1,4 +1,4 @@
-$Id: LICENSES_for_examples,v 1.6 2004/05/13 21:55:17 t-peters Exp $
+$Id: LICENSES_for_examples,v 1.6 2004-05-13 21:55:17 t-peters Exp $
 
 Ideally, an example program on how to use a library should be in the public
 domain.
diff --git a/examples/example.rb b/examples/example.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: example.rb,v 1.4 2002/03/04 13:24:29 t-peters Exp $
+# $Id: example.rb,v 1.4 2002-03-04 13:24:29 t-peters Exp $
 
 # This file provides an example for the usage of the ncurses-ruby module.
 # Copyright (C) 2002 Tobias Peters <t-peters@users.berlios.de>
@@ -59,7 +59,7 @@
 
 
 
-require "ncurses"
+require "ncursesw"
 
 def moving(scr)
   scr.clear() # clear screen
diff --git a/examples/form.rb b/examples/form.rb
@@ -8,7 +8,7 @@
 # Copyright (c) 2001 by Pradeep Padala. This document may be distributed 
 # under the terms set forth in the LDP license at linuxdoc.org/COPYRIGHT.html.
  
-require 'ncurses.rb'
+require 'ncursesw.rb'
 
 begin
   scr = Ncurses.initscr()
diff --git a/examples/form2.rb b/examples/form2.rb
@@ -11,7 +11,7 @@
 # Copyright (c) 2001 by Pradeep Padala. This document may be distributed 
 # under the terms set forth in the LDP license at linuxdoc.org/COPYRIGHT.html.
 
-require 'ncurses'
+require 'ncursesw'
 
 include Ncurses
 include Ncurses::Form
diff --git a/examples/hello_ncurses.rb b/examples/hello_ncurses.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: hello_ncurses.rb,v 1.3 2002/02/28 13:50:03 t-peters Exp $
+# $Id: hello_ncurses.rb,v 1.3 2002-02-28 13:50:03 t-peters Exp $
 
 # this ncurses-ruby program follows an ancient tradition of example
 # computer programs: When invoked, it prints a friendly greeting on the
@@ -14,7 +14,7 @@
 
 # First, we have to tell Ruby to use the Ncurses extension module:
 
-require "ncurses"
+require "ncursesw"
 
 
 
diff --git a/examples/rain.rb b/examples/rain.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: rain.rb,v 1.6 2005/08/22 21:41:49 t-peters Exp $
+# $Id: rain.rb,v 1.6 2005-08-22 21:41:49 t-peters Exp $
 
 # This program is a translation of the popular rain.c demo program from the
 # ncurses library distribution.
@@ -40,7 +40,7 @@
 
 
 
-require "ncurses"
+require "ncursesw"
 
 
 # A class responsible for raindrop drawing
diff --git a/examples/read_line.rb b/examples/read_line.rb
@@ -7,7 +7,7 @@
 # No warranties
 # Share and enjoy!
 
-require "ncurses"
+require "ncursesw"
 
 # read_line returns an array
 # [string, last_cursor_position_in_string, keycode_of_terminating_enter_key].
diff --git a/examples/tclock.rb b/examples/tclock.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: tclock.rb,v 1.6 2002/02/28 13:50:10 t-peters Exp $
+# $Id: tclock.rb,v 1.6 2002-02-28 13:50:10 t-peters Exp $
 
 # tclock - analog/digital clock for curses, translated to ruby
 # Copyright (C) 2002 Tobias Peters <t-peters@users.berlios.de>
@@ -30,7 +30,7 @@
 # clearly marked as such.                                                 #
 ###########################################################################
 
-require "ncurses"
+require "ncursesw"
 PI = Math::PI
 
 def sign(_x)
diff --git a/examples/test_scanw.rb b/examples/test_scanw.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-# $Id: test_scanw.rb,v 1.1 2003/03/22 22:55:00 t-peters Exp $
+# $Id: test_scanw.rb,v 1.1 2003-03-22 22:55:00 t-peters Exp $
 #
 # Test of the scanw function. Should really not be used in any serious curses
 # program. To use it, install scanf for ruby.
@@ -9,7 +9,7 @@
 #
 # No warranties. Share and enjoy.
 
-require "ncurses"
+require "ncursesw"
 begin
   Ncurses.initscr
   Ncurses.mvaddstr(4, 19, "Give me a number: ")
diff --git a/extconf.rb b/extconf.rb
@@ -2,7 +2,7 @@
 
 # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
 # (C) 2002, 2004 Tobias Peters <t-peters@users.berlios.de>
-# (C) 2005, 2009 Tobias Herzke
+# (C) 2005, 2009, 2011 Tobias Herzke
 #
 # This module is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -18,11 +18,11 @@
 # License along with this module; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-# $Id: extconf.rb,v 1.14 2009/05/03 14:13:27 t-peters Exp $
+# $Id: extconf_ncursesw.rb,v 1.1 2011-05-30 23:05:50 t-peters Exp $
 
 require "mkmf"
 
-$CFLAGS  += " -g"
+$CFLAGS  += " -g -Wformat -Werror=format-security"
 $CXXFLAGS  = $CFLAGS
 
 have_header("unistd.h")
diff --git a/form_wrap.c b/form_wrap.c
@@ -22,10 +22,12 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
 
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
 
 #include "form_wrap.h"
 #include "ncurses_wrap.h"
@@ -1128,9 +1130,9 @@ static void* make_arg(va_list* ap) {
 	 if (args != Qnil) {		
 		if (NUM2INT(argc)-1 != rbncurs_array_length(args)) {	
 		  char msg[500];
-		  snprintf(msg, 500, "The validation functions for this field type need %d additional arguments.",NUM2INT(argc)-1);
+		  snprintf(msg, 500, "The validation functions for this field type need %d additional arguments.",(int)(NUM2INT(argc)-1));
 		  msg[499]=0;
-		  rb_raise(rb_eArgError, msg);	
+		  rb_raise(rb_eArgError, "%s", msg);
 		}
 	 } 
   }
diff --git a/form_wrap.h b/form_wrap.h
@@ -18,12 +18,19 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#if !defined(FORM_HH) && defined(HAVE_FORM_H)
+#if !defined(FORM_HH) && (defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H))
 #define FORM_HH
 
+#ifdef HAVE_FORM_H
 #include <form.h>
+#else
+#include <ncursesw/form.h>
+#endif
+
 #include <ruby.h>
 
 extern VALUE mForm;
diff --git a/lib/ncurses_sugar.rb b/lib/ncurses_sugar.rb
@@ -0,0 +1,341 @@
+# ncurses-ruby is a ruby module for accessing the FSF's ncurses library
+# (C) 2002, 2003, 2004 Tobias Peters <t-peters@users.berlios.de>
+# (C) 2004 Simon Kaczor <skaczor@cox.net>
+# (C) 2005 2011 Tobias Herzke
+#
+# This module is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this module; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+# $Id: ncurses_sugar.rb,v 1.1 2011-05-30 23:05:50 t-peters Exp $
+
+# Ncurses constants with leading underscore
+def Ncurses._XOPEN_CURSES
+  Ncurses::XOPEN_CURSES
+end
+def Ncurses._SUBWIN  
+  Ncurses::SUBWIN
+end
+def Ncurses._ENDLINE 
+  Ncurses::ENDLINE
+end
+def Ncurses._FULLWIN 
+  Ncurses::FULLWIN
+end
+def Ncurses._SCROLLWIN
+  Ncurses::SCROLLWIN
+end
+def Ncurses._ISPAD   
+  Ncurses::ISPAD
+end
+def Ncurses._HASMOVED
+  Ncurses::HASMOVED
+end
+def Ncurses._WRAPPED 
+  Ncurses::WRAPPED
+end
+def Ncurses._NOCHANGE
+  Ncurses::NOCHANGE
+end
+def Ncurses._NEWINDEX
+  Ncurses::NEWINDEX
+end
+
+
+module Ncurses
+  module Destroy_checker; def destroyed?; @destroyed; end; end
+  class WINDOW
+    include Destroy_checker
+    def method_missing(name, *args)
+      name = name.to_s
+      if (name[0,2] == "mv")
+        test_name = name.dup
+        test_name[2,0] = "w" # insert "w" after"mv"
+        if (Ncurses.respond_to?(test_name))
+          return Ncurses.send(test_name, self, *args)
+        end
+      end
+      test_name = "w" + name
+      if (Ncurses.respond_to?(test_name))
+        return Ncurses.send(test_name, self, *args)
+      end
+      Ncurses.send(name, self, *args)
+    end
+    def respond_to?(name)
+      name = name.to_s
+      if (name[0,2] == "mv" && Ncurses.respond_to?("mvw" + name[2..-1]))
+        return true
+      end
+      Ncurses.respond_to?("w" + name) || Ncurses.respond_to?(name)
+    end
+    def del
+      Ncurses.delwin(self)
+    end
+    alias delete del
+    def WINDOW.new(*args)
+      Ncurses.newwin(*args)
+    end
+  end
+  class SCREEN
+    include Destroy_checker
+    def del
+      Ncurses.delscreen(self)
+    end
+    alias delete del
+  end
+  class MEVENT
+    attr_accessor :id, :x,:y,:z, :bstate
+  end
+  GETSTR_LIMIT = 1024
+
+  module Panel 
+    class PANEL; end
+  end
+
+  module Form
+    class FORM
+      attr_reader :user_object
+
+      # This placeholder replaces the form_userptr function in curses
+      def user_object=(obj)
+        @user_object = obj
+      end
+    end
+    
+    class FIELD
+      attr_reader :user_object
+
+      # This placeholder replaces the field_userptr function in curses
+      def user_object=(obj)
+        @user_object = obj
+      end
+    end
+
+    class FIELDTYPE
+    end
+  end
+
+  module Menu
+    class MENU
+      attr_reader :user_object
+
+      # This placeholder replaces the menu_userptr function in curses
+      def user_object=(obj)
+        @user_object = obj
+      end
+    end
+    
+    class ITEM
+      attr_reader :user_object
+
+      # This placeholder replaces the item_userptr function in curses
+      def user_object=(obj)
+        @user_object = obj
+      end
+    end
+  end
+end
+def Ncurses.inchnstr(str,n)
+  Ncurses.winchnstr(Ncurses.stdscr, str, n)
+end
+def Ncurses.inchstr(str)
+  Ncurses.winchstr(Ncurses.stdscr, str)
+end
+def Ncurses.mvinchnstr(y,x, str, n)
+  Ncurses.mvwinchnstr(Ncurses.stdscr, y,x, str, n)
+end
+def Ncurses.mvinchstr(y,x, str)
+  Ncurses.mvwinchstr(Ncurses.stdscr, y,x, str)
+end
+def Ncurses.mvwinchnstr(win, y,x, str, n)
+  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    Ncurses.winchnstr(win,str,n)
+  end
+end
+def Ncurses.mvwinchstr(win, y,x, str)
+  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
+  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
+  Ncurses.mvwinchnstr(win, y,x, str, maxx[0]+1)
+end
+def Ncurses.winchstr(win, str)
+  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
+  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
+  Ncurses.winchnstr(win, str, maxx[0]+1)
+end
+
+def Ncurses.getnstr(str,n)
+  Ncurses.wgetnstr(Ncurses.stdscr, str, n)
+end
+def Ncurses.mvgetnstr(y,x, str, n)
+  Ncurses.mvwgetnstr(Ncurses.stdscr, y,x, str, n)
+end
+def Ncurses.mvwgetnstr(win, y,x, str, n)
+  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    Ncurses.wgetnstr(win,str,n)
+  end
+end
+
+def Ncurses.innstr(str,n)
+  Ncurses.winnstr(Ncurses.stdscr, str, n)
+end
+def Ncurses.instr(str)
+  Ncurses.winstr(Ncurses.stdscr, str)
+end
+def Ncurses.mvinnstr(y,x, str, n)
+  Ncurses.mvwinnstr(Ncurses.stdscr, y,x, str, n)
+end
+def Ncurses.mvinstr(y,x, str)
+  Ncurses.mvwinstr(Ncurses.stdscr, y,x, str)
+end
+def Ncurses.mvwinnstr(win, y,x, str, n)
+  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    Ncurses.winnstr(win,str,n)
+  end
+end
+def Ncurses.mvwinstr(win, y,x, str)
+  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
+  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
+  Ncurses.mvwinnstr(win, y,x, str, maxx[0]+1)
+end
+def Ncurses.winstr(win, str)
+  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
+  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
+  Ncurses.winnstr(win, str, maxx[0]+1)
+end
+
+def Ncurses.mouse_trafo(pY, pX, to_screen)
+  Ncurses.wmouse_trafo(Ncurses.stdscr, pY, pX, to_screen)
+end
+
+def Ncurses.getcurx(win)
+  x = []; y = []; Ncurses.getyx(win, y,x); x[0]
+end
+def Ncurses.getcury(win)
+  x = []; y = []; Ncurses.getyx(win, y,x); y[0]
+end
+def Ncurses.getbegx(win)
+  x = []; y = []; Ncurses.getbegyx(win, y,x); x[0]
+end
+def Ncurses.getbegy(win)
+  x = []; y = []; Ncurses.getbegyx(win, y,x); y[0]
+end
+def Ncurses.getmaxx(win)
+  x = []; y = []; Ncurses.getmaxyx(win, y,x); x[0]
+end
+def Ncurses.getmaxy(win)
+  x = []; y = []; Ncurses.getmaxyx(win, y,x); y[0]
+end
+def Ncurses.getparx(win)
+  x = []; y = []; Ncurses.getparyx(win, y,x); x[0]
+end
+def Ncurses.getpary(win)
+  x = []; y = []; Ncurses.getparyx(win, y,x); y[0]
+end
+def Ncurses.erase
+  Ncurses.werase(Ncurses.stdscr)
+end
+def Ncurses.getstr(str)
+  Ncurses.getnstr(str, Ncurses::GETSTR_LIMIT)
+end
+def Ncurses.mvgetstr(y,x, str)
+  Ncurses.mvgetnstr(y,x, str, Ncurses::GETSTR_LIMIT)
+end
+def Ncurses.mvwgetstr(win, y,x, str)
+  Ncurses.mvwgetnstr(win, y,x, str, Ncurses::GETSTR_LIMIT)
+end
+def Ncurses.wgetstr(win, str)
+  Ncurses.wgetnstr(win, str, Ncurses::GETSTR_LIMIT)
+end
+
+def Ncurses.scanw(format, result)
+  Ncurses.wscanw(Ncurses.stdscr, format, result)
+end
+def Ncurses.mvscanw(y,x, format, result)
+  Ncurses.mvwscanw(Ncurses.stdscr, y,x, format, result)
+end
+def Ncurses.mvwscanw(win, y,x, format, result)
+  if (Ncurses.wmove(win, y,x) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    Ncurses.wscanw(win, format, result)
+  end
+end
+def Ncurses.wscanw(win, format, result)
+  str = ""
+  if (Ncurses.wgetstr(win, str) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    require "scanf.rb" # Use ruby's implementation of scanf
+    result.replace(str.scanf(format))
+  end
+end
+
+def Ncurses.mvprintw(*args)
+  Ncurses.mvwprintw(Ncurses.stdscr, *args)
+end
+def Ncurses.mvwprintw(win, y,x, *args)
+  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
+    Ncurses::ERR
+  else
+    wprintw(win, *args)
+  end
+end
+def Ncurses.printw(*args)
+  Ncurses.wprintw(Ncurses.stdscr, *args)
+end
+def Ncurses.touchline(win, start, count)
+  Ncurses.wtouchln(win, start, count, 1)
+end
+def Ncurses.touchwin(win)
+  wtouchln(win, 0, getmaxy(win), 1)
+end
+
+module Ncurses
+  Ncurses = self # for accessing Ncurses from a Module that includes Ncurses
+
+  # Some users like to include ncurses names despite namespace pollution
+  # This module is for them
+  module Namespace
+    def self.append_features(target)
+      # include constants
+      unless target.ancestors.member?(Ncurses)
+        target.__send__(:include, Ncurses)
+      end
+      
+      # make methods available
+      unless target.respond_to?(:pre_Ncurses_method_missing)
+        target.module_eval{
+          alias pre_Ncurses_method_missing method_missing
+          def method_missing(name, *args)
+            if Ncurses.respond_to?(name)
+              Ncurses.send(name, *args)
+            else
+              pre_Ncurses_method_missing(name, *args)
+            end
+          end
+        }
+      end
+    end
+    def self.entend_object(object)
+      class << object
+        self
+      end.__send__(:include, self)
+    end
+  end
+end
diff --git a/lib/ncursesw.rb b/lib/ncursesw.rb
@@ -1,7 +1,7 @@
 # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
 # (C) 2002, 2003, 2004 Tobias Peters <t-peters@users.berlios.de>
 # (C) 2004 Simon Kaczor <skaczor@cox.net>
-# (C) 2005 Tobias Herzke
+# (C) 2005 2011 Tobias Herzke
 #
 # This module is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,328 +17,7 @@
 # License along with this module; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-# $Id: ncurses.rb,v 1.8 2009/05/03 10:37:54 t-peters Exp $
+# $Id: ncursesw.rb,v 1.1 2011-05-30 23:05:51 t-peters Exp $
 
 require "ncursesw_bin.so"
-
-
-# Ncurses constants with leading underscore
-def Ncurses._XOPEN_CURSES
-  Ncurses::XOPEN_CURSES
-end
-def Ncurses._SUBWIN  
-  Ncurses::SUBWIN
-end
-def Ncurses._ENDLINE 
-  Ncurses::ENDLINE
-end
-def Ncurses._FULLWIN 
-  Ncurses::FULLWIN
-end
-def Ncurses._SCROLLWIN
-  Ncurses::SCROLLWIN
-end
-def Ncurses._ISPAD   
-  Ncurses::ISPAD
-end
-def Ncurses._HASMOVED
-  Ncurses::HASMOVED
-end
-def Ncurses._WRAPPED 
-  Ncurses::WRAPPED
-end
-def Ncurses._NOCHANGE
-  Ncurses::NOCHANGE
-end
-def Ncurses._NEWINDEX
-  Ncurses::NEWINDEX
-end
-
-
-module Ncurses
-  module Destroy_checker; def destroyed?; @destroyed; end; end
-  class WINDOW
-    include Destroy_checker
-    def method_missing(name, *args)
-      name = name.to_s
-      if (name[0,2] == "mv")
-        test_name = name.dup
-        test_name[2,0] = "w" # insert "w" after"mv"
-        if (Ncurses.respond_to?(test_name))
-          return Ncurses.send(test_name, self, *args)
-        end
-      end
-      test_name = "w" + name
-      if (Ncurses.respond_to?(test_name))
-        return Ncurses.send(test_name, self, *args)
-      end
-      Ncurses.send(name, self, *args)
-    end
-    def respond_to?(name)
-      name = name.to_s
-      if (name[0,2] == "mv" && Ncurses.respond_to?("mvw" + name[2..-1]))
-        return true
-      end
-      Ncurses.respond_to?("w" + name) || Ncurses.respond_to?(name)
-    end
-    def del
-      Ncurses.delwin(self)
-    end
-    alias delete del
-    def WINDOW.new(*args)
-      Ncurses.newwin(*args)
-    end
-  end
-  class SCREEN
-    include Destroy_checker
-    def del
-      Ncurses.delscreen(self)
-    end
-    alias delete del
-  end
-  class MEVENT
-    attr_accessor :id, :x,:y,:z, :bstate
-  end
-  GETSTR_LIMIT = 1024
-
-  module Panel 
-    class PANEL; end
-  end
-
-  module Form
-    class FORM
-      attr_reader :user_object
-
-      # This placeholder replaces the form_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-    
-    class FIELD
-      attr_reader :user_object
-
-      # This placeholder replaces the field_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-
-    class FIELDTYPE
-    end
-  end
-
-  module Menu
-    class MENU
-      attr_reader :user_object
-
-      # This placeholder replaces the menu_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-    
-    class ITEM
-      attr_reader :user_object
-
-      # This placeholder replaces the item_userptr function in curses
-      def user_object=(obj)
-        @user_object = obj
-      end
-    end
-  end
-end
-def Ncurses.inchnstr(str,n)
-  Ncurses.winchnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.inchstr(str)
-  Ncurses.winchstr(Ncurses.stdscr, str)
-end
-def Ncurses.mvinchnstr(y,x, str, n)
-  Ncurses.mvwinchnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvinchstr(y,x, str)
-  Ncurses.mvwinchstr(Ncurses.stdscr, y,x, str)
-end
-def Ncurses.mvwinchnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.winchnstr(win,str,n)
-  end
-end
-def Ncurses.mvwinchstr(win, y,x, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.mvwinchnstr(win, y,x, str, maxx[0]+1)
-end
-def Ncurses.winchstr(win, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.winchnstr(win, str, maxx[0]+1)
-end
-
-def Ncurses.getnstr(str,n)
-  Ncurses.wgetnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.mvgetnstr(y,x, str, n)
-  Ncurses.mvwgetnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvwgetnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.wgetnstr(win,str,n)
-  end
-end
-
-def Ncurses.innstr(str,n)
-  Ncurses.winnstr(Ncurses.stdscr, str, n)
-end
-def Ncurses.instr(str)
-  Ncurses.winstr(Ncurses.stdscr, str)
-end
-def Ncurses.mvinnstr(y,x, str, n)
-  Ncurses.mvwinnstr(Ncurses.stdscr, y,x, str, n)
-end
-def Ncurses.mvinstr(y,x, str)
-  Ncurses.mvwinstr(Ncurses.stdscr, y,x, str)
-end
-def Ncurses.mvwinnstr(win, y,x, str, n)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.winnstr(win,str,n)
-  end
-end
-def Ncurses.mvwinstr(win, y,x, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.mvwinnstr(win, y,x, str, maxx[0]+1)
-end
-def Ncurses.winstr(win, str)
-  maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
-  return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
-  Ncurses.winnstr(win, str, maxx[0]+1)
-end
-
-def Ncurses.mouse_trafo(pY, pX, to_screen)
-  Ncurses.wmouse_trafo(Ncurses.stdscr, pY, pX, to_screen)
-end
-
-def Ncurses.getcurx(win)
-  x = []; y = []; Ncurses.getyx(win, y,x); x[0]
-end
-def Ncurses.getcury(win)
-  x = []; y = []; Ncurses.getyx(win, y,x); y[0]
-end
-def Ncurses.getbegx(win)
-  x = []; y = []; Ncurses.getbegyx(win, y,x); x[0]
-end
-def Ncurses.getbegy(win)
-  x = []; y = []; Ncurses.getbegyx(win, y,x); y[0]
-end
-def Ncurses.getmaxx(win)
-  x = []; y = []; Ncurses.getmaxyx(win, y,x); x[0]
-end
-def Ncurses.getmaxy(win)
-  x = []; y = []; Ncurses.getmaxyx(win, y,x); y[0]
-end
-def Ncurses.getparx(win)
-  x = []; y = []; Ncurses.getparyx(win, y,x); x[0]
-end
-def Ncurses.getpary(win)
-  x = []; y = []; Ncurses.getparyx(win, y,x); y[0]
-end
-def Ncurses.erase
-  Ncurses.werase(Ncurses.stdscr)
-end
-def Ncurses.getstr(str)
-  Ncurses.getnstr(str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.mvgetstr(y,x, str)
-  Ncurses.mvgetnstr(y,x, str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.mvwgetstr(win, y,x, str)
-  Ncurses.mvwgetnstr(win, y,x, str, Ncurses::GETSTR_LIMIT)
-end
-def Ncurses.wgetstr(win, str)
-  Ncurses.wgetnstr(win, str, Ncurses::GETSTR_LIMIT)
-end
-
-def Ncurses.scanw(format, result)
-  Ncurses.wscanw(Ncurses.stdscr, format, result)
-end
-def Ncurses.mvscanw(y,x, format, result)
-  Ncurses.mvwscanw(Ncurses.stdscr, y,x, format, result)
-end
-def Ncurses.mvwscanw(win, y,x, format, result)
-  if (Ncurses.wmove(win, y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    Ncurses.wscanw(win, format, result)
-  end
-end
-def Ncurses.wscanw(win, format, result)
-  str = ""
-  if (Ncurses.wgetstr(win, str) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    require "scanf.rb" # Use ruby's implementation of scanf
-    result.replace(str.scanf(format))
-  end
-end
-
-def Ncurses.mvprintw(*args)
-  Ncurses.mvwprintw(Ncurses.stdscr, *args)
-end
-def Ncurses.mvwprintw(win, y,x, *args)
-  if (Ncurses.wmove(win,y,x) == Ncurses::ERR) 
-    Ncurses::ERR
-  else
-    wprintw(win, *args)
-  end
-end
-def Ncurses.printw(*args)
-  Ncurses.wprintw(Ncurses.stdscr, *args)
-end
-def Ncurses.touchline(win, start, count)
-  Ncurses.wtouchln(win, start, count, 1)
-end
-def Ncurses.touchwin(win)
-  wtouchln(win, 0, getmaxy(win), 1)
-end
-
-module Ncurses
-  Ncurses = self # for accessing Ncurses from a Module that includes Ncurses
-
-  # Some users like to include ncurses names despite namespace pollution
-  # This module is for them
-  module Namespace
-    def self.append_features(target)
-      # include constants
-      unless target.ancestors.member?(Ncurses)
-        target.__send__(:include, Ncurses)
-      end
-      
-      # make methods available
-      unless target.respond_to?(:pre_Ncurses_method_missing)
-        target.module_eval{
-          alias pre_Ncurses_method_missing method_missing
-          def method_missing(name, *args)
-            if Ncurses.respond_to?(name)
-              Ncurses.send(name, *args)
-            else
-              pre_Ncurses_method_missing(name, *args)
-            end
-          end
-        }
-      end
-    end
-    def self.entend_object(object)
-      class << object
-        self
-      end.__send__(:include, self)
-    end
-  end
-end
+require "ncurses_sugar.rb"
diff --git a/make_dist.rb b/make_dist.rb
@@ -1,6 +1,7 @@
 #!/usr/bin/env ruby
-
-# $Id: make_dist.rb,v 1.6 2003/08/29 22:50:12 t-peters Exp $
+# (C) 2002-2011 Tobias Herzke
+# License: LGPL v2.1
+# $Id: make_dist.rb,v 1.8 2011-05-30 23:05:50 t-peters Exp $
 
 require "fileutils"
 
@@ -10,36 +11,28 @@ def sys(i)
 end
 
 dir  = File.dirname(__FILE__)
-base = File.basename(dir)
-base = "ncurses-ruby" if base == "."
 
-files = IO.readlines(dir + "/MANIFEST").collect{|filename|filename.chomp}
+%w(ncurses ncursesw).each{|flavor|
+
+base = flavor+"-ruby"
 
-Version = File.new("#{dir}/VERSION").readline.chomp!
+files = IO.readlines(dir + "/MANIFEST_"+flavor).collect{|filename|filename.chomp}
+
+Version = File.new("#{dir}/VERSION").readline.chomp
 
 FileUtils.mkdir "#{base}-#{Version}"
 files.each{|filename|
   if filename.index "/"
     FileUtils.mkdir_p "#{base}-#{Version}/#{File.dirname(filename)}"
   end
-  sys "cp #{dir}/#{filename} #{base}-#{Version}/#{filename}"
+  if filename.index("example") 
+    sys "sed -e '/require/ s/ncurses/#{flavor}/' <#{dir}/#{filename} >#{base}-#{Version}/#{filename}"
+  else
+    sys "cp #{dir}/#{filename} #{base}-#{Version}/#{filename}"
+  end
 }
+sys "cp #{dir}/extconf_#{flavor}.rb #{base}-#{Version}/extconf.rb"
 sys "tar cjf #{base}-#{Version}.tar.bz2 --owner=0 --group=0 #{base}-#{Version}"
 
-# check if we create a binary distribution for a mingw extension
-binary_description = `file ncurses.so`
-
-if ((binary_description =~ /\s(windows)\s/i)                  &&
-    (binary_description =~ /\s(pe)|(portable executable)\s/i) &&
-    (binary_description =~ /\s(dll)\s/i))
-  sys "cp ncurses.so README.binary #{base}-#{Version}"
-  Dir.glob("#{base}-#{Version}/README*").each{|textfile|
-    text = IO.readlines(textfile).map{|line|line.chomp + "\r\n"}
-    File.open(textfile + ".txt", "wb"){|outfd| outfd.write(text.join)}
-    sys "rm #{textfile}"
-  }
-  sys "rm #{base}-#{Version}/{MANIFEST,make_dist.rb}"
-  sys "zip -9 -r #{base}-#{Version}-i386-mswin32.zip #{base}-#{Version}"
-end
-
 sys "rm -r #{base}-#{Version}/"
+}
diff --git a/menu_wrap.c b/menu_wrap.c
@@ -22,9 +22,11 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
 
 #include "menu_wrap.h"
 #include "ncurses_wrap.h"
diff --git a/menu_wrap.h b/menu_wrap.h
@@ -19,12 +19,18 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
+ * Changes
+ * (C) 2011 Tobias Herzke
  */
 
-#if !defined(MENU_HH) && defined(HAVE_MENU_H)
+#if !defined(MENU_HH) && (defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H))
 #define MENU_HH
 
+#ifdef HAVE_MENU_H
 #include <menu.h>
+#else
+#include <ncursesw/menu.h>
+#endif
 #include <ruby.h>
 
 extern VALUE mMenu;
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -2,7 +2,7 @@
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002, 2003, 2004 Tobias Peters <t-peters@berlios.de>
  * (C) 2004 Simon Kaczor <skaczor@cox.net>
- * (C) 2005 2006 2009 Tobias Herzke
+ * (C) 2005 2006 2009 2011 Tobias Herzke
  *
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
- * $Id: ncurses_wrap.c,v 1.18 2009/07/31 10:49:24 t-peters Exp $
+ * $Id: ncurses_wrap.c,v 1.19 2011-05-30 23:05:50 t-peters Exp $
  *
  * This file was adapted from the original ncurses header file which
  * has the following copyright statements:
@@ -336,15 +336,15 @@ static VALUE rbncurs_winnstr(VALUE dummy, VALUE rb_win, VALUE rb_chstr, VALUE rb
     return INT2NUM(return_value);
 }
 
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
 #include "panel_wrap.h" /* needs access to mNcurses, wrap_window, get_window */
 #endif
 
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
 #include "form_wrap.h" /* needs init_form */
 #endif
 
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
 #include "menu_wrap.h" /* needs init_menu */
 #endif
 
@@ -815,7 +815,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
     int halfdelay = NUM2INT(rb_iv_get(mNcurses, "@halfdelay"));
     int infd = NUM2INT(rb_iv_get(mNcurses, "@infd"));
     double screen_delay = halfdelay * 0.1;
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     int windelay = c_win->_delay;
 #else
     int windelay = 0;
@@ -832,26 +832,34 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
     gettimeofday(&tv, &tz);
     starttime = tv.tv_sec + tv.tv_usec * 1e-6;
     finishtime = starttime + delay;
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     c_win->_delay = 0;
 #endif
     while (doupdate() /* detects resize */, (result = wgetch(c_win)) == ERR) {
-        gettimeofday(&tv, &tz);
-        nowtime = tv.tv_sec + tv.tv_usec * 1e-6;
-        delay = finishtime - nowtime;
-	if (delay <= 0) break;
-
-	/* Check for terminal size change every resize_delay seconds */
-        if (resize_delay > delay) resize_delay = delay;
-        tv.tv_sec = (time_t)resize_delay;
-        tv.tv_usec = (unsigned)( (resize_delay - tv.tv_sec) * 1e6 );
-
-	/* sleep on infd until input is available or tv reaches timeout */
-	FD_ZERO(&in_fds);
-	FD_SET(infd, &in_fds);
-	rb_thread_select(infd + 1, &in_fds, NULL, NULL, &tv);
+      rb_fdset_t fdsets[3];
+      rb_fdset_t *rfds = NULL;
+      gettimeofday(&tv, &tz);
+      nowtime = tv.tv_sec + tv.tv_usec * 1e-6;
+      delay = finishtime - nowtime;
+      if (delay <= 0) break;
+
+      /* Check for terminal size change every resize_delay seconds */
+      if (resize_delay > delay) resize_delay = delay;
+      tv.tv_sec = (time_t)resize_delay;
+      tv.tv_usec = (unsigned)( (resize_delay - tv.tv_sec) * 1e6 );
+
+      /* sleep on infd until input is available or tv reaches timeout */
+      FD_ZERO(&in_fds);
+      FD_SET(infd, &in_fds);
+      //rb_thread_fd_select(infd + 1, &in_fds, NULL, NULL, &tv);
+
+      rfds = &fdsets[0];
+      rb_fd_init(rfds);
+      rb_fd_copy(rfds, &in_fds, infd +1);
+
+      rb_thread_fd_select(infd + 1, rfds, NULL, NULL, &tv);
     }
-#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
+#ifdef NCURSES_VERSION
     c_win->_delay = windelay;
 #endif
     return result;
@@ -2349,7 +2357,8 @@ static VALUE rbncurs_getparyx(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
 }
 static VALUE rbncurs_getsyx(VALUE dummy, VALUE rb_y, VALUE rb_x)
 {
-    int y,x;
+    int y = 0;
+    int x = 0;
     if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
         || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
         rb_raise(rb_eArgError,
@@ -2727,8 +2736,6 @@ static void init_safe_functions(void)
 }
 void Init_ncursesw_bin(void)
 {
-    setlocale(LC_ALL, "");
-
     mNcurses = rb_define_module("Ncurses");
     eNcurses = rb_define_class_under(mNcurses, "Exception", rb_eRuntimeError);
     rb_iv_set(mNcurses, "@windows_hash", rb_hash_new());
@@ -2759,13 +2766,13 @@ static void Init_ncurses_full(void)
     init_functions_3();
 
     init_SCREEN_methods();
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
     init_panel();
 #endif
-#ifdef HAVE_FORM_H
+#if defined(HAVE_FORM_H) || defined(HAVE_NCURSESW_FORM_H)
     init_form();
 #endif
-#ifdef HAVE_MENU_H
+#if defined(HAVE_MENU_H) || defined(HAVE_NCURSESW_MENU_H)
     init_menu();
 #endif
 }
diff --git a/ncurses_wrap.h b/ncurses_wrap.h
@@ -2,7 +2,7 @@
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002, 2003 Tobias Peters <t-peters@berlios.de>
  * (C) 2004 Simon Kaczor <skaczor@cox.net>
- * (C) 2009 Tobias Herzke
+ * (C) 2009 2011 Tobias Herzke
  *
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
  *  License along with this module; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  *
- * $Id: ncurses_wrap.h,v 1.3 2009/05/03 20:37:26 t-peters Exp $
+ * $Id: ncurses_wrap.h,v 1.4 2011-05-30 23:05:50 t-peters Exp $
  *
  * This file was adapted from the original ncurses header file which
  * has the following copyright statements:
@@ -79,11 +79,12 @@ int close(int);
 #  ifdef HAVE_NCURSES_CURSES_H
 #    include <ncurses/curses.h>
 #  else
-#    include <curses.h>
+#    ifdef HAVE_NCURSESW_CURSES_H
+#      include <ncursesw/curses.h>
+#    endif
 #  endif
 #endif
 
-#include <locale.h>
 #include <ruby.h>
 
 extern VALUE mNcurses;  /* module Ncurses */
diff --git a/ncurses_wrap.o b/ncurses_wrap.o
Binary files differ.
diff --git a/ncursesw.gemspec b/ncursesw.gemspec
@@ -8,7 +8,7 @@ SUMMARY = 'This wrapper provides access to the functions, macros, global variabl
 
 spec = Gem::Specification.new do |s|
   s.name        = 'ncursesw-sup'
-  s.version     = '1.2.4.4'
+  s.version     = '1.3.0'
   s.platform    = Gem::Platform::RUBY
   s.authors     = ['Tobias Herzke']
   s.email       = ['t-peters@users.berlios.de']
@@ -42,6 +42,7 @@ spec = Gem::Specification.new do |s|
     "ncurses_wrap.c",
     "ncurses_wrap.h",
     "lib/ncursesw.rb",
+    "lib/ncurses_sugar.rb",
     "panel_wrap.c",
     "panel_wrap.h",
     "menu_wrap.c",
diff --git a/panel_wrap.c b/panel_wrap.c
@@ -1,6 +1,7 @@
 /*
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002 Tobias Peters <t-peters@berlios.de>
+ * (C) 2011 Tobias Herzke
  * 
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -17,9 +18,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-/* $Id: panel_wrap.c,v 1.2 2004/07/31 08:35:13 t-peters Exp $ */
+/* $Id: panel_wrap.c,v 1.3 2011-05-30 23:05:50 t-peters Exp $ */
 
-#ifdef HAVE_PANEL_H
+#if defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H)
 
 #include "panel_wrap.h"
 #include "ncurses_wrap.h"
diff --git a/panel_wrap.h b/panel_wrap.h
@@ -1,6 +1,7 @@
 /*
  * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
  * (C) 2002 Tobias Peters <t-peters@berlios.de>
+ * (C) 2011 Tobias Herzke
  * 
  *  This module is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -17,11 +18,15 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-/* $Id: panel_wrap.h,v 1.5 2004/07/31 08:35:13 t-peters Exp $ */
+/* $Id: panel_wrap.h,v 1.6 2011-05-30 23:05:50 t-peters Exp $ */
 
-#if !defined(PANEL_HH) && defined(HAVE_PANEL_H)
+#if !defined(PANEL_HH) && (defined(HAVE_PANEL_H) || defined(HAVE_NCURSESW_PANEL_H))
 #define PANEL_HH
+#ifdef HAVE_PANEL_H
 #include <panel.h>
+#else
+#include <ncursesw/panel.h>
+#endif
 #include <ruby.h>
 
 extern VALUE mPanel;