459 Commits

Author SHA1 Message Date
David Herrmann
75d981b7be console: add kmscon_console_reset() dummy
This dummy is supposed to hard-reset the console. As the console is far
from finished, we keep it as dummy and implement this later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 11:39:07 +02:00
David Herrmann
277edee2dc unicode: introduce kmscon_utf8_mach_reset()
Sometimes we need to reset the UTF8 state-machine, for instance when
resetting the VTE. This function simply resets the internal state to
KMSCON_UTF8_START so we start all over on the next input character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 11:13:49 +02:00
David Herrmann
f6a39baf39 build: define KMSCON_ENABLE_DEBUG on --enable-debug
We build several internal libraries and to keep the namespaces apart we
also need different debug constants. Therefore, introduce the new
KMSCON_ENABLE_DEBUG constant which is for every debug object in base
kmscon code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 11:12:21 +02:00
David Herrmann
771e08de07 vte: add special character sets
Since vt100 (and extended with vt220) you can load different character
sets into GL and GR. As we use UTF-8 as base encoding, we actually do not
need them but have to support it for backwards compatibility. For further
information, see the comments in vte_charsets.c.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 10:27:46 +02:00
David Herrmann
6b5fb5613d vte: implement DECSCL 'p' CSI
DECSCL is used to select compatibility modes. We do not support the VT100
compatibility mode explicitely or the VT220 mode, however, we always send
7-bit control characters and support escape sequences from both series so
we can safely ignore DECSCL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 18:10:59 +02:00
David Herrmann
4b656aaa11 vte: implement NEL
NEL is a shortcut for newline independent of the line-feed/new-line mode.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:58:46 +02:00
David Herrmann
1d6eb0dd72 vte: implement IND and RI
IND and RI both either move one row up or down and perform scroll up/down
if required.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:56:44 +02:00
David Herrmann
2e6bac3e67 vte: explicitely ignore DEL
Add dummy to do_execute() which explicitely ignores the DEL input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:51:51 +02:00
David Herrmann
b1e5d75220 vte: show reversed question mark on SUB
When receiving SUB we now correctly write a reversed question mark into
the buffer. We still cancel the ongoing escape sequence, this worked even
without this patch.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:47:51 +02:00
David Herrmann
6b4fc364df vte: remove kmscon_console_backspace()
This function is not needed at all. Instead, we should simply move one
character to the left on incoming backspace. There is no need to handle
auto-wrap on backspace.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 16:49:56 +02:00
David Herrmann
cd553c54ad vte: answer with ACK to an ENQ enquiry
Other emulators might ignore this. However, the easiest way to answer to
an enquiry is probably ACK.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 16:48:08 +02:00
David Herrmann
9aa76272e9 vte: use callback for outgoing messages
VTE now requires a new callback that is called when we want to send
messages to the pty etc. This is needed if we want to send messages as
responses to incoming data. Otherwise, we would have way too much overhead
assembling composed messages.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 16:38:56 +02:00
David Herrmann
c2515b2ae7 vte: add ctrl+0-9 shortcuts
The VT220 defines some additional shortcuts to send escape codes with
ctrl+<num>. Implement these as aliases to the same well-defined shortcuts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:39:25 +02:00
David Herrmann
1647c5fc32 vte: handle F1-F20 correctly
F1-F4 are mapped to the keypad keys as these keys were not available on
VT220. F5 is special mapped and F6-F20 correspond to the same keys on the
keyboards for VT220.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:30:17 +02:00
David Herrmann
d6c50d9b8f vte: handle KeyPad/NumPad keys
This adds handlers for all the special keys on numpads/keypads.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:18:45 +02:00
David Herrmann
0986989ce7 vte: add line-feed/new-line mode
In line-feed/new-line mode the NL/.. codes generate a CR *and* a NL.
Otherwise, they only generate CRs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:12:10 +02:00
David Herrmann
a3d5eef70e vte: implement cursor keys
In cursor-key-mode reset we send the normal CSI sequences, again encoded
with C0 codes as C1 codes are nonsense in UTF8. In cursor-key-mode set we
use the SS3 codes instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 14:12:30 +02:00
David Herrmann
8157556602 vte: implement editing keys
Implement the basic editing keys that are used by several applications. We
use the 7bit CSI sequence to avoid UTF8 issues. Otherwise, we would have
to encode the C1 CSI 0x9b as UTF8 character which is also a 2 byte
sequence.

