David Herrmann [Thu, 1 Mar 2012 10:37:27 +0000 (11:37 +0100)]
vte: improve docs
Add parser-links to the docs and add summary comment to the vte.c source file.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 29 Feb 2012 16:21:53 +0000 (17:21 +0100)]
vte: add 8bit C1 7bit equivalents (dummy)
Many 8bit C1 codes have 7bit escape sequences as equivalents. This adds handlers
for all of them with comments what they are supposed to do. They are dummies for
now but they will be implemented later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 29 Feb 2012 16:11:25 +0000 (17:11 +0100)]
vte: add 8-bit C1 code handlers (dummy)
Add handlers for C1 codes with a description what they are supposed to do. They
are not yet implemented and are no-ops.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 29 Feb 2012 14:25:53 +0000 (15:25 +0100)]
vte: new state machine implementation
This is now a fully vt500-series compliant state machine that parses escape
sequences. See vt100.net/emu for information on this state-machine. This is
written from scratch, though.
It now handles all kind of escape sequences that we every want to support. It
correctly ignores all unsupported ones right now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Mon, 27 Feb 2012 16:49:15 +0000 (17:49 +0100)]
kbd_xkb: use new xkbcommon version
The header file moved and the xkb_keycode_t type was introduced.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 17:40:31 +0000 (18:40 +0100)]
output: drop drm-master on open() to avoid Xserver bugs
The xserver currently crashes if we switch to its VT and it cannot claim
drm-master. This normally does not happen as we drop drm-master on
VT-leave. However, after calling open() on the drm char-dev we are
automatically drm-master so we should drop it right away as our VT is
not guaranteed to be opened at this time.
There is currently no way to call open() on the drm char-dev without
getting drm-master so there is still a short time-period when we have no
active VT but are drm-master. Switching to X in this short time-period
will still kill the X-server but we are not responsible for horrible
X-server bugs so we ignore this 10ms time-span.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 15:03:13 +0000 (16:03 +0100)]
vte: extend CSI debug message
Print the CSI command in debug messages so we can better understand what
escape commands were sent.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 15:02:21 +0000 (16:02 +0100)]
vte: implement backspace control
Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 15:01:12 +0000 (16:01 +0100)]
vte: implement basic cursor movement CSI
The A, B, C and D CSIs are used to move the cursor in the scroll-region
without scrolling the buffer when reaching the margins.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:55:22 +0000 (15:55 +0100)]
vte: implement CSI-J
The J CSI is used to erase parts of the screen.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:52:34 +0000 (15:52 +0100)]
vte: implement CSI-K
The K CSI is used to erase parts of the current line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:45:43 +0000 (15:45 +0100)]
vte: implement basic cursor-movement controls
This adds support for line-feed and carriage-return controls. The two
special line-feed controls which are not \n do not take care NL-mode so
they must be handled separately.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:44:20 +0000 (15:44 +0100)]
console: fix bug in buffer-erase helper
We didn't check for NULL line so we got segfaults when erasing empty
lines. Fix this.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:14:45 +0000 (15:14 +0100)]
console: add helper to erase current position
This helper erases the current cursor position.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:11:34 +0000 (15:11 +0100)]
console: fix pending-wrap bug in erase helpers
When erasing from the cursor position to line/screen end we must include
the current cursor position in the clear-region. We already did this but
missed the fact that there might be a pending-wrap so we might miss the
current position. Fix this.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:10:12 +0000 (15:10 +0100)]
console: enable auto_wrap by default
vt100 have auto_wrap enabled by default so we should do so, too.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:06:06 +0000 (15:06 +0100)]
console: fix bug in *_erase_screen()
We must erase the whole screen and not only until the current cursor
position. Probably a copy-paste typo.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 14:04:43 +0000 (15:04 +0100)]
console: fix bug in *_move_left()
We must take care of pending-wraps when moving left so we do not miss a
single character.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 5 Feb 2012 13:36:32 +0000 (14:36 +0100)]
console: add to line movement helpers
Add two helpers to move to the end or home of the current line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 17:31:10 +0000 (18:31 +0100)]
console: add erase-helpers
Add functions to erase several parts of the screen.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Sat, 4 Feb 2012 13:19:33 +0000 (15:19 +0200)]
ring: fix is_empty
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 15:24:01 +0000 (16:24 +0100)]
console: add function to erase buffer
New function which helps erasing a whole region of the buffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 14:50:03 +0000 (15:50 +0100)]
console: add basic cursor movements
Add functions to move the cursor up/down/left/right. We must take care
of integer overflows here as the application may send us arbitrarily big
numbers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 14:49:14 +0000 (15:49 +0100)]
console: add auto-wrap mode
If auto-wrap mode is enabled we automatically advance the cursor to the
next line if we hit the end of line. Otherwise, we simply continue
overwriting the last character in the line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 14:25:44 +0000 (15:25 +0100)]
console: add *_move_to() function
*_move_to() can be used to position the pointer at an arbitrary position
inside the buffer. If in relative-addressing mode, you cannot position
it outside the scroll-region, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 13:49:06 +0000 (14:49 +0100)]
console: make console wrapper margin aware
Keep reference to top-most and bottom-most line of scroll buffer in
console wrapper. The margin_top and margin_bottom indexes are different
from them used in the buffer handler! We use indexes now instead of line
counts. This makes the handling much easier.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 13:34:33 +0000 (14:34 +0100)]
console: remove *_buffer_newline()
This function is no longer needed as we now have proper scrolling
functions. This also adjusts the buffer tests to be more appropriate.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 4 Feb 2012 13:32:09 +0000 (14:32 +0100)]
console: fix bug in console resizing
When resizing the scroll buffer to a bigger size we try to get lines
from the scroll-back buffer into our current buffer. However, we do not
know how many lines we can get so we start filling the bottom of the
buffer and when no more lines are available, we simply move these lines
to the top of the buffer.
However, we didn't clear the bottom of the buffer after that operation
so if the scroll-back buffer is too small to get us enough lines for
resizing, we currently have a corrupted buffer-bottom. This fixes this
bug by simply setting those lines to NULL as anyone would expect.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 3 Feb 2012 22:47:09 +0000 (23:47 +0100)]
console: implement proper scrolling
Add two new functions to rotate the scroll-area of the buffer. We push
lines to the scroll-back buffer if they are pushed out to the top. Lines
pushed out to the bottom are simply freed.
We never take back lines from the scrollback buffer as applications
expect the new lines to be empty.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 3 Feb 2012 17:43:56 +0000 (18:43 +0100)]
test_buffer: add margin tests
Modify the buffer test to add margin tests.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 3 Feb 2012 16:48:09 +0000 (17:48 +0100)]
console: add margin API
Allow external subsystems to modify the margin sizes. When setting the
margins we must take care to first perform the shrink operation and then
the grow operations. For instance, if our current top margin is 10 and
the bottom margin is 0 and the application requests to swap the margin
sizes, we should *first* shrink the top margin to 0 and then grow the
bottom margin to 10. Otherwise, we might end up with garbled margins on
a buffer which is smaller than 20 lines.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 3 Feb 2012 16:16:50 +0000 (17:16 +0100)]
console: add margin support
Margins are a method to stick lines to the top and bottom of a buffer
and ignore them during console-rotations. We keep 3 different buffers,
two static buffers for the top and bottom margin and one buffer for the
scroll region. The scroll region is always big enough to hold all three
buffers even though it does not contain them. This allows us to merge
the margins back to the scroll-buffer very fast without reallocations.
The buffer layout is the top-margin at the top. The scroll region is
below and the bottom margin is at the bottom. If we rotate the buffer,
we do not touch the margins but simply rotate the scroll buffer. This
may corrupt the scroll-back buffer but there is no sane way to implement
this. The original VTs did not support this either.
Even though we have multiple buffers we keep the buffer-fill logic. That
is, the scroll buffer is not always fully filled. However, if we merge
back the bottom buffer to the scroll buffer, we set the scroll buffer to
be fully filled. Otherwise, we would have artifacts at the bottom.
The top margin does not show this behavior as it is not affected by
rotations below the fill-line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 3 Feb 2012 14:22:36 +0000 (15:22 +0100)]
console: rename buffer to scroll-buffer
The main buffer of the console buffer is now renamed to scroll-buffer.
This allows us to add other buffers like a margin-buffer to the same
buffer object.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 16:52:54 +0000 (17:52 +0100)]
console: do not fill buffer if not required
We allow NULL lines in the buffer so we no longer have to create empty
lines when writing anywhere in the buffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 16:44:54 +0000 (17:44 +0100)]
console: allow NULL lines in buffer
If we see a NULL line inside the buffer we assume the line is empty.
That is, we now longer abort the drawing but continue with the next
line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 16:41:43 +0000 (17:41 +0100)]
console: allow to push empty lines to scrollback buffer
When pushing a line=NULL to the scrollback buffer we now assume that the
line was empty and we allocate a new empty line. If the allocation fails
we simply drop that line.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 16:01:54 +0000 (17:01 +0100)]
console: move kmscon_console_rotate to *_newline
We do no rotation so rename the function to the more appropriate name
kmscon_console_newline.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 15:47:43 +0000 (16:47 +0100)]
console: add function to clear scrollback buffer
The new function can be used by the UI to clear the current scrollback
buffer to free resources or whatever. It will also be used by the CSI
handler to reset the console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 15:43:15 +0000 (16:43 +0100)]
console: add function to set max scrollback buffer size
The maximum scrollback-buffer size can now be changed on the fly. We
also reduce the current buffer size to the new size so we do not need to
clear the console to flush the scrollback buffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 15:33:00 +0000 (16:33 +0100)]
console: set sb_max to 0 by default
The scrollback-buffer maximum is 0 by default to avoid strange
hard-coded default values.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Thu, 2 Feb 2012 15:30:18 +0000 (16:30 +0100)]
console: allow scrollback-buffer maximum = 0
The scrollback buffer has a variable maximum of lines which can be set
by the application. We currently require it to be greater than 0. This
allows sb_max to be 0 so we can have a console buffer without a
scroll-back buffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Wed, 1 Feb 2012 21:35:02 +0000 (22:35 +0100)]
eloop: add timer support
Add support for dispatching events every given interval. timerfd is used
for hooking up to the event loop, similar to how signalfd is used.
Only relative, monotonic and possibly repeating timer events are
supported. It can be enhanced if there's ever a need.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 1 Feb 2012 18:33:38 +0000 (19:33 +0100)]
vte: add stub CSI parser
The new parser reads CSI parameters correctly and saves them in an array
for later evaluation. We currently do not handle the CSI commands. This
needs to be added now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 1 Feb 2012 16:13:22 +0000 (17:13 +0100)]
vte: parse basic control codes
This adds a parser for basic control codes but does not implement their
functionality, yet. Only the newline handler is kept.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 1 Feb 2012 15:03:54 +0000 (16:03 +0100)]
vte: first check for special keys then for ucs4 char
We should first check whether we recognize the XK_* identifier before we
rely on the converted UCS4 character.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Wed, 1 Feb 2012 14:59:53 +0000 (15:59 +0100)]
vte: implement basic key mappings
The system keys are mapped to their ASCII equivalents. We do not support
CR/NL mode nor scroll-lock yet (is this supported by any term?).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Tue, 31 Jan 2012 18:59:02 +0000 (19:59 +0100)]
doc: add VTE links and resources
The vte.txt file will contain information about the terminal emulator
used by KMSCON. Our main goal is xterm-compatibility but for now it
might be easier to try to be linux-console compatible.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Mon, 30 Jan 2012 21:01:32 +0000 (22:01 +0100)]
pty: avoid 4KB buffers on the stack
Allocate the IO-buffer dynamically on the heap for every pty object to
avoid 4KB objects on the stack. This may not be a problem now but we
might get stack overflows later if we continue to use such huge arrays
on the stack.
This doesn't affect the runtime performance as the buffer is still
allocated only once on pty-creation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Mon, 30 Jan 2012 16:50:28 +0000 (18:50 +0200)]
pty: increase input buffer size
Increase the buffer size to match the kernel's. This should guarantee
(practically) that we read() everything queued up for us.
This speeds us up considerably when running something like
$ find /
Such a process spends most of its time blocking on write() waiting for
us. By increasing the buffer size we avoid repeated
read pty -> draw screen -> read pty
cycles, which take most of our time.
To time it, before:
real 0m22.588s
user 0m00.000s
sys 0m00.020s
After:
real 0m00.680s
user 0m00.023s
sys 0m00.000s
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Sat, 28 Jan 2012 19:51:40 +0000 (21:51 +0200)]
kbd: correctly initialize refcount
The ->ref field was always zero and so the object was never released.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Sat, 28 Jan 2012 19:21:44 +0000 (21:21 +0200)]
xkb: fix invalid read from uninitialized memory
The memset was missing a sizeof(..) multiplication.
Really the entire function is more complex than need be, so simplify it.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 29 Jan 2012 16:10:51 +0000 (17:10 +0100)]
Remove TODO
The TODO is now located in the wiki at github.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 29 Jan 2012 13:51:35 +0000 (14:51 +0100)]
vte: handle keyboard "return"/linefeed
This makes the VTE subsystem emulate a linefeed if XK_Return is read
from the keyboard.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 29 Jan 2012 13:23:27 +0000 (14:23 +0100)]
terminal: use UTF8 state machine
This adds a converter from UTF8 stream to UCS4 data so the VTE subsystem
can handle the input correctly without complicated UTF8 input.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 29 Jan 2012 13:22:48 +0000 (14:22 +0100)]
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>
David Herrmann [Sun, 29 Jan 2012 13:21:19 +0000 (14:21 +0100)]
test_buffer: add utf8 state machine test
Add trivial test to show how to use the utf8 state machine.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 29 Jan 2012 13:19:49 +0000 (14:19 +0100)]
unicode: add utf8 state machine
The state machine is used to convert a stream of UTF8 data into UCS4
characters. It is slightly based on the machine found in the
wayland-compositor demos.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 21:14:20 +0000 (22:14 +0100)]
vte: handle keyboard input (stub)
Make the vte subsystem handle the keyboard input instead of doing this
inside of test_terminal.
The handling is just a stub function. No actual keys are parsed yet.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 17:08:10 +0000 (18:08 +0100)]
console: add header protection
The header was missing a #ifndef to protect against multiple inclusions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 16:43:26 +0000 (17:43 +0100)]
pty: remove unneeded variable in setup_child
We can use "ret" instead of "saved_errno" here.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 16:35:43 +0000 (17:35 +0100)]
pty: move fork_pty_child to setup_child
The name fork_pty_child was misleading. It doesn't fork at all but
instead sets up the child's environment.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 16:23:49 +0000 (17:23 +0100)]
pty: avoid FIONREAD ioctl
This ioctl is really not needed and performs needles kernel context
switches. We can simply read into our buffer without checking how many
data is available.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 16:17:20 +0000 (17:17 +0100)]
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>
David Herrmann [Sat, 28 Jan 2012 16:16:37 +0000 (17:16 +0100)]
Add ring buffer object
The new ring buffer object will be used to buffer a byte-stream between
two sockets.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 13:03:52 +0000 (14:03 +0100)]
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>
David Herrmann [Sat, 28 Jan 2012 12:56:13 +0000 (13:56 +0100)]
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>
David Herrmann [Sat, 28 Jan 2012 12:45:06 +0000 (13:45 +0100)]
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>
David Herrmann [Sat, 28 Jan 2012 12:44:25 +0000 (13:44 +0100)]
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>
David Herrmann [Sat, 28 Jan 2012 12:43:09 +0000 (13:43 +0100)]
pty: fix style issue
Fix small indentation style issue.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 12:22:44 +0000 (13:22 +0100)]
pty: merge fork_pty and pty_spawn
pty_spawn was just a short wrapper so we can merge both into one
function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Mon, 23 Jan 2012 16:16:09 +0000 (18:16 +0200)]
pty: unblock all signals before exec'ing the child
When we register signals in the eloop we also block them in our signal
mask. The signal mask is inherited by the child. Therefore, if the child
does not reset its mask (e.g. bash and most normal processes), it will
not receive any of the signals that we handle. So for example C-c
(SIGINT) does nothing in the child process.
We now unblock all signals before we exec the child.
It's also worth noting that if we _ignore_ a signal -
sigaction(SIG_IGN) - this is also inherited and we must reset it to
default. However, we do not ignore signals so this is unneeded.
Here is some more discussion on signalfd and this problem:
https://lwn.net/Articles/415684/
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 11:38:11 +0000 (12:38 +0100)]
kbd-dumb: fix log_warning -> log_warn
We recently moved log_warning to log_warn and I forgot to fix it when
merging the kbd-dumb backend. Fix this now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Fri, 27 Jan 2012 10:04:51 +0000 (12:04 +0200)]
build: fix out-of-tree build and distcheck
The paths can be off when building out of tree, so have make put them in
for us instead. This requires turning the straight genshader.c file to a
template.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 17 Jan 2012 22:09:16 +0000 (00:09 +0200)]
kbd: add a new "dumb" keyboard backend
This commit adds a very simple keyboard backend which does basic keycode
interpretation. It is used as a fallback when xkbcommon is unavailable
or is not required.
See the file header for what is supported.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 17 Jan 2012 22:03:16 +0000 (00:03 +0200)]
build: depend on xproto explicitly
Currently it's required by xkbcommon. However, we will need it for other
backends as well, even with xkbcommon support disabled.
xproto consisted only of static header files. We use the XK_ keysym
definitions. It is therefore only required during compilation and we
shouldn't needlessly duplicate it ourselves.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sat, 28 Jan 2012 11:14:48 +0000 (12:14 +0100)]
xkb: fix merge failure
Merging the big xkb cleanup reversed the previous modifier state change.
Fix this now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Tue, 24 Jan 2012 14:29:55 +0000 (15:29 +0100)]
log: move log_warning to log_warn
log_warn is much shorter and we already use log_err instead of log_error
so this is more consistent now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Tue, 24 Jan 2012 14:14:15 +0000 (15:14 +0100)]
context: use GL_RGBA when full OpenGL is used
GL_BGRA_EXT as internal format is not supported with full OpenGL so we
must use GL_RGBA as internal format.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Tue, 24 Jan 2012 14:10:16 +0000 (15:10 +0100)]
eloop: remove verbose debug messages
These dispatch debug messages are currently no longer needed and just
fill the log needlessly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 10 Jan 2012 00:52:42 +0000 (02:52 +0200)]
test_terminal: wait on children to avoid zombies
Unfortunately, there is no clean way I see to hook this up from the pty
object. We can (and will) have more than one pty object opened at a
time, but the semantics of signalfd make it impossible to deliver each
SIGCHLD to its rightful owner without complicating things.
[ From what I tested:
- If you have two signalfd's listening to the same signal, they will be
dispatched in some round-robin manner.
- Also, if more than one child exits before we read signalfd (possibly
beloging to different terminals), they will be compressed to one
event. ]
We therefore need to do the reaping from a central location, and need to
remember to copy this snippet over to main.c in the future.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Fri, 13 Jan 2012 10:53:46 +0000 (12:53 +0200)]
terminal: use new pty object
Add a new terminal_open/terminal_close methods to correspond to the pty
ones, and notify when the terminal is closed.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Fri, 13 Jan 2012 10:42:13 +0000 (12:42 +0200)]
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>
Ran Benita [Tue, 17 Jan 2012 22:14:16 +0000 (00:14 +0200)]
test_input: simplify and drop xkbcommon dependency
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 17 Jan 2012 21:57:11 +0000 (23:57 +0200)]
input, xkb: port to new kbd object
This commit ports the XKB handling to the new kbd interface, and makes
the input subsystem use it without any direct knowledge of XKB.
Some code is moved around but there are no functional changes.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 17 Jan 2012 21:12:44 +0000 (23:12 +0200)]
Add skeleton for multiple keyboard handling backends
This defines the API the keyboard backends will need to implement. It is
based on what's in input_xkb.h but cleaned up and simplified.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 22 Jan 2012 21:49:33 +0000 (22:49 +0100)]
font: add debug messages
Add debug messages to freetype font backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 22 Jan 2012 21:44:12 +0000 (22:44 +0100)]
font: rewrite font backend
We now properly draw fonts with OpenGL. We now use FreeType2 instead of
pango to avoid big dependencies.
We also add a DejaVu font so we currently don't have to deal with font
selection.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 22 Jan 2012 21:42:53 +0000 (22:42 +0100)]
math: new helper backend for linear algebra
We use this to perform proper matrix transformations.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 22 Jan 2012 12:51:23 +0000 (13:51 +0100)]
font: require compositor reference
To avoid cairo dependencies we now take a compositor reference in the
font backend so fonts can be drawn with GL textures instead of cairo.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Sun, 22 Jan 2012 12:47:55 +0000 (13:47 +0100)]
font: fix memleak in freetype backend
We didn't unref the symbol table correctly. Fix it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 17:11:03 +0000 (18:11 +0100)]
context: add GLES2 support
OpenGL pulls in lot of X dependencies on linux. To avoid this we also
support OpenGLES2 now. This will also allow to run kmscon on
embedded/mobile platforms.
We still get X dependencies through EGL which we cannot avoid as EGL is
compiled with multiple backends on most systems. However, switching to
GLES2 reduces memory footprint by 30MB which is pretty good.
This also enables GLES2 as default in autogen.sh. However, default
behaviour of configure will still be GL.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 17:07:52 +0000 (18:07 +0100)]
context: use BGRA_EXT texture internally
Some GLES2 implementations do not support RGBA so use BGRA internally,
too.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 16:15:18 +0000 (17:15 +0100)]
context: warn on shader creation error
If we cannot allocate a shader object we should write a message to the
log.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 15:52:58 +0000 (16:52 +0100)]
context: first initialize EGL then find functions
We should first create a GL context before we try to find GL functions
to avoid errors on some platforms.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 15:11:30 +0000 (16:11 +0100)]
context: use GL_TRIANGLES instead of GL_QUADS
GL_QUADS may actually be not supported on some embedded platforms so we
use GL_TRIANGLES.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 15:01:30 +0000 (16:01 +0100)]
context: use GL_BGRA_EXT to avoid undeclared exts
GL_BGRA is not declared on older systems so we use the extension
constant.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 14:58:50 +0000 (15:58 +0100)]
context: fix wrong GL func declaration
I copied the wrong declaration. This fixes this.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
David Herrmann [Fri, 20 Jan 2012 14:52:54 +0000 (15:52 +0100)]
terminal: replace GL functions with new context subs
We should use the context of the compositor instead of directly calling
the GL functions to avoid direct dependencies.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Wed, 18 Jan 2012 16:54:48 +0000 (18:54 +0200)]
xkb: don't fill events purely for modifiers
We have no use for Control_L or Alt_R by themselves, the information is
in the "mods" field.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Ran Benita [Tue, 10 Jan 2012 22:43:01 +0000 (00:43 +0200)]
terminal: also unref the idle object
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>