summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'xkbcommon-0.3.0' into baserock/genivi/baselinebaserock/genivi/baselinePedro Alvarez2014-04-0273-4288/+6316
|\ | | | | | | Bug fixes and minor API tweaks.
| * Bump version to 0.3.0xkbcommon-0.3.0Daniel Stone2013-04-011-1/+1
| | | | | | | | Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * keymap: add xkb_keymap_new_from_buffer()David Herrmann2013-04-0111-0/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current API doesn't allow the caller to create keymaps from mmap()'ed files. The problem is, xkb_keymap_new_from_string() requires a terminating 0 byte. However, there is no way to guarantee that when using mmap() so a user currently has to copy the whole file just to get the terminating zero byte (assuming they cannot use xkb_keymap_new_from_file()). This adds a new entry xkb_keymap_new_from_buffer() which takes a memory location and the buffer size in bytes. Internally, we depend on yy_scan_{string,byte}() helpers. According to flex documentation these already copy the input string because they are wrappers around yy_scan_buffer(). yy_scan_buffer() on the other hand has some insane requirements. The buffer must be writeable and the last two bytes must be ASCII-NUL. But the buffer may contain other 0 bytes just fine. Because we don't want these constraints in our public API, xkb_keymap_new_from_buffer() needs to create a copy of the input memory. But it then calls yy_scan_buffer() directly. Hence, we have the same number of buffer-copies as with *_from_string() but without the terminating 0 requirement. The explicit yy_scan_buffer() call is preferred over yy_scan_byte() so the buffer-copy operation is not hidden somewhere in flex. Maybe some day we no longer depend on flex and can have a zero-copy API. A user could mmap() a file and it would get parsed right from this buffer. But until then, we shouldn't expose this limitation in the API but instead provide an API that some day can work with zero-copy. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> [ran: rebased on top of my branch] Conflicts: Makefile.am src/xkbcomp/xkbcomp.c
| * xkbcomp/keymap: silence a gcc warningRan Benita2013-04-011-1/+1
| | | | | | | | | | | | | | | | src/xkbcomp/keymap.c:127:12: error: 'found' may be used uninitialized in this function [-Werror=maybe-uninitialized] Not really, but why not. Signed-off-by: Ran Benita <ran234@gmail.com>
| * Add key-sequence checking to rulescompDaniel Stone2013-04-012-62/+139
| | | | | | | | | | | | | | Make sure we're actually getting the keymaps we're hoping to compile. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Add va_list variant of test_key_seqDaniel Stone2013-03-192-6/+17
| | | | | | | | | | | | For use when chaining tests. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * Allow NULL rmlvo for xkb_keymap_new_from_namesDaniel Stone2013-03-192-7/+13
| | | | | | | | | | | | | | Previously we allowed you to pass a names struct with five NULL members, but not just pass NULL for the struct itself. This was pretty dumb. :( Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Add environment checking to rulescompDaniel Stone2013-03-191-3/+45
| | | | | | | | | | | | To ensure that overriding RMLVO from the environment works. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Suppress RMLVO environment inheritance by defaultDaniel Stone2013-03-192-1/+16
| | | | | | | | | | | | But add a flag to allow it for later usage. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * Add environment overrides for default RMLVODaniel Stone2013-03-196-13/+126
| | | | | | | | | | | | | | You can now set default values in the environment, as well as a context option to ignore the environment, e.g. for tests. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Use test_get_context() in log.cDaniel Stone2013-03-191-1/+1
| | | | | | | | | | | | Since the only behavioural change is overriding default includes. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Add flags argument to test_get_context()Daniel Stone2013-03-1913-13/+17
| | | | | | | | | | | | Allowing overriding of environment suppression, at first. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * test: Move test_key_seq to common.cDaniel Stone2013-03-193-104/+109
| | | | | | | | Signed-off-by: Daniel Stone <daniel@fooishbar.org>
| * rules: be more paranoid in scannerRan Benita2013-03-181-16/+9
| | | | | | | | | | | | | | This can't happen, but better safe than sorry. The optimizations were noticeable but negligible. Signed-off-by: Ran Benita <ran234@gmail.com>
| * rules: quiet a gcc warningRan Benita2013-03-181-0/+1
| | | | | | | | | | | | | | | | src/xkbcomp/rules.c:620:36: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized] Can't happen but no harm done. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keyseq: add a couple of testsRan Benita2013-03-181-0/+29
| | | | | | | | | | | | Tests the filter refcounting. Signed-off-by: Ran Benita <ran234@gmail.com>
| * state: use stdbool in filtersRan Benita2013-03-181-32/+32
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * doc: use README as doxygen main page overviewRan Benita2013-03-182-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The doxygen page looked a bit dead, the README fills it nicely, and is already written in the markdown format which doxygen uses (I think?). Unfortunately the USE_MDFILE_AS_MAINPAGE doxygen config doesn't seem to do anything.. So we just add a {#mainpage} tag at the top of the README which isn't so bad. BUT we still need some config option (the no_extension=md part) so that doxygen will accept README instead of README.md or somesuch. And that requires an even newer release, 1.8.3.1, released 2013-01. But if an older version is used, it doesn't spew out warnings but just skips the README, which is fine. Signed-off-by: Ran Benita <ran234@gmail.com>
| * doc: update Doxyfile template to one from newer versionRan Benita2013-03-181-28/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to use the USE_MDFILE_AS_MAINPAGE option which was introduced in doxygen 1.8.3 (released 2012-12). Right now the new options are commented, otherwise older doxygen spews these these warnings, which can be ignored: warning: ignoring unsupported tag `USE_MDFILE_AS_MAINPAGE =' at line 794, file doc/Doxyfile warning: ignoring unsupported tag `MATHJAX_FORMAT =' at line 1210, file doc/Doxyfile warning: ignoring unsupported tag `EXTERNAL_SEARCH =' at line 1257, file doc/Doxyfile warning: ignoring unsupported tag `SEARCHENGINE_URL =' at line 1265, file doc/Doxyfile warning: ignoring unsupported tag `SEARCHDATA_FILE =' at line 1271, file doc/Doxyfile warning: ignoring unsupported tag `EXTERNAL_SEARCH_ID =' at line 1278, file doc/Doxyfile warning: ignoring unsupported tag `EXTRA_SEARCH_MAPPINGS =' at line 1287, file doc/Doxyfile Signed-off-by: Ran Benita <ran234@gmail.com>
| * doc: some improvementsRan Benita2013-03-181-38/+50
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * keymap: rename xkb_kt_map_entry to xkb_key_type_entryRan Benita2013-03-186-25/+25
| | | | | | | | | | | | | | That's a better name and fits more nicely. Also change type->map to type->entries. Signed-off-by: Ran Benita <ran234@gmail.com>
| * Fix pointer style nitRan Benita2013-03-184-4/+4
| | | | | | | | | | | | (I really dislike this one for some reason..) Signed-off-by: Ran Benita <ran234@gmail.com>
| * Remove file_id entirelyRan Benita2013-03-184-14/+0
| | | | | | | | | | | | It is not used anymore. Signed-off-by: Ran Benita <ran234@gmail.com>
| * symbols: remove file_idRan Benita2013-03-181-26/+18
| | | | | | | | | | | | See previous commits. Signed-off-by: Ran Benita <ran234@gmail.com>
| * compat: remove file_idRan Benita2013-03-181-32/+16
| | | | | | | | | | | | See previous commit. Signed-off-by: Ran Benita <ran234@gmail.com>
| * types: remove file_idRan Benita2013-03-181-17/+10
| | | | | | | | | | | | See previous commit. Signed-off-by: Ran Benita <ran234@gmail.com>
| * types: put all copy-to-keymap code in one functionRan Benita2013-03-181-32/+31
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: remove KeyNamesInfo::mergeRan Benita2013-03-181-3/+1
| | | | | | | | | | | | Not used. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: unwrap KeyNameInfoRan Benita2013-03-181-32/+24
| | | | | | | | | | | | We don't need the struct any more, it only contains one field now. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: remove file_idRan Benita2013-03-181-27/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file_id thing is used to identify the XkbFile some statement originally came from. This is needed to avoid spurious warnings; for example, if you write the same alias twice in a file, that's redundant, and you'd want a warning about it. However if intentionally override it from another file, that's fine, and you shouldn't get a warning. So by comparing the file_id's the needed log verbosity is changed. However, the file_id mechanism is really not needed, because we already have that info! Each KeyNamesInfo corresponds to one XkbFile, so if the conflict occurred while handling that one file -> same_file = true, and if it occurs while merging two Info's -> same_file = false. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keymap: don't use darray for key aliasesRan Benita2013-03-184-58/+56
| | | | | | | | | | | | | | With a little tweak to the copy-to-keymap routine in keycodes.c we can use a normal array. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: don't do unnecessary copies while mergingRan Benita2013-03-181-49/+52
| | | | | | | | | | | | | | | | If 'into' in empty we can just steal 'from'. Also move the alias-merging into the big function, it's nicer this way. Signed-off-by: Ran Benita <ran234@gmail.com>
| * state: small style fixRan Benita2013-03-181-11/+13
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * Move a couple of general keymap functions from keycodes.cRan Benita2013-03-187-87/+47
| | | | | | | | | | | | | | To get a key by name and resolve an alias - this makes sense for everyone. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: remove unneeded alias conflict checkRan Benita2013-03-181-67/+35
| | | | | | | | | | | | | | | | | | | | | | This is already checked when adding a new alias and merging aliases, so it can never happen when we get to copying to the keymap. Also the log verbosity decision there is quite useless, we should just warn always and be done with it. So we can remove the file_id from AliasInfo, and collapse the alias functions together. Signed-off-by: Ran Benita <ran234@gmail.com>
| * xkbcomp: handle XKB file include's betterRan Benita2013-03-186-117/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'merge_mode' situation is quite messy, and we've introduced a regression compared to original xkbcomp: when handling a composite include statement, such as replace "foo(bar)+baz(bla)|doo:dee" and merging the entire resulting *Info back into the including *Info, we actually use the merge mode that is set by the last part (here it is "augment" because of the '|'), when we should be using the one set for the whole statement (here "replace"). We also take the opportunity to clean up a bit. Signed-off-by: Ran Benita <ran234@gmail.com>
| * Build cleanly with clangRan Benita2013-03-183-8/+1
| | | | | | | | | | | | | | clang doesn't like the use of typeof with out default flags, so just don't use it. Signed-off-by: Ran Benita <ran234@gmail.com>
| * Don't try to build linux-specific tests on non-linuxRan Benita2013-03-183-7/+18
| | | | | | | | | | | | | | | | | | Some tests use linux/input.h (and epoll), but we're building on some other kernels (e.g. debian freebsd). We could just copy the file but it's GPL. We could also skip the tests (exit code 77) but it doesn't really matter. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keymap: abstract a bit over the keymap formatRan Benita2013-03-1810-121/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it a bit easier to experiment with other formats. Add a struct xkb_keymap_format_operations, which currently contains the keymap compilation and _get_as_string functions. Each format can implement whatever it wants from these. The current public entry points become wrappers which do some error reporting, allocation etc., and calling to the specific format. The wrappers are all moved to src/keymap.c, so there are no XKB_EXPORT's under src/xkbcomp/ anymore. The only format available now is normal text_v1. This is all not very KISS, and adds some indirection, but it is helpful and somewhat cleaner. Signed-off-by: Ran Benita <ran234@gmail.com>
| * text: some style changesRan Benita2013-03-181-57/+53
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * text: clean up and fix the *MaskText functionsRan Benita2013-03-184-77/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The snprintf trick that LedStateText and ControlMaskText do cannot work, because you can't use the buffer as an argument to write to itself! (posix at least has 'restrict' there). So those two actually never worked for more than one value (i.e. with a +). Fix that, and do the same cleanup to ModMaskText. Now we have 3 functions which look exactly the same, oh well. Also increase the context text buffer size, you never know. Signed-off-by: Ran Benita <ran234@gmail.com>
| * More spelling errorsRan Benita2013-03-185-16/+16
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * test/rmlvo-to-kccgst: free memory before exitRan Benita2013-03-181-0/+6
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * parser: also skip 'section' ELEMENTRan Benita2013-03-181-1/+1
| | | | | | | | | | | | It's for geometry only. Signed-off-by: Ran Benita <ran234@gmail.com>
| * ast-build: remove malloc_or_dieRan Benita2013-03-181-82/+93
| | | | | | | | | | | | This should be fixed properly. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keycodes: fix spelling in error messageRan Benita2013-03-181-1/+1
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * Remove list.hRan Benita2013-03-182-490/+0
| | | | | | | | | | | | We don't use it anymore and it's easy to add back if needed. Signed-off-by: Ran Benita <ran234@gmail.com>
| * Makefile.am: don't create INSTALL and ChangeLogRan Benita2013-03-182-13/+1
| | | | | | | | | | | | | | It may be xorg standard but it's completely useless and clutter the directory. Signed-off-by: Ran Benita <ran234@gmail.com>
| * keymap-dump: move writing 'key {}' in symbols to its own functionRan Benita2013-03-181-100/+107
| | | | | | | | Signed-off-by: Ran Benita <ran234@gmail.com>
| * keymap-dump: remove some ugly empty linesRan Benita2013-03-182-9/+6
| | | | | | | | | | | | | | xkbcomp prints them too, but that's just annoying. Also xkb_keycodes doesn't have it already. Signed-off-by: Ran Benita <ran234@gmail.com>