Besides INSERT, DELETE, PAGEUP and PAGEDOWN an VT220 also had SELECT and
FIND keys which we do not implement as they are not present on modern
keyboards.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 14:01:22 +02:00
David Herrmann
2396423d03 vte/font/console: support basic character attributes
This adds support for colored and bold characters. This also adds the
infrastrucure for background colors and underlined characters, however,
these are not properly implemented, yet.

The color codes are similar to xterm and optimized on black backgrounds.
So they are not too bright or shiny.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 12:37:12 +02:00
David Herrmann
47d7cf085c vte: send correct escape characters on ctrl+KEY input
This adds support for the ctrl+KEY inputs to send escape sequences to the
child process.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 16:45:27 +02:00
David Herrmann
9c7e0159aa uterm_input: introduce UTERM_INPUT_HAS_MODS()
This is a convenient macro to check whether a given set of modifiers is
enabled on the given input event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 16:43:26 +02:00
David Herrmann
51bfe9d107 test_input: always print keysym
Print keysym even if we have a UCS4 representation. This makes debugging
keyboard issues much easier. Also increase buffer size to 32 as there are
many symbols longer than 16 characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 16:41:19 +02:00
David Herrmann
ff7c065692 vte: print debug message on unknown CSI parameters
Print a debug message if the CSI-K/J parameters are unknown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 15:21:32 +02:00
David Herrmann
2c5712685b vte: remove kmscon_vte_bind()
Bind the console at vte creation instead of dynamically during runtime.
There is no need to rebind a console so remove this complexity.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 14:47:11 +02:00
David Herrmann
a1b2202ccf main: start ui on each seat
We now have a video device for each seat so we only need to launch the UI
when the video device is registered.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 12:08:49 +02:00
David Herrmann
415417c97c uterm_input: fix increasing refcnt
We need to correctly increase the refcnt. We currently increase it only
when it was 0 before due to a very subtle bug as we missed the "return".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 12:04:48 +02:00
Ran Benita
6c8877e0a2 xkb: add a TODO note to kbd_dev_reset stub
This is a small regression whereby starting kmscon with e.g. Caps Lock
already on, will not be reflected in the modifier mask. It's not
currently possible with xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 10:46:25 +02:00
Ran Benita
698d0fb95a xkb: produce key events
Use the new API in kbd_dev_process_key.
This introduces a regression whereby repeating key events are sent for
modifier keys. This is a currently a limitation in xkbcommon.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 10:45:54 +02:00
Ran Benita
c6ccc9b842 xkb: initialize the xkb objects
The new xkb types correspond quite closely to our own types, which now
become thin wrappers.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 10:42:54 +02:00
Ran Benita
7493bce2f5 xkb: remove old xkb code and add stubs
The libxkbcommon API as been revamped completely, making all of the
current code redundant and non-working. This commit removes all of the
old xkb_desc handling before using the new API.

After this commit, kmscon will no longer link to against the old
lixkbcommon; please update to a new package or compile from the
"master" branch from:
git://anongit.freedesktop.org/xorg/lib/libxkbcommon

