summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal
AgeCommit message (Collapse)Author
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
2015-02-01Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek
If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
2015-01-26build-sys: unbundle unifontZbigniew Jędrzejewski-Szmek
We should prefer the unifont.hex file from the system, instead of our own. Upstream has made a few releases since our version was included, and we should follow upstream changes. But adding 2.6MB to our source repo every time upstream releases is not nice.
2014-12-31Revert commit f131770b "tree-wide: spelling fixes"David Herrmann
This partially reverts: commit f131770b1465fbf423881f16ba85523a05f846fe Author: Veres Lajos <vlajos@gmail.com> Date: Mon Dec 29 09:45:58 2014 +0000 tree-wide: spelling fixes The commit in question changed a binary file. I didn't look at the diff in particular, so I have no idea what exactly was changed. However, the file is generated and it looked highly suspiciuous. Therefore, I reverted that part. Note that this is generated by "make update-unifont" so really no reason to touch at all.
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-22shared: utf8 - support ucs4 -> utf8Tom Gundersen
Originally we only supported ucs2, so move the ucs4 version from libsystemd-terminal to shared and use that everywhere.
2014-12-11tree-wide: use our memset() macros instead of memset() itselfLennart Poettering
2014-12-11treewide: correct spacing near eol in code commentsTorstein Husebø
2014-12-09treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek
loop_write() didn't follow the usual systemd rules and returned status partially in errno and required extensive checks from callers. Some of the callers dealt with this properly, but many did not, treating partial writes as successful. Simplify things by conforming to usual rules.
2014-11-30terminal/screen: fix GL/GR double-mappingDavid Herrmann
We must not call screen_map() multiple times for the same input char. Fix the double-mapping for GL/GR maps are correctly applied.
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal Schmidt
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-27fix build with --enable-terminalThomas Hindoe Paaboel Andersen
Broke with 086891e5c119abb9854237fc32e736fe2d67234c
2014-11-27log: rearrange log function namingLennart Poettering
- Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
2014-11-25terminal/idev: forward xkb-messagesDavid Herrmann
Properly forward all XKB messages. You can use XKB_LOG_VERBOSITY= to control the amount of messages sent by XKB. We explicitly set XKB_LOG_LEVEL to 7 you can use SYSTEMD_LOG_LEVEL to control the log-level generically.
2014-11-25terminal/idev: avoid magic numbersDavid Herrmann
Use XKB_CONTEXT_NO_FLAGS instead of magic 0.
2014-11-24terminal/idev: use compose tablesDavid Herrmann
Before forwarding keyboard events, feed them into possible compose tables. This enables Compose-key and Dead-key features. Few notes: * REPEAT events are never fed into compose tables. It just doesn't make sense and is usually not wanted. Compose-sequences are usually hard to remember and take time to type. Thus, the REPEAT event of the Compose-key itself would often cancel the compose sequence already. * Stop resolving symbols for UP events. Anything but keycodes is never associated to a physical key, but is a one-time action. There is nothing like UP events for key-symbols! * Cancel compose-sequences on Multi-Key UP. See the inline comment. We should make this configurable!
2014-11-24terminal/idev: add compose-file supportDavid Herrmann
Add support for compose files to idev-keyboard. This requires libxkbcommon-0.5.0, which is pretty new, but should be fine. We don't use the compose-files, yet. Further commits will put life into them.
2014-11-04util: introduce negative_errno()David Herrmann
Imagine a constructor like this: int object_new(void **out) { void *my_object; int r; ... r = ioctl(...); if (r < 0) return -errno; ... *out = my_object; return 0; } We have a lot of those in systemd. If you now call those, gcc might inline the call and optimize it. However, gcc cannot know that "errno" is negative if "r" is. Therefore, a caller like this will produce warnings: r = object_new(&obj); if (r < 0) return r; obj->xyz = "foobar"; In case the ioctl in the constructor fails, gcc might assume "errno" is 0 and thus the error-handling is not triggered. Therefore, "obj" is uninitialized, but accessed. Gcc will warn about that. The new negative_errno() helper can be used to mitigate those warnings. The helper is guaranteed to return a negative integer. Furthermore, it spills out runtime warnings if "errno" is non-negative. Instead of returning "-errno", you can use: return negative_errno(); gcc will no longer assume that this can return >=0, thus, it will not warn about it. Use this new helper in libsystemd-terminal to fix some grdev-drm warnings.
2014-10-30util: unify how we see srand()Lennart Poettering
2014-10-16terminal: log unsupported ANSI or DEC mode changesTom Gundersen
2014-10-16terminal: split ANSI from DEC mode changesTom Gundersen
2014-10-11terminal/grdrm: force deep modeset on enterDavid Herrmann
Usually, when our session is activated (or re-configurated) we should be able to try a page-flip to our buffer. The kernel driver should reject it if it is incompatible. As it turns out, drivers don't do this. Therefore, we now force a deep modeset if we're not sure what mode is set. This has the side-effect that we might get glitches on session-switches (depending on driver behavior). However, there's no way around this and it is what everyone does so far. Most drivers still detect if we keep the mode and so don't touch the clocks. Therefore, we just get a regular async flip.
2014-10-05terminal: remove an unused initializationThomas Hindoe Paaboel Andersen
2014-10-05terminal/idev: don't remove consumed-mods from kbd-matchesDavid Herrmann
XKB consumed mods include modifiers that *didn't* affect the translation, but might affect it if used. This is very misleading, given that we are usually not interested in that information. Therefore, keep them in real mods to behave like X11 does. Maybe at some point, XKB introduces proper shortcut matching... Also make evcat display consumed modifiers so we can better debug those situations.
2014-10-05terminal/screen: perform bold->light conversion only on foregroundDavid Herrmann
Bold glyphs always use light colors. However, this color conversion is limited to the foreground color, so skip it for backgrounds.
2014-10-05terminal/subterm: leave bold-light conversion to parentDavid Herrmann
We rely on the parent terminal to do color conversion, so also leave bold->light conversion to the parent. Otherwise, it will be performed twice and we might apply it on the wrong color.
2014-10-05terminal/screen: add support for alternate screen buffersTom Gundersen
Hook up SM/RM 47/1047-1049 and enable alternate screen buffers for term applications. (David: rebased on top of -git, renamed helpers and added docs)
2014-10-05terminal/screen: save state in separate objectDavid Herrmann
Terminal state can be saved/restored by applications. To simplify our internal handling, put all affected state into a separate object. Especially with alternate screen buffers, this will simplify our code significantly.
2014-10-05terminal/subterm: skip setting parent's cursorDavid Herrmann
We draw our own cursor in subterm now, so there's no reason to update the cursor-position of the parent terminal on each frame. The parent's cursor is hidden, anyway.
2014-10-05terminal: fix TERM_FLAG_* commentDavid Herrmann
7BIT mode is enabled by default. Fix the comment to state this correctly.
2014-10-05terminal: fix restoring of screen flagsTom Gundersen
2014-10-03terminal/screen: adjust screen age only on updateDavid Herrmann
Instead of increasing the screen-age on redraw, we now increase it only on real updates. This is effectively the same, but avoids increased age counters on backbuffer rendering. Therefore, we can now check age counters against fronbuffers safely, while rendering frames in background.
2014-10-03terminal/screen: add color converterDavid Herrmann
Terminals use pseudo color-codes mixed with 8bit and 24bit colors. Provide a color-converter so external renderers only have to deal with ARGB32 colors. This requires a color-palette as input as there's no fixed mapping. We provide a default, but maybe we wanna support external palettes in the future.
2014-10-03terminal/screen: add cursor renderingDavid Herrmann
This is the most simple way to render cursors: flip attr->inverse of the cursor cell. This causes the background and foreground colors of the cursor-cell to be inversed. Now that we render cursors ourselves, make subterm not call into the parent terminal to render cursors.
2014-10-03terminal/screen: mark cursor dirty on enabled/disableDavid Herrmann
If we hide or show the cursor, we change visual attributes and have to mark the underlying cell as dirty. Otherwise, the terminal will not be redrawn.
2014-10-03terminal/idev: add helper to match keyboard shortcutsDavid Herrmann
Matching keyboard shortcuts on internationalized keyboards is actually non-trivial. Matching the actual key is easy, but the modifiers can be used by both, the matching and the translation step. Therefore, XKB exports "consumed-modifiers" that we use to figure out whether a modifier was already used by the translation step. The new IDEV_KBDMATCH() helper can be used to match on any keyboard shortcut and it will do the right thing.
2014-10-03terminal/screen: add keyboard mappingDavid Herrmann
Implement the feed_keyboard() handling by mapping XKB keys according to DEC-VT behavior. Public information on terminal key-mappings is pretty scarce. We only implement the most basic mapping for now. Further improvements welcome!
2014-10-03terminal/idev: don't map XKB_KEY_NoSymbol as ASCII 0David Herrmann
XKB_KEY_NoSymbol is defined as 0 but does not correspond to a VT key with ASCII value 0. No such key exists, so don't try to find such a key.
2014-10-03terminal/unifont: add built-in fallback glyphDavid Herrmann
In case we cannot render a glyph, we want a fallback we can display instead. If we rely on the font itself to provide the fallback character, we have nothing to display if that character is not available. Therefore, add a static fallback that we can use at any time.
2014-10-03terminal/subterm: use screen rendererDavid Herrmann
Don't hard-code the screen renderer but use the newly introduced term_screen_draw() helper.
2014-10-03terminal: add screen rendererDavid Herrmann
We don't want to expose the term_screen internals for rendering. Therefore, provide an iterator that allows external renderers to draw terminals.
2014-10-03terminal/drm: clear 'applied' flag when changing stateDavid Herrmann
If a pipe is enabled/disabled, we have to clear crtc->applied of the linked CRTC. Otherwise, we will not run a deep modeset, but leave the crtc in the pre-configured state.
2014-10-03terminal/grdev: allow arbitrary fb-age contextsDavid Herrmann
Instead of limiting fb-aging to 64bit integers, allow any arbitrary context together with a release function to free it once the FB is destroyed.
2014-10-03terminal/grdev: provide front and back buffer to renderersDavid Herrmann
We really want more sophisticated aging than just 64bit integers. So always provide front *and* back buffers to renderers so they can compare arbitrary aging information and decide whether to re-render.