summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* wip: context: add /etc/X11/xkb to default include pathbug-74422Ran Benita2014-02-101-0/+2
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* rules: add include statementRan Benita2014-02-1012-11/+160
| | | | | | | | | | This allows a user to extend an existing rules file, or to break a large file to more manageable pieces. Needed for: https://bugs.freedesktop.org/show_bug.cgi?id=74422 Signed-off-by: Ran Benita <ran234@gmail.com>
* include: let FindFileInXkbPath take a name+len instead of c-stringRan Benita2014-02-103-6/+7
| | | | | | In the rules file parser we use pascal strings. Signed-off-by: Ran Benita <ran234@gmail.com>
* Move src/xkbcomp/scanner-utils.h to src/Ran Benita2014-02-102-1/+1
| | | | | | As we'll use it for things unrelated to xkbcomp. Signed-off-by: Ran Benita <ran234@gmail.com>
* build: fix configure test for yaccRan Benita2014-02-101-1/+2
| | | | | | | | | It only works if 'bison' or 'byacc' are provided, but sometimes byacc is installed as plain 'yacc'. The check fails for that. I broke this in bdd8c11, restore Daniel's retrospectively clever check. Signed-off-by: Ran Benita <ran234@gmail.com>
* scanner: sort out scanner logging functionsRan Benita2014-02-105-120/+68
| | | | | | | | | | First, make the rules and xkb scanners/parsers use the same logging functions instead of rolling their own. Second, use the gcc ##__VA_ARGS extension instead of dealing with C99 stupidity. I hope all relevant compilers support it. Signed-off-by: Ran Benita <ran234@gmail.com>
* rules: always %-expand kccgst valuesRan Benita2014-02-101-26/+35
| | | | | | | Previously the early-exit codepath might have left some values unexpanded, and we'd go looking for e.g "%l%(v)". Signed-off-by: Ran Benita <ran234@gmail.com>
* test/rmlvo-to-kccgst: use default RMLVO values in translationRan Benita2014-02-101-0/+2
| | | | | | | The tool's supposed to display exactly the same results as the library code. Signed-off-by: Ran Benita <ran234@gmail.com>
* context: add xkb_context_sanitize_rule_names()Ran Benita2014-02-103-37/+32
| | | | | | | We want all the default logic in a test, so encapsulate it in this function, and make all the get_default_* functions static. Signed-off-by: Ran Benita <ran234@gmail.com>
* rules: print full path in error messagesRan Benita2014-02-101-3/+3
| | | | | | | | There can be multiple include paths. But it's nicer in any case. This also makes scanner_error actually use log_err instead of log_warn - oops. Signed-off-by: Ran Benita <ran234@gmail.com>
* rules: include the path in failed-to-map error messageRan Benita2014-02-101-1/+2
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* context: fix wrong VARIANT instead of LAYOUT getenvRan Benita2014-02-101-1/+1
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* ast: remove unneeded 'ctx' param to XkbFileCreateRan Benita2014-02-093-8/+8
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: don't trust keycode before testing its rangeRan Benita2014-02-091-3/+7
| | | | | | The assert is not very useful access the key just before. Signed-off-by: Ran Benita <ran234@gmail.com>
* keymap: reduce padding in struct xkb_sym_interpretRan Benita2014-02-091-1/+1
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* symbols: steal keys and modmaps when merging if possibleRan Benita2014-02-091-8/+20
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* compat: steal interps and leds when merging if possibleRan Benita2014-02-091-8/+20
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* types: steal types when merging if possibleRan Benita2014-02-091-4/+10
| | | | | | | Like we do everywhere else. Removes some unnecessary allocations and copying. Signed-off-by: Ran Benita <ran234@gmail.com>
* doc: move some file comments into txt files in doc/Ran Benita2014-02-096-429/+445
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* state: check wrap_group_into_range() return valueRan Benita2014-02-091-8/+12
| | | | | | | | It returns XKB_LAYOUT_INVALID in case num_groups == 0. So we shouldn't just save it in the state. Note, though, that this condition is generally impossible. Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: add 0 < ctrls->numGroups <= 4 assertionRan Benita2014-02-091-0/+1
| | | | | | | This only happens if something is wrong in the server; a valid keymap cannot be had in any case. Signed-off-by: Ran Benita <ran234@gmail.com>
* Remove m4/.gitkeepRan Benita2014-02-081-0/+0
| | | | | | Now there's a file in there. Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym: use safe keysym comparison functionRan Benita2014-02-081-1/+5
| | | | | | | Instead of thinking about signed <-> unsigned an whatnot. bsearch() is inline in glibc, so gcc optimizes this away anyway. Signed-off-by: Ran Benita <ran234@gmail.com>
* scanner: make line and column unsignedRan Benita2014-02-083-5/+5
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* rules: get rid of struct locationRan Benita2014-02-081-24/+15
| | | | | | Use the scanner token_{line,column} like we do in the other places. Signed-off-by: Ran Benita <ran234@gmail.com>
* api: deprecate XKB_MAP_COMPILE_PLACEHOLDER, and use KEYMAP instead of MAPRan Benita2014-02-085-8/+10
| | | | | | | | | | | | | | The PLACEHOLDER was not meant to be used, but c++ doesn't like passing 0 to enums, so it was used. For this reason we add all the NO_FLAGS items, so the PLACEHOLDER shouldn't be used anymore. Second, XKB_MAP is the prefix we used ages ago, KEYMAP is the expected prefix here. So deprecate that as well. The old names may still be used through the xkbcommon-compat.h header, which is included by default (no need to include directly). Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: make sure not to use compat headerRan Benita2014-02-081-1/+1
| | | | | | | src/keymap.h already defines the necessary header guard, so just reverse the include order. Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: make some #defines unsignedRan Benita2014-02-081-9/+9
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: fix truncation of xkb controls mask off the wireRan Benita2014-02-081-1/+1
| | | | | | | It's uint32_t, not uint16_t, so we were losing flags (not that it matters in this case). Signed-off-by: Ran Benita <ran234@gmail.com>
* x11: make msb_pos return unsignedRan Benita2014-02-082-4/+4
| | | | | | | It was initially returning -1 for all-zero arguments, but now it returns 0. Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym: fix types in bin_searchRan Benita2014-02-081-3/+3
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* state: optimize xkb_state_led_update_all()Ran Benita2014-02-081-21/+33
| | | | | | | | | | | | | | Before: ran@ran:~/src/libxkbcommon$ ./test/bench-key-proc ran 20000000 iterations in 6.623018074s After: ran@ran:~/src/libxkbcommon$ ./test/bench-key-proc ran 20000000 iterations in 4.762291091s Not that anyone needs to process millions of keys per second... Signed-off-by: Ran Benita <ran234@gmail.com>
* Use (1u << idx) instead of (1 << idx) where appropriateRan Benita2014-02-088-34/+34
| | | | | | | | It doesn't matter (I think), since the implicit conversion doesn't have any effect (e.g. sign-extension). But it's better to be aware of the type. Signed-off-by: Ran Benita <ran234@gmail.com>
* Use unsigned int for saving darray_size return valueRan Benita2014-02-082-5/+5
| | | | | | | See: b9b3593cbdeb7f5b02d50cecaba6a0b47d4979ad So these should be unsigned int's now. Signed-off-by: Ran Benita <ran234@gmail.com>
* action: fix misleading castRan Benita2014-02-081-1/+1
| | | | | | The type is uint8_t and so is the checked range. Signed-off-by: Ran Benita <ran234@gmail.com>
* action: fix printing of underflowed value in error messageRan Benita2014-02-081-2/+2
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* scanner-utils: add some likely/unlikely annotationsRan Benita2014-02-081-4/+6
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* Define likely()/unlikely() macrosRan Benita2014-02-083-0/+178
| | | | | | | It serves as nice "hotspot" annotations, and can also help things, so why not. Signed-off-by: Ran Benita <ran234@gmail.com>
* Partially revert "ast: pack the ParseCommon struct"Ran Benita2014-02-081-3/+1
| | | | | | | | | This reverts commit 1e6e5669c6229846830f0b497591de4e3cf588eb. It's probably safe, but let's not take any chances, as I don't have any esoteric arch to test on. But keep the ATTR in case it's ever useful. Signed-off-by: Ran Benita <ran234@gmail.com>
* build: add -Wextra warningsRan Benita2014-02-081-0/+1
| | | | | | If it gets annoying, we can disable it. But for now it's clean. Signed-off-by: Ran Benita <ran234@gmail.com>
* ast: use more suitable types in a few ast nodesRan Benita2014-02-083-8/+8
| | | | | | | | | | The int ones cannot be signed (they come as such from the scanner, and NEGATE is never applied to them). The uint32_t one is really an atom, but presumably the type was never converted to xkb_atom_t. Signed-off-by: Ran Benita <ran234@gmail.com>
* darray: use unsigned int instead of size_t for array sizeRan Benita2014-02-081-10/+17
| | | | | | | | | | | | size_t is too large; if we ever need it, that's the least of our problems. Besides, when we roll our own (e.g. in keymap.h) it's already unsigned int. Instead, add some emergency overflow check. So, why? - It plays nicer with all the other uint32_t's and unsigned int's (no extensions, etc.). - Reduces keymap memory usage by 5% or so as a bonus. Signed-off-by: Ran Benita <ran234@gmail.com>
* test/state: fix tautological testRan Benita2014-02-081-1/+1
| | | | | | test/state.c:376:5: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] Signed-off-by: Ran Benita <ran234@gmail.com>
* Fix sign-compare warningsRan Benita2014-02-088-28/+27
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* symbols: reduce some loop iterators scopeRan Benita2014-02-081-14/+7
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* parser: fix unrecognized keysym handlingRan Benita2014-02-081-3/+9
| | | | | | | Integer may be negative, so also need to test >= 0. Also, $$ was left uninitialized if the keysym wasn't recognized. Signed-off-by: Ran Benita <ran234@gmail.com>
* action: change xkb_pointer_button_action::button to uint8_tRan Benita2014-02-081-1/+1
| | | | | | In XkbPtrBtnAction it is unsigned char, don't know how it became signed. Signed-off-by: Ran Benita <ran234@gmail.com>
* darray: cleanupRan Benita2014-02-083-225/+28
| | | | | | | | We have quite diverged from the upstream file, so let's make it at least easier to look at. Remove some unused macros and rename some for consistency. Signed-off-by: Ran Benita <ran234@gmail.com>
* ast: make symsMapIndex unsignedRan Benita2014-02-081-1/+1
| | | | | | It doesn't need to be signed. Signed-off-by: Ran Benita <ran234@gmail.com>
* action: Use ResolveInteger for PtrBtn.count, not ResolveButtonRan Benita2014-02-071-6/+5
| | | | | | It's not a button. Signed-off-by: Ran Benita <ran234@gmail.com>