8 Commits

Author SHA1 Message Date
David Herrmann
885bdef87b pty: change callback parameters to "const xy"
There is no reason to allow the callbacks to modify our internal data so
make it constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-29 14:22:48 +01:00
David Herrmann
229b4bfde2 pty: buffer data between pty and child
If the child returns EWOULDBLOCK on write we need to save the input in a
buffer to avoid loosing data. We need to work in non-blocking mode to
avoid UI hangs so we simply use the new ring-buffer object to store
data.

This also changes the callback behavior. The pty is no longer closed
implicitely so the owner must call pty_close now even if the close
callback is called. This avoids circular callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 17:17:20 +01:00
David Herrmann
ecb7ddbc29 pty: merge input and close callbacks
There is no reason to keep two callbacks as the caller always registers
both. Hence, we can use a shared callback. Reading length 0 means closed
like reading from an fd.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 14:03:52 +01:00
David Herrmann
da0623c260 terminal, pty: pass eloop reference on obj creation
There is no reason to pass the eloop reference late at terminal/pty
open. If we pass it early on object creation we will always have a valid
reference and can remove several code paths.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:56:13 +01:00
David Herrmann
9b4c6c5542 pty: move output_cb to input_cb
The output_cb handles output from the pty but it actually makes more
sense to call it input_cb as we are handling input to our console here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:45:06 +01:00
David Herrmann
cda62d3e60 pty: move pty_input to pty_write
pty_write actually makes more sense as we are writing to the other end
and not reading input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:44:25 +01:00
David Herrmann
c3d2ea3eb2 pty: fix style issue
Fix small indentation style issue.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:43:09 +01:00
Ran Benita
c63a5f2b95 Add pseudo terminal support
This commit adds a new pty object.

The pty object takes care of all pseudo terminal handling, reading and
writing. It can be opened and closed, and notify through callbacks when
input arrives or the child process exits/dies. It can also receive input
and pass it along to the child process.

There is not yet any real VTE processing, so we display raw escape
codes and so on. However, this should provide immediate feedback for
any further vte development, as we start to act like a real terminal
emulator.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-23 14:02:43 +01:00