ncursesw 1.4.11 → 1.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes +3 -0
- data/extconf.rb +0 -8
- data/ncurses_wrap.c +28 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a846d10840ceea6519165015d366a350d41c791c65fde5e882cffb5bbc2e157
|
4
|
+
data.tar.gz: 6a10a52e885cb8824bf10c734855f4862dcaeec3d020b9afcf6995311febd2a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8cbd887172807b687a9d59be846d48c8e92fd86c2b7bb73aa34ef171672f9ad7c96a91083ca3a78380ce3f70976213af8c4089b3832edefe0762dd0c9eabf18
|
7
|
+
data.tar.gz: 9f24b8e345dfe91b83311adc913aeef03ddf077888e7517b7dd15ef9f03d38a7f55184be61ef1fdc1ae652069dbe96940a0847a675e0272007717b847c919e5a
|
data/Changes
CHANGED
data/extconf.rb
CHANGED
@@ -174,14 +174,6 @@ if have_func("rb_thread_fd_select")
|
|
174
174
|
$CFLAGS += " -DHAVE_RB_THREAD_FD_SELECT"
|
175
175
|
end
|
176
176
|
|
177
|
-
# Avoid dereferencing WINDOW pointers on FreeBSD
|
178
|
-
if RUBY_PLATFORM =~ /freebsd/
|
179
|
-
$CFLAGS += " -DNCURSES_OPAQUE=1"
|
180
|
-
else
|
181
|
-
# add NCURSES_OPAQUE for mac
|
182
|
-
$CFLAGS += " -DNCURSES_OPAQUE=0"
|
183
|
-
end
|
184
|
-
|
185
177
|
if have_func("clock_gettime")
|
186
178
|
$CFLAGS += " -DHAVE_CLOCK_GETTIME"
|
187
179
|
end
|
data/ncurses_wrap.c
CHANGED
@@ -233,6 +233,7 @@ VALUE wrap_window(WINDOW* window)
|
|
233
233
|
if (rb_window == Qnil) {
|
234
234
|
rb_window = Data_Wrap_Struct(cWINDOW, 0, 0, window);
|
235
235
|
rb_iv_set(rb_window, "@destroyed", Qfalse);
|
236
|
+
rb_iv_set(rb_window, "@timeout", INT2FIX(-1));
|
236
237
|
rb_hash_aset(windows_hash, window_adress, rb_window);
|
237
238
|
}
|
238
239
|
return rb_window;
|
@@ -838,16 +839,11 @@ static VALUE rbncurs_getbkgd(VALUE dummy, VALUE arg1) {
|
|
838
839
|
typedef int (*wgetch_func) (WINDOW *);
|
839
840
|
|
840
841
|
/* functor for getting a char nonblocking, pass getchar function */
|
841
|
-
static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_func) {
|
842
|
+
static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_func, int windelay) {
|
842
843
|
/* nonblocking wgetch only implemented for Ncurses */
|
843
844
|
int halfdelay = NUM2INT(rb_iv_get(mNcurses, "@halfdelay"));
|
844
845
|
int infd = NUM2INT(rb_iv_get(mNcurses, "@infd"));
|
845
846
|
double screen_delay = halfdelay * 0.1;
|
846
|
-
#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
|
847
|
-
int windelay = c_win->_delay;
|
848
|
-
#else
|
849
|
-
int windelay = 0;
|
850
|
-
#endif
|
851
847
|
double window_delay = (windelay >= 0) ? 0.001 * windelay : (1e200*1e200);
|
852
848
|
/* FIXME: ^ Infinity ^*/
|
853
849
|
double delay = (screen_delay > 0) ? screen_delay : window_delay;
|
@@ -867,9 +863,7 @@ static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_f
|
|
867
863
|
starttime = tv.tv_sec + tv.tv_usec * 1e-6;
|
868
864
|
#endif
|
869
865
|
finishtime = starttime + delay;
|
870
|
-
|
871
|
-
c_win->_delay = 0;
|
872
|
-
#endif
|
866
|
+
wtimeout(c_win, 0);
|
873
867
|
while (doupdate() /* detects resize */, (result = _wgetch_func(c_win)) == ERR) {
|
874
868
|
#ifdef HAVE_RB_THREAD_FD_SELECT
|
875
869
|
rb_fdset_t fdsets[3];
|
@@ -922,15 +916,13 @@ static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_f
|
|
922
916
|
#endif
|
923
917
|
#endif
|
924
918
|
}
|
925
|
-
|
926
|
-
c_win->_delay = windelay;
|
927
|
-
#endif
|
919
|
+
wtimeout(c_win, windelay);
|
928
920
|
return result;
|
929
921
|
}
|
930
922
|
|
931
923
|
/* non-wide char getch */
|
932
|
-
static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
|
933
|
-
return rbncurshelper_do_wgetch_functor (c_win, &wgetch);
|
924
|
+
static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win, int windelay) {
|
925
|
+
return rbncurshelper_do_wgetch_functor (c_win, &wgetch, windelay);
|
934
926
|
}
|
935
927
|
|
936
928
|
#ifdef HAVE_GET_WCH
|
@@ -942,20 +934,22 @@ static int my_wget_wch (WINDOW *c_win) {
|
|
942
934
|
|
943
935
|
/* return array with first element being return key code status,
|
944
936
|
* and second element the key code */
|
945
|
-
static VALUE rbncurshelper_nonblocking_wget_wch(WINDOW *c_win) {
|
946
|
-
int retcode = rbncurshelper_do_wgetch_functor (c_win, &my_wget_wch);
|
937
|
+
static VALUE rbncurshelper_nonblocking_wget_wch(WINDOW *c_win, int windelay) {
|
938
|
+
int retcode = rbncurshelper_do_wgetch_functor (c_win, &my_wget_wch, windelay);
|
947
939
|
VALUE r = rb_assoc_new (INT2NUM(retcode), LONG2NUM(wget_wch_back));
|
948
940
|
return r;
|
949
941
|
}
|
950
942
|
#endif
|
951
943
|
|
952
944
|
static VALUE rbncurs_getch(VALUE dummy) {
|
953
|
-
|
945
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(), "@timeout"));
|
946
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr, windelay));
|
954
947
|
}
|
955
948
|
|
956
949
|
#ifdef HAVE_GET_WCH
|
957
950
|
static VALUE rbncurs_get_wch(VALUE dummy) {
|
958
|
-
|
951
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(), "@timeout"));
|
952
|
+
return rbncurshelper_nonblocking_wget_wch(stdscr, windelay);
|
959
953
|
}
|
960
954
|
#endif
|
961
955
|
|
@@ -1191,9 +1185,10 @@ static VALUE rbncurs_mvderwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
|
1191
1185
|
return INT2NUM(mvderwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
|
1192
1186
|
}
|
1193
1187
|
static VALUE rbncurs_mvgetch(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1188
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(), "@timeout"));
|
1194
1189
|
if (wmove(stdscr, NUM2INT(arg1), NUM2INT(arg2)) == ERR)
|
1195
1190
|
return INT2NUM(ERR);
|
1196
|
-
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr));
|
1191
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr, windelay));
|
1197
1192
|
}
|
1198
1193
|
#ifdef HAVE_MVHLINE
|
1199
1194
|
static VALUE rbncurs_mvhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
|
@@ -1253,9 +1248,10 @@ static VALUE rbncurs_mvwdelch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
|
1253
1248
|
}
|
1254
1249
|
static VALUE rbncurs_mvwgetch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
1255
1250
|
WINDOW * c_win = get_window(arg1);
|
1251
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1256
1252
|
if (wmove(c_win, NUM2INT(arg1), NUM2INT(arg2)) == ERR)
|
1257
1253
|
return INT2NUM(ERR);
|
1258
|
-
return INT2NUM(rbncurshelper_nonblocking_wgetch(c_win));
|
1254
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(c_win, windelay));
|
1259
1255
|
}
|
1260
1256
|
#ifdef HAVE_MVWHLINE
|
1261
1257
|
static VALUE rbncurs_mvwhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
|
@@ -1298,7 +1294,12 @@ static VALUE rbncurs_nocbreak(VALUE dummy) {
|
|
1298
1294
|
return INT2NUM(rbncurshelper_halfdelay_cbreak(0, 0));
|
1299
1295
|
}
|
1300
1296
|
static VALUE rbncurs_nodelay(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1301
|
-
|
1297
|
+
bool flag = RTEST(arg2);
|
1298
|
+
int return_value = nodelay(get_window(arg1), flag);
|
1299
|
+
if (return_value != ERR) {
|
1300
|
+
rb_iv_set(arg1, "@timeout", INT2FIX(flag ? 0 : -1));
|
1301
|
+
}
|
1302
|
+
return INT2NUM(return_value);
|
1302
1303
|
}
|
1303
1304
|
static VALUE rbncurs_noecho(VALUE dummy) {
|
1304
1305
|
return INT2NUM(noecho());
|
@@ -1498,6 +1499,7 @@ static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
|
|
1498
1499
|
}
|
1499
1500
|
#endif
|
1500
1501
|
static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {
|
1502
|
+
rb_iv_set(get_stdscr(), "@timeout", arg1);
|
1501
1503
|
return ((timeout(NUM2INT(arg1))),Qnil);
|
1502
1504
|
}
|
1503
1505
|
static VALUE rbncurs_typeahead(VALUE dummy, VALUE arg1) {
|
@@ -1603,12 +1605,14 @@ static VALUE rbncurs_werase(VALUE dummy, VALUE arg1) {
|
|
1603
1605
|
return INT2NUM(werase(get_window(arg1)));
|
1604
1606
|
}
|
1605
1607
|
static VALUE rbncurs_wgetch(VALUE dummy, VALUE arg1) {
|
1606
|
-
|
1608
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1609
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(get_window(arg1), windelay));
|
1607
1610
|
}
|
1608
1611
|
|
1609
1612
|
#ifdef HAVE_GET_WCH
|
1610
1613
|
static VALUE rbncurs_wget_wch(VALUE dummy, VALUE arg1) {
|
1611
|
-
|
1614
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1615
|
+
return rbncurshelper_nonblocking_wget_wch(get_window(arg1), windelay);
|
1612
1616
|
}
|
1613
1617
|
#endif
|
1614
1618
|
|
@@ -1664,6 +1668,7 @@ static VALUE rbncurs_wsyncup(VALUE dummy, VALUE arg1) {
|
|
1664
1668
|
return ((wsyncup(get_window(arg1))),Qnil);
|
1665
1669
|
}
|
1666
1670
|
static VALUE rbncurs_wtimeout(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1671
|
+
rb_iv_set(arg1, "@timeout", arg2);
|
1667
1672
|
return ((wtimeout(get_window(arg1), NUM2INT(arg2))),Qnil);
|
1668
1673
|
}
|
1669
1674
|
static VALUE rbncurs_wtouchln(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncursesw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Herzke
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
68
|
+
rubygems_version: 3.5.22
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: 'This wrapper provides access to the functions, macros, global variables
|