313 Commits

Author SHA1 Message Date
David Herrmann
56f5eebf0e hook: delete by callback *and* data argument
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>
2012-03-25 17:08:00 +02:00
David Herrmann
ac9df3aac5 eloop: catch EINTR in epoll_wait()
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>
2012-03-25 16:45:39 +02:00
David Herrmann
c0030f47c2 conf: fix local storage of default argv
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>
2012-03-25 16:22:27 +02:00
David Herrmann
b1cb8c918c pty: use reentrant ptsname_r
Avoid static storage in pty subsystem and use the ptsname_r extension.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-25 16:18:03 +02:00
David Herrmann
8773331331 pty: introduce --term
Allow setting TERM to different values than the default with a
command-line switch.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 18:15:50 +01:00
David Herrmann
ec2dfaa244 pty: add --login option
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>
2012-03-24 18:10:55 +01:00
David Herrmann
d98dba57d3 pty: fix log statements
Remove new-lines and add LOG_SUBSYSTEM.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 17:44:42 +01:00
David Herrmann
4b9bc46226 Fix some signed/unsigned warnings
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 17:04:42 +01:00
David Herrmann
813e5655e0 main: wait for child processes
Add SIGCHLD handler and wait for exiting child processes to avoid zombies.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 16:44:33 +01:00
David Herrmann
54973fb341 uterm_video: set displays after waking up
Set CRTC state correctly after waking up. Otherwise the displays will keep
their previous state until the next redraw.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 16:02:30 +01:00
David Herrmann
ec6e095a64 uterm_video: check online-state before swapping
Check whether the display is online before swapping buffers in DRM
backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 16:01:13 +01:00
David Herrmann
ead3172d49 main: use ui subsystem
Use the new UI subsystem in the main application. The kmscon application
provides now the same functionality as the test_terminal application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:44:36 +01:00
David Herrmann
e6d3d3f5b1 ui: add user interface subsystem
The UI subsystem starts the terminals, switches between them and draws the
screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:44:06 +01:00
David Herrmann
fded606baa input: change callback logic
Allow multiple callbacks and notify all about new input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:22:23 +01:00
David Herrmann
e6db44385b uterm_video: add callback
Allow applications to register callback and notify them about new or gone
displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:21:57 +01:00
David Herrmann
c04c807eca misc: add hook structure
The hook structure can be used to provide a central hook where other
subsystems can register callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:12:37 +01:00
David Herrmann
a13797ac76 uterm_video: fix drm debug messages
Print more verbose messages on DRM errors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 14:15:53 +01:00
David Herrmann
00c34e1685 kbd_*: fix log messages
Remove new-lines again and set subsystem automatically.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:54:27 +01:00
David Herrmann
84f1883809 xkb: use new API
libxkbcommon-git did some API changes

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:42:16 +01:00
David Herrmann
6072a4ea53 test_terminal: parse command line arguments
Parse command line arguments so the input subsystem recognizes the XKB
values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:41:30 +01:00
David Herrmann
75339df698 input: fix kmscon_input_device_wakeup protection
We cannot check for dev->fd as the fd is only set when the input device
has keys. Therefore check for rfd now.
Also remove the NULL check in *_sleep() as it is not needed. All public
APIs allow passing NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:20:52 +01:00
David Herrmann
18d829bd39 input: remove refcnt in input-devices
Input-devices are used internally only so we do not need refcounts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:20:01 +01:00
David Herrmann
9f695c042f input: fix log-messages
Remove newline from log-messages and set LOG_SUBSYSTEM to "input". Also
fix some small indentation issues.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:19:02 +01:00
David Herrmann
f8dc74c297 conf: add --xkb-XY options
Allow setting XKB options on the command line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 13:02:48 +01:00
David Herrmann
4c2ff06f31 input: do not wake up if we are not asleep
Check for state == INPUT_AWAKE before performing wakeup.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 12:29:01 +01:00
David Herrmann
e35ca87a95 conf: add --silent
Suppress debug, info, notice and warning messages if --silent is given.
This is overwritten by --debug and --verbose.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:38:24 +01:00
David Herrmann
929860217f main: print strerror() on failure
Print error-string if we cannot initialize kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:33:08 +01:00
David Herrmann
8e54ea1f65 main: add proper main application
This is not finished and only implements the basic VT handling +
application initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:29:21 +01:00
David Herrmann
83980a7547 vt: fix log messages
Add new improved log messages to the VT subsystem.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:29:01 +01:00
David Herrmann
83dc28fcc7 Fix time calculations
eloop.c and log.c use struct timeval to calculate time-diffs but
incorrectly use "-" instead of "+" as the value is already negative.
They also use unsigned integers so fix both occurences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:27:29 +01:00
David Herrmann
5a865fc39b build: add conf.c to build
conf.c was recently added so add it to the build-script now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 18:26:50 +01:00
David Herrmann
5f1f1710f9 eloop: correctly set ->exit
When exiting a child eloop we should forward the exit to the parent. Also,
we should reset ->exit on ev_eloop_run() otherwise we cannot run multiple
times.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:58:19 +01:00
David Herrmann
42631efa2c eloop: add debug messages
Add two debug messages to track eloop behavior.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:57:53 +01:00
David Herrmann
6d63b55d6f conf: add --switchvt
--switchvt enables kmscon to automatically switch to the new VT that was
opened by kmscon. If this is the current VT, then this has obviously no
effect.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:42:39 +01:00
David Herrmann
c8b247785c conf: fix --help handling
Handle --help same way as -h.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:41:52 +01:00
David Herrmann
a4bd71cd0c conf: remove unneeded global initialization
Global variables are initialized to 0 automatically. So remove the
initialization.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:40:56 +01:00
David Herrmann
205ab68ff9 eloop: add ev_eloop_run() function
ev_eloop_run() runs the eloop for a given fixed time. If the dispatcher
returns and the timeout isn't reached, then the dispatcher is called
again.
This also adds the *_exit() function which allows to exit the main-loop
and can be called from anywhere (including the callbacks).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:32:45 +01:00
David Herrmann
14b0035f50 eloop: several fixes
Fix parameter validation, fix log_* statements, fix indentation and print
messages on HUP/ERR.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 17:13:01 +01:00
David Herrmann
563492a0c8 eloop: remove fd from epoll-set on HUP
If a handler does not correctly remove itself on HUP, the epoll-loop will
never sleep again because the fd will always be notified as HUP.
Therefore, remove the fd from the epoll-set directly on HUP. This doesn't
change application behavior so it is safe here.

