-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The input is now done by ncurses itself. The driver starts a thread that will do getch() continuously and send a message back to Erlang when it has a character. meanwhile if a process asks for a char (cecho:getch()) it will block by first sending a message to the cecho_srv process and "register" itself as waiting and then as soon as a key input is read from the driver it will be sent to it. If a message is received from the port and no process is waiting for the character then the message will be discarded. If a process tries to do cecho:getch() at the same time as another one is already blocking the process that called cecho:getch() last will be killed. If special characters need to be captured then cecho:keypad/2 must be used to enable keypad mode. NOTE: erl must be started with +A <N> where N is a number (probably above 40, try e.g. 50 or above) AND the flag -noinput must be given to stop the erlang shell from reading input (and thus competing) with cecho. To test the new feature run cecho_example:input() as follows: $> pwd /home/mazen/dev/repos/cecho $> erl -pa ../cecho/ebin/ -noinput -eval 'cecho_example:input(),halt().' +A 50 $> Use 'q' to quit.
- Loading branch information
1 parent
4769266
commit 7f6fd67
Showing
4 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters