Skip to content
This repository has been archived by the owner on Mar 5, 2019. It is now read-only.

Updated code to be compatible with Dart 2.2 #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ packages/
# Include when developing application packages.
pubspec.lock
lib/libdart_curses.dylib
lib/libdart_curses.so
2 changes: 1 addition & 1 deletion bin/test_curses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() {
w.dispose();
stdscr.dispose();

var strKey = new String.fromCharCode(key);
var strKey = new String.fromCharCode(key.keyCode);
print("key = $strKey");
});

Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
all:
gcc -I/opt/dart/dart-sdk -fPIC -shared -lcurses -undefined dynamic_lookup -o libdart_curses.dylib dart_curses.cc
clang -I/usr/lib/dart -fPIC -shared -lcurses -undefined dynamic_lookup -o libdart_curses.so dart_curses.cc
5 changes: 3 additions & 2 deletions lib/curses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class Key {

String toString() => 'Key(${name}, ${_keyCode})';

int get keyCode => _keyCode;
}

class Screen extends Window {
Expand Down Expand Up @@ -461,9 +462,9 @@ class Window {

final receivePort = new ReceivePort();

receivePort.listen((int keyCode) {
receivePort.listen((keyCode) {
receivePort.close();
completer.complete(new Key._fromKeyCode(keyCode));
completer.complete(new Key._fromKeyCode(keyCode as int));
});

_wgetch.send([_window, receivePort.sendPort]);
Expand Down
2 changes: 1 addition & 1 deletion lib/dart_curses.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void wrapped_wgetch(Dart_Port dest_port_id, Dart_CObject* message) {
Dart_CObject* _receivePort = message->value.as_array.values[1];

int64_t window = _window->value.as_int64;
Dart_Port receivePort = _receivePort->value.as_send_port;
Dart_Port receivePort = _receivePort->value.as_send_port.id;

int64_t key = wgetch((WINDOW*)window);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ author: Iván Zaera Avellón <[email protected]>
description: Bindings for curses library in Dart
homepage: https://github.com/izaera/dart-curses
environment:
sdk: '>=0.8.10+6 <2.0.0'
sdk: '>=0.8.10+6 <=2.2.0'
dependencies:
logging: any