71 Commits

Author SHA1 Message Date
David Herrmann
47b1aa3bb9 console: remove kmscon_console_set_bg()
This function is no longer needed so we can safely remove it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 15:11:19 +02:00
David Herrmann
002e8fb65e text: move font_char_attr to text.h
This way we can now remove all font.h includes. We can rename the
structure later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:27:19 +02:00
David Herrmann
5517fa16bd Use new text renderer
This fixes the console and terminal layer to use the new text renderer
instead of the old one.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-01 15:41:22 +02:00
David Herrmann
b4bbc2b087 console: add *_console_scroll_up()/_down() helpers
Xterm supports CSIs which simply move the visible buffer up/down so we
need these helpers to perform such operations from the VTE layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:54:58 +02:00
David Herrmann
2cd8cdbea4 console/font: draw bg only if needed
If the background color is identical to the background-color of the glyph
to be drawn, then we can skip drawing the background. This increases
performance a _lot_.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 12:55:50 +02:00
David Herrmann
a7f39f23fe console: implement tab movement
Implement left and right tab movement in console backend. This is used by
the VTE layer to interpret different VT escape sequences and the tabulator
character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:26:11 +02:00
David Herrmann
785137264b vte/console: implement protected erase
Protected erase means erasing parts of the screen but preventing protected
characters from being erase. Protecting a character is done by setting
character attributes similarly to colors and backgrounds. Both are reset
on hard erase, soft-reset or screen clearance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 23:51:56 +02:00
David Herrmann
59e82152d3 console: allow erasing partial lines
Later VTs allow erasing only partial lines so add support for that in the
console backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:58:38 +02:00
David Herrmann
492ac8f72c console/vte: implement ICH DCH
ICH is used to insert characters into the current line. DCH is used to
delete characters from the current line. They act as described in vt220
manual.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 17:33:28 +02:00
David Herrmann
1d87be8c98 console: add tab-stop helpers
Add three helpers to set and reset tab-stops. They will be used by the VTE
layer to add and remove tab-stops when requested by the application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 14:21:43 +02:00
David Herrmann
2a648c54dd console: allow retrieving cursor state
This adds two functions to retrieve x/y positions of the cursor. This can
be used to save and restore cursor positions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 13:36:46 +02:00
David Herrmann
6356dae1da vte/console: implement CSI 'M' (DL: delete line)
The 'M' CSI mode is used to delete lines. This implements this mode
similar to the "INSERT LINES" CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:35:28 +02:00
David Herrmann
ff91998ad8 vte/console: implement CSI mode L (insert line: IL)
The IL CSI ('L') is used to insert a given number of lines at the current
cursor position. All lines below are moved down.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:30:23 +02:00
David Herrmann
b0c19c5c42 console: rewrite console layer
This is a rewrite of the whole console layer so we can remove the
kmscon_buffer object to speed up the console.

This removes the split between the scroll region and the two margins so we
can resize margins in O(1). This also correctly merges the remaining
console modes so vte does not have to track them.

Btw. vim runs smoothly on kmscon with this console layer now (finally!).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-17 15:53:33 +02:00
David Herrmann
cdc7834ba4 vte: allow setting margins
Support changing margin size of the terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:49:39 +02:00
David Herrmann
624d5e0a48 console/vte: draw cursor
If HIDE_CURSOR mode is not set, we draw the cursor at the current
position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 19:02:17 +02:00
David Herrmann
7129a9038c terminal/vte/console: support inverse-screen-mode
In inverse screen mode we switch background and foreground colors. As our
console layer supports transparent backgrounds, we have to do this in the
terminal layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:19:49 +02:00
David Herrmann
2630ee585b console: allow retrieving console flags
This adds a new function that allows external subsystems to retrieve the
current flags of the console.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:19:03 +02:00
David Herrmann
320b838644 vte: implement origin mode
Convert the old relative-addressing mode of the console layer into origin
mode flag.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:00:06 +02:00
David Herrmann
cce9a5df15 console: allow setting/resetting flags
Instead of writing a function for each mode we now accept flags for the
console object. For now the flags are unused but other flags will be
added.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 17:59:37 +02:00
David Herrmann
addaa40562 vte: add auto-wrap support
VT510 manual says auto-wrap is disabled by default but most applications
(including bash) expect it to be on, therefore we enable it by default.

The console layer already supported it but the vte layer wasn't hooked up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 17:07:53 +02:00
David Herrmann
860e7ff509 console: support INSERT mode
When INSERT mode is enabled, we move all following characters to the right
and drop all characters that are moved beyond the margin.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 16:57:04 +02:00
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
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
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
dab18c4eb7 console: remove old font-factory code
Remove the code that is no longer needed due to the new font renderer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 19:31:57 +02:00
David Herrmann
a220fbae1a terminal: use new font backend
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>
2012-04-01 19:25:54 +02:00
David Herrmann
c25a2bb249 console: make buffer code private
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>
2012-04-01 12:50:17 +02: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
cdb3d112a6 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>
2012-02-05 16:02:21 +01:00
David Herrmann
d3951da865 console: add helper to erase current position
This helper erases the current cursor position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:14:45 +01:00
David Herrmann
f0bcc37cee 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>
2012-02-05 14:36:32 +01:00
David Herrmann
f85244ead9 console: add erase-helpers
Add functions to erase several parts of the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 18:31:10 +01:00
David Herrmann
138c0aa5ee 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>
2012-02-04 16:24:01 +01:00
David Herrmann
d8ff83c5cb 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>
2012-02-04 15:50:03 +01:00
David Herrmann
497d3840dc 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>
2012-02-04 15:25:44 +01:00
David Herrmann
2b8caca91c 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>
2012-02-04 14:34:33 +01:00
David Herrmann
0c7e50433a 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>
2012-02-03 23:47:09 +01:00
David Herrmann
b367a9682c 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>
2012-02-03 17:48:35 +01:00
David Herrmann
af3a1f3e50 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>
2012-02-02 17:01:54 +01:00
David Herrmann
09e15d84e8 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>
2012-02-02 16:47:43 +01:00
David Herrmann
3560ae8eb1 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>
2012-02-02 16:43:15 +01:00
David Herrmann
55d4132931 console: add header protection
The header was missing a #ifndef to protect against multiple inclusions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 18:08:10 +01:00
David Herrmann
5a3801386a 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>
2012-01-22 22:44:12 +01:00
David Herrmann
05a1747f00 console: take reference of compositor
To switch to the new drawing subsystem we need a reference to a valid
compositor object so we can retrieve the GL context.
This also applies to the terminal object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-18 18:09:08 +01:00
David Herrmann
c203b3a83d font: move font handling into new subsystem
We use a new font factory which is used to create a new font. It will later also
be used to cache fonts and select proper system fonts.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01 18:27:09 +01:00
David Herrmann
4c236e110b Remove kmscon_char implementation
It was superceded by kmscon_symbol_t and is no longer used.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01 17:45:57 +01:00
David Herrmann
a7128cc683 Adjust all code to use new kmscon_symbol_t
This is a big performance boost and reduces the code size quite a bit.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01 17:43:57 +01:00
David Herrmann
af9ab4197c console: add UCS4 to UTF8 conversion
Allow to create new kmscon_char objects with UCS4 input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-31 17:38:17 +01:00
David Herrmann
676b03cb5c console: add newline function
kmscon_console_newline() can be used to produce a newline. Writing \n doesn't
work as this would write \n as character into the cell and not produce a
newline.
The console does not perform any parsing so we provide a separate function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-26 14:24:31 +01:00