[ This commit also adds a missing kbd_desc_new, which was declared but
not copied over from the old files. ]

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 10:39:40 +02:00
David Herrmann
4f0defca3f input: remove old input subsystem
We are no longer using the old subsystem, so remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:58:53 +02:00
David Herrmann
199f4cbfa8 Replace old input subsystem with new uterm input
Use the new subsystem now throughout the whole code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:57:08 +02:00
Ran Benita
06885d2dd6 kbd: remove "dev" from kbd_dev_keysym_to_string
Both dumb and xkb don't actually need the kbd_dev for that. The dumb
backend already omits the "dev".

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:49:06 +02:00
Ran Benita
de078499d2 monitor: fix small memory leak
The members of the array returned from get_all_seats are strdup'd as
well.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:47:47 +02:00
David Herrmann
8af8f47143 main: remove old session code
We now run a session on each registered seat so we no longer need the old
session code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:39:25 +02:00
David Herrmann
7107550fd4 main: allocate one VT per seat
Each session needs a virtual terminal where it operates. Therefore,
allocate one VT per seat so we can react on events on that seat.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:34:46 +02:00
David Herrmann
4a20135a7c vt: fix calling wrong callbacks
If we allocate multiple VTs in a single process, then we share the same
signals which are used to acknowledge VT switches. Instead of blindly
calling the user-callbacks, we need to check first which VT is currently
active to forward the signal only if we are the active VT.
Otherwise, all VTs we allocate share a single logical VT.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:30:38 +02:00
David Herrmann
625ae94daa main: poll video devices on hotplug
When the monitor notifies us about an hoptplug event, then we need to poll
the current video device. Otherwise, we might miss hotplugged monitors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:47:23 +02:00
David Herrmann
3ac89ed33f main: add input device to each seat
Each seat now collects all input devices that are associated to that seat.
When multi-session support is added, then we can even share them between
the sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:44:36 +02:00
David Herrmann
42de147268 main: collect one DRM device per seat
We need a single graphics card on a seat to run kmscon. Therefore, wait
for the first DRM device that appears and make it the current graphics
device for the seat. We do not support multiple graphics cards per seat
but this may be added in the future.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:38:23 +02:00
David Herrmann
589b5ce9e3 main: create vt master object
When running multiple sessions on multiple seats, we need to allocate
multiple VTs, too. Therefore, we now create a VT master connection in the
main application which we can later use to allocate new VTs for each
session.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:16:23 +02:00
David Herrmann
477542b2ba main: listen for new seats
Allocate new seat objects when a new seat occurs and remove them when a
seat goes away.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:14:20 +02:00
David Herrmann
4c85801975 main: use uterm_monitor objects
Create a global uterm_monitor object to monitor the system for new seats
and devices.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 13:02:05 +02:00
David Herrmann
c8ab4a2c49 uterm_vt: fix correctly passing vt data to callbacks
When emulating the VT layer we need to pass our own data to the internal
callbacks. We currently pass the user data which is really useless here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 07:33:34 +02:00
David Herrmann
14ab49d985 test_vt: use new uterm vt master
Use uterm vt master to allocate an VT on seat0 for testing purposes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 07:24:47 +02:00
David Herrmann
233eb5c510 uterm: add VT API
The uterm VT API is designed to support new user-space implementations of
vt-master APIs. If we are on seat0 and CONFIG_VT is enabled, we use the
kernel VT API. In all other cases we currently simply fall back to a
non-op but will implement in the future dbus based APIs or similar to
support VT switching, that is multi-session, on all seats.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-25 09:45:20 +02:00
David Herrmann
68c6f68993 vt: add kmscon_vt_supported() function
If the kernel has CONFIG_VT disabled we should avoid opening VTs and
instead rely on other mechanisms for virtual terminals.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-24 19:14:51 +02:00
David Herrmann
d3257fca31 eloop: fix eloop object never being freed
We must _never_ take a reference to ourself in a constructor. Otherwise,
the refcnt will be >1 which means if the user calls *_unref() the object
will not get freed.
Therefore, do not add the counter object used for idle sources directly to
the event loop. Instead, add it when the first idle source is registered
and remove it when the last source is removed. This will slightly slow
down performance of idle-sources. However, the whole eloop is not
optimized for speed, yet, so we don't care for now.

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-20 22:54:08 +02:00
David Herrmann
00ff46b701 eloop: add initial gtk-doc comments
Add gtk-doc compatible comments to most of the functions in eloop.c.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-19 17:58:08 +02:00
David Herrmann
0b8da0ce50 eloop: dynamically reallocate dispatch cache
We do not maintain event caches so we must make sure that every event
source gets dispatched. If we call epoll_wait() and our buffer gets
filled everytime, then there might be an event source that does not get
dispatched because it is always above the buffer range. Therefore, we now
dynamically increase the cache size when it once gets filled up.

This gets critical if we handle thousands of clients or fds, however, our
use case is limited to some system resources and hence does not suffer
here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-19 13:47:55 +02:00