This also allows other subsystems to ignore HUP/ERR events if they are not
fatal. The FD won't be readded but that may not bother.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:59:42 +01:00
David Herrmann
56659ce429 eloop: remove ev_eloop_get_fd()
This function was never used so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:46:22 +01:00
David Herrmann
cfca84f250 vt: fix callback enum type
We should use the enum type instead of plain "int" to be more verbose
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:42:04 +01:00
David Herrmann
d19f7ec2f1 conf: add configuration subsystem
The conf-subsystem is used throughout the whole source and provides a
global static read-only configuration. The configuration is read on
startup from the command-line and filesystem and then provided to the
other subsystems.

This is no database, that is, the data is not written to a file on
shutdown!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:13:50 +01:00
David Herrmann
be8fe301f9 eloop: allow an eloop to be an event source
This allows to add one eloop object into another eloop. This is useful if
we want to run a single event source isolated (for instance VT on exit).

The internal epoll-descriptor allows polling so this is a fairly
straightforward implementation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 16:10:53 +01:00
David Herrmann
af31f251f3 console: merge console_cell.c into console.c
We currently have too much layers in the console subsystem. This reduces
performance and produces ugly hacks like our "*_clear_region" function. We
now merge both files so we can directly access the buffer-structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:34:55 +01:00
David Herrmann
650c7077f1 Remove old output subsystem
This subsystem is no longer used so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:29:25 +01:00
David Herrmann
096f0cadc7 Move to new uterm infrastructure
This fixes all compositor/output/context/etc. uses and replaces them by
the new uterm API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:18:50 +01:00
David Herrmann
911d635e6e gl: add viewport helper
This helper correctly sets the viewport to the size of a screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:18:28 +01:00
David Herrmann
1dd7198216 test_output: use new uterm/log/etc. subsystems
Convert the test_output test to use the new subsystems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:35:02 +01:00
David Herrmann
a8562c7a5c uterm_video: add *_screen_height/width() helpers
A screen may have a different size than the displays so add these two
hooks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:34:20 +01:00
David Herrmann
564d42fde9 build: define LOG_ENABLE_DEBUG if debugging
Define LOG_ENABLE_DEBUG if we enabled debugging. The log subsystem uses
this to enable the log_debug() statements.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 13:30:36 +01:00