curses: simplification, use wide character library to print utf8 strings

db4
Philipp Brüschweiler 2010-02-25 16:23:37 +01:00
parent c5b46d0be4
commit 1819da7f41
2 changed files with 7 additions and 19 deletions

View File

@ -407,8 +407,8 @@ TUPLE: mouse-event
: button-n? ( bstate n -- ? ) substate-n 0 = not ; inline : button-n? ( bstate n -- ? ) substate-n 0 = not ; inline
: fill-in-type ( mouse-event substate -- ) : fill-in-type ( mouse-event bstate button -- )
{ substate-n {
{ BUTTON1_RELEASED [ +released+ ] } { BUTTON1_RELEASED [ +released+ ] }
{ BUTTON1_PRESSED [ +pressed+ ] } { BUTTON1_PRESSED [ +pressed+ ] }
{ BUTTON1_CLICKED [ +clicked+ ] } { BUTTON1_CLICKED [ +clicked+ ] }
@ -418,22 +418,10 @@ TUPLE: mouse-event
: fill-in-bstate ( mouse-event bstate -- ) : fill-in-bstate ( mouse-event bstate -- )
2dup { 2dup {
{ { [ dup 1 button-n? ] [ [ 1 >>button ] dip 1 fill-in-type ] }
[ dup 1 button-n? ] { [ dup 2 button-n? ] [ [ 2 >>button ] dip 2 fill-in-type ] }
[ [ 1 >>button ] dip 1 substate-n fill-in-type ] { [ dup 3 button-n? ] [ [ 3 >>button ] dip 3 fill-in-type ] }
} { [ dup 4 button-n? ] [ [ 4 >>button ] dip 4 fill-in-type ] }
{
[ dup 2 button-n? ]
[ [ 2 >>button ] dip 2 substate-n fill-in-type ]
}
{
[ dup 3 button-n? ]
[ [ 3 >>button ] dip 3 substate-n fill-in-type ]
}
{
[ dup 4 button-n? ]
[ [ 4 >>button ] dip 4 substate-n fill-in-type ]
}
} cond } cond
{ {
[ BUTTON_CTRL bitand 0 = not [ t >>ctrl ] when drop ] [ BUTTON_CTRL bitand 0 = not [ t >>ctrl ] when drop ]

View File

@ -7,7 +7,7 @@ IN: curses.ffi
<< "curses" { << "curses" {
{ [ os winnt? ] [ "libcurses.dll" ] } { [ os winnt? ] [ "libcurses.dll" ] }
{ [ os macosx? ] [ "libcurses.dylib" ] } { [ os macosx? ] [ "libcurses.dylib" ] }
{ [ os unix? ] [ "libncurses.so.5.7" ] } { [ os unix? ] [ "libncursesw.so.5.7" ] }
} cond cdecl add-library >> } cond cdecl add-library >>
C-TYPE: WINDOW C-TYPE: WINDOW