Skip to content

Commit f5b8d4e

Browse files
committed
Check whether newterm() is available
1 parent f53fdbd commit f5b8d4e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ext/curses/curses.c

+10
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ rb_obj2chtype_inline(VALUE x)
9898

9999
static VALUE mCurses;
100100
static VALUE mKey;
101+
#ifdef HAVE_NEWTERM
101102
static VALUE cScreen;
103+
#endif
102104
static VALUE cWindow;
105+
#ifdef HAVE_NEWPAD
103106
static VALUE cPad;
107+
#endif
104108
#ifdef USE_MOUSE
105109
static VALUE cMouseEvent;
106110
#endif
@@ -1688,6 +1692,8 @@ curses_reset_prog_mode(VALUE obj)
16881692

16891693
/*-------------------------- class Screen --------------------------*/
16901694

1695+
#ifdef HAVE_NEWTERM
1696+
16911697
struct screendata {
16921698
SCREEN *screen;
16931699
VALUE stdscr;
@@ -1797,6 +1803,8 @@ screen_set_term(VALUE obj)
17971803
return Qnil;
17981804
}
17991805

1806+
#endif /* HAVE_NEWTERM */
1807+
18001808
/*-------------------------- class Window --------------------------*/
18011809

18021810
/* returns a Curses::Window object */
@@ -5112,6 +5120,7 @@ Init_curses(void)
51125120
rb_define_const(mCurses, "VERSION", version);
51135121
}
51145122

5123+
#ifdef HAVE_NEWTERM
51155124
/*
51165125
* Document-class: Curses::Screen
51175126
*
@@ -5137,6 +5146,7 @@ Init_curses(void)
51375146
rb_define_alloc_func(cScreen, screen_s_allocate);
51385147
rb_define_method(cScreen, "initialize", screen_initialize, -1);
51395148
rb_define_method(cScreen, "set_term", screen_set_term, 0);
5149+
#endif
51405150

51415151
/*
51425152
* Document-class: Curses::Window

ext/curses/extconf.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def exec_command(cmd)
122122
def_prog_mode reset_prog_mode timeout wtimeout nodelay
123123
init_color wcolor_set use_default_colors assume_default_colors
124124
newpad unget_wch get_wch wget_wch PDC_get_key_modifiers
125-
chgat wchgat)
125+
chgat wchgat newterm)
126126
have_func(f) || (have_macro(f, curses) && $defs.push(format("-DHAVE_%s", f.upcase)))
127127
end
128128
convertible_int('chtype', [["#undef MOUSE_MOVED\n"]]+curses) or abort

0 commit comments

Comments
 (0)