This uses the GCC extension "typeof" to implement a type-safe "offsetof"
similar to the implementation in the linux kernel.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of accepting a list of outputs we now enable all outputs when
testing the video subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new eloop implementation allows to run the eloop for a fixed amount of
time. Use this instead of sleeping for 5s which would prevent us from
catching signals as the eloop blocks them in favor of signalfd.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The test_include.h header now provides the basic initialization that will
later be used in all other tests. This allows us to use the same
program-parameters that kmscon uses and makes sure everything is
initialized properly before we run the tests.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using the slow old font-factory we now use the new font_screen
object which allows faster software rendering with pango/cairo.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
margin_bottom was always the last index of the scroll-region, in contrast
to cells->mbottom_y which is the bottom margin size. However, this cache
is inconvenient so this replaces all calls to margin_bottom with a correct
immediate calculation of the bottom margin.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The fixed_position option allows to explicitely keep the scrollback-buffer
position instead of scrolling on new input. This was already the current
behavior but now we can also scroll on new input if this is set to false.
Also fix up the formatting of the comments and remove old information.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The buffer object is used internally only and should never be shared.
Hence, we can safely remove the refcnt.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The buffer should not be accessed from code outside of console.c so make
it private. This includes some code-moving but no bigger changes. The diff
might look scary, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The old font-renderer was horribly slow. There were several ideas to
speed it up but I decided to add the pango backend again. Pango allows us
to draw combined-characters and all other kinds of special characters. We
would have to rewrite pango if we wouldn't want this dependency so I
currently have no idea why we should make it optional.
However, some people might not care whether they can correctly display all
kind of Unicode text but instead want some shiny kmscon without any
dependencies. Therefore, I will keep the old freetype font-renderer even
though it is not used yet. However, we can convert it at any time.
The new font-renderer is not used yet. We need to cleanup the console
layer first before it can be hooked into the terminal.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We want to move away from glib eventually. Until then, we use a simple
wrapper around the hash-table functions so we need to change a single
place only.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The --seat parameter specifies which seat is used for drm and input
devices. Default is seat0.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
I don't know the reason but negative values don't work here. We simply use
big integers now to avoid clashes with valid getopt() values.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
A symbol table should never be created twice therefore we can make it
static and global. We add locks so it is totally thread-safe, too.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We use a single version number. The current state seems to be pretty
stable and has all the important features regarding the DRM/input setup.
Only missing stuff is VTE and console.
This is no stable release but rather a first development release.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now use the new input/video hooks to avoid waking up the UI all the
time. This reduces the code in the generic UI subsystem and makes the
terminal handle all the stuff.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Allow to send arbitrary signals to the foreground process group of the
pty. Linux supports the TIOCSIG ioctl so we actually do not need to
implement this on our own, yeah!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We shouldn't call the close-cb twice. Therefore, correctly free the FD on
first error, however, keep the signal-callback to get nice log-messages.
Only when the user calls *_close() we eventually stop everything.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently return "ret" when child setup fails, however, we should
rather call exit(). Also avoid cleaning up as this is impossible here
anyway.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We should do fork() as the last operation when starting the child.
Currently, if our eloop-add() fails, we have a started child but return
failure to the caller. Therefore, the child will stay alive but we do not
use it.
We now perform all startup correctly before fork()'ing so we are always
safe when starting the child.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
pthread is already in our vmem due to our dependencies so link to it
explicitly and use pthread_sigmask to avoid buggy sigprocmask in
multi-threaded applications.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Our current signal source has the problem that a single signal event is
only delivered to one random registered source. This is the design of the
signalfd kernel feature. However, for signals like SIGCHLD it is often
desired to have multiple callbacks. Hence, while keeping the old
signal-source, we now also allow a shared signal source. It is registered
the same way as the old signal source but uses a shared hook.
We may remove the old source so we don't use it in the new implementation.
There are still problems when multiple eloops are used in a single
process and you register the same shared-signum in both eloops. However,
such a design is bad anyway, so we don't care.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When deleting a hook we should not search for the callback only. Otherwise
we might remove the wrong callback. Therefore, we now search for callback
and data argument. If multiple callbacks are registered with the same data
and cb, then we don't care which one is removed as this wouldn't make any
difference. They behave the same way, anyway.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
epoll_wait() returns EINTR even if using SA_RESTART for signals.
Therefore, catch EINTR and set count to zero.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We assigned stack-storage to a global pointer and therefore we got
seg-faults when using the default. Fix that.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Allow to specify a separate login-program that is executed instead of the
default. All arguments specified after --login are considered argv[] of
the new process and not parsed by the library.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>