Branch :
| Author | Commit | Date | CI | Message |
|---|---|---|---|---|
| 1499eedd | 2013-08-13 18:52:46 | keysym: add xkb_keysym_to_{lower,upper} These functions are needed later; they are not API functions. The capitalization is not locale sensitive. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 2a2a8d7d | 2013-08-13 18:57:43 | state: apply capitalization transformation on keysyms The xkbproto spec says: http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Lock_Modifier If the Lock modifier is not consumed by the symbol lookup process, routines that determine the symbol and string that correspond to an event should capitalize the result. This was not an issue until now, because most xkeyboard-config keymaps do not utilize this "feature", and specify the keysyms for the Lock modifier explicitly instead. However, some keymaps do depend on it, e.g. ch(fr) for eacute and others. The spec goes on to describe two options for doing this transformation: locale-sensitive and locale-insensitive. We opt for the latter; it is less desirable but we don't want *that* headache. Also, only xkb_state_key_get_one_sym() is changed; xkb_state_key_get_syms() is left as-is, and always reports the untransformed keysyms. This is for the following reasons: - The API doesn't allow it, since we return a const pointer directly to the keymap keysyms table and we can't transform that. - The transformation doesn't make sense for multiple-keysyms. - It can be useful for an application to get the "raw" keysyms if it wants to (e.g. maybe it wants to do the transformation itself). Finally, note that xkb_state_mod_index_is_consumed() does *not* report Lock as consumed even if it was used in the transformation. This is what Xlib does. This definitely doesn't fall under the "hard to misuse" API rule but it's the best we can do. https://bugs.freedesktop.org/show_bug.cgi?id=67167 Reported-By: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7caa1af2 | 2013-08-13 14:45:33 | scanner: don't fail over unknown escape sequence This is too strict, and causes symbols/cz to fail parsing. Instead, just emit a warning (not shown by default): xkbcommon: WARNING: cz:75:19: unknown escape sequence in string literal https://bugs.freedesktop.org/show_bug.cgi?id=68056 Reported-By: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 869c9b58 | 2013-08-13 09:57:07 | xkbcomp: improve a few log messages Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| aa9c9194 | 2013-08-02 14:41:19 | scanner: fix compiler warning src/xkbcomp/scanner.c:158:17: warning: comparison of constant -1 with expression of type 'enum yytokentype' is always true [-Wtautological-constant-out-of-range-compare] if (tok != -1) return tok; ~~~ ^ ~~ Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| e91d2653 | 2013-08-01 23:09:46 | scanner: allow empty key name literals Some keymaps actually have this, like the quartz.xkb which is tested. We need to support these. https://bugs.freedesktop.org/show_bug.cgi?id=67654 Reported-By: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| e731b251 | 2013-08-01 20:24:27 | xkbcomp: handle empty keymaps We should handle empty xkb_keycode and xkb_symbol sections, since xkbcomp handles them, and apparently XQuartz uses it. There are also files for it in xkeyboard-config (rules=base model=empty layout=empty, which translate to keycodes/empty and symbols/empty). https://bugs.freedesktop.org/show_bug.cgi?id=67654 Reported-By: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| d2383d38 | 2013-08-01 20:44:46 | keymap-dump: use correct format specifiers For keycodes, groups, levels, etc, which are unsigned. The really proper inttypes.h ones seem a bit much though. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| c0589be6 | 2013-07-28 23:42:35 | log: change the log prefixes to be more library-like "Error: " is not very informative when intermingled with other logs. The format that seems most suitable is: "xkbcommon: ERROR: %s" Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 990c09a3 | 2013-07-28 16:21:40 | keymap: update builtin fields directly in src/keymap.c This fields are part of our API and every keymap should have them, not just xkbcomp/ ones. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 5f787e5e | 2013-07-27 21:19:22 | keymap: be more careful in xkb_keymap_unref To allow calling _unref on the keymap in whatever limbo state it happens to be in. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| be38862b | 2013-07-26 00:50:26 | keymap: remove struct xkb_key_redirect_action The file src/xkbcomp/action.c already doesn't handle this action type and fails if it encounters it. So lets not pretend to do something with it, and ignore it rather than failing. If we/someone wants this we can consider implementing it. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| ec9a02a2 | 2013-07-24 10:05:02 | Get rid of the usage of PATH_MAX PATH_MAX is optional in POSIX, so avoid its unconditional usage allocating and freeing buffers as needed. To avoid too many malloc/free in the for loop in FindFileInXkbPath, a buffer is grown according to the size needed at each iteration. | ||
| 806d24b1 | 2013-07-23 11:36:01 | keymap: move RANGE_WRAP to be the first in the enum This is the reasonable "zero-default" for this enum. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| c00ea5ff | 2013-07-22 10:51:22 | atom: really work with non-NUL-terminated strings Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 9e801ff7 | 2013-07-21 17:01:20 | ctx: adapt to the len-aware atom functions xkb_atom_intern now takes a len parameter. Turns out though that almost all of our xkb_atom_intern calls are called on string literals, the length of which we know statically. So we add a macro to micro-optimize this case. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7e0ae4b4 | 2013-07-21 16:41:27 | atom: allow interning non-NUL-terminated strings We need this later. The strlen was calculated anyway, so no loss here. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 9cd29453 | 2013-07-21 16:32:21 | atom: expand variable names A bit easier to understand at a glance. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 9ffe9dae | 2013-07-21 09:48:12 | keymap: don't use darray for sym_interprets We want xkb_keymap to be easy to handle everywhere. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4b560287 | 2013-07-18 14:50:21 | xkbcomp: escape the section names before storing them in the keymap This ensures the names are escaped before having any interaction with the user. This was caught by noticing dump(compile(dump())) != dump. Since that's a nice test we add it to stringcomp. https://bugs.freedesktop.org/show_bug.cgi?id=67032 Reported-By: Auke Booij Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 6bb727b2 | 2013-07-17 22:46:48 | Resync keysym database xproto 7.0.24 adds XF86AudioMicMute. Signed-off-by: Daniel Stone <daniel@fooishbar.org> | ||
| b06de307 | 2013-05-09 15:31:21 | Add keycode min/max and iteration API Add three new pieces of API: - xkb_keymap_min_keycode does what it says on the tin - xkb_keymap_max_keycode likewise - xkb_keymap_key_for_each calls the provided function once for every valid key in the keymap Signed-off-by: Daniel Stone <daniel@fooishbar.org> | ||
| 17a956d8 | 2013-05-09 14:47:09 | Widen keycode range to 8/255 if possible (bug #63390) If the keycode range is smaller than 8 → 255, artifically widen it when dumping the keymap as not to displease X. Signed-off-by: Daniel Stone <daniel@fooishbar.org> | ||
| a392d268 | 2012-08-12 11:40:02 | Replace flex scanner with a hand-written one The scanner is very similar in structure to the one in xkbcomp/rules.c. It avoids copying and has nicer error reporting. It uses gperf to generate a hashtable for the keywords, which gives a nice speed boost (compared to the naive strcasecmp method at least). But since there's hardly a reason to regenerate it every time and require people to install gperf, the output (keywords.c) is added here as well. Here are some stats from test/rulescomp: Before: compiled 1000 keymaps in 4.052939625s ==22063== total heap usage: 101,101 allocs, 101,101 frees, 11,840,834 bytes allocated After: compiled 1000 keymaps in 3.519665434s ==26505== total heap usage: 99,945 allocs, 99,945 frees, 7,033,608 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| e4bceec8 | 2013-03-14 14:33:40 | utils: add {un,}map_file to read an entire file This wraps the current mmap call and adds a fallback implementation for systems which do not have mmap (e.g. mingw). Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 99f6e6fc | 2013-03-14 14:31:55 | Add scanner-utils.h for common scanner functions We want to share the same functions for another scanner. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 36f55c49 | 2013-03-11 12:53:39 | keymap: add xkb_keymap_new_from_buffer() 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 | ||
| 094f1dc2 | 2013-03-30 19:19:01 | xkbcomp/keymap: silence a gcc warning 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> | ||
| fbe5e675 | 2013-02-28 10:48:40 | Add environment overrides for default RMLVO 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> | ||
| 57bfde3a | 2013-03-04 18:41:13 | keymap: rename xkb_kt_map_entry to xkb_key_type_entry That's a better name and fits more nicely. Also change type->map to type->entries. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 0513686b | 2013-03-14 12:45:34 | rules: be more paranoid in scanner This can't happen, but better safe than sorry. The optimizations were noticeable but negligible. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 0e200bd5 | 2013-03-13 13:55:11 | rules: quiet a gcc warning 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> | ||
| 9f75e0ab | 2013-03-07 01:15:21 | state: use stdbool in filters Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 6a39a065 | 2013-03-04 18:35:56 | Fix pointer style nit (I really dislike this one for some reason..) Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 56ba9866 | 2013-03-04 14:16:36 | Remove file_id entirely It is not used anymore. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 64c00262 | 2013-03-04 14:15:32 | symbols: remove file_id See previous commits. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4921eb74 | 2013-03-04 14:11:13 | compat: remove file_id See previous commit. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 2b6e576f | 2013-03-04 14:04:49 | types: remove file_id See previous commit. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 2ddb9e4f | 2013-03-04 14:00:44 | types: put all copy-to-keymap code in one function Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4bd0610f | 2013-03-04 13:21:42 | keycodes: remove KeyNamesInfo::merge Not used. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| b06ef2b8 | 2013-03-04 13:06:38 | keycodes: unwrap KeyNameInfo We don't need the struct any more, it only contains one field now. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| a78c1f0a | 2013-03-04 12:53:32 | keycodes: remove file_id 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> | ||
| f8d3ec9f | 2013-03-04 12:27:06 | keymap: don't use darray for key aliases 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> | ||
| ea3cf26d | 2013-03-04 10:33:18 | keycodes: don't do unnecessary copies while merging 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> | ||
| cd6a71fc | 2013-03-04 02:12:00 | state: small style fix Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 71eb033e | 2013-03-03 21:35:43 | Move a couple of general keymap functions from keycodes.c To get a key by name and resolve an alias - this makes sense for everyone. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 82c3e393 | 2013-03-03 15:10:45 | keycodes: remove unneeded alias conflict check 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> | ||
| 614f60e3 | 2013-03-03 00:11:27 | xkbcomp: handle XKB file include's better 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> | ||
| a7b1f80d | 2013-03-02 20:43:57 | Build cleanly with clang 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> | ||
| 14842d6d | 2013-03-01 21:48:02 | keymap: abstract a bit over the keymap format 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> | ||
| d1eae42a | 2013-03-01 21:31:08 | text: some style changes Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4e8dcca8 | 2013-03-01 18:33:40 | text: clean up and fix the *MaskText functions 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> | ||
| 540feef3 | 2013-03-01 13:51:13 | More spelling errors Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| b36d5b23 | 2013-02-25 17:00:53 | parser: also skip 'section' ELEMENT It's for geometry only. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 35657c66 | 2013-02-25 16:38:56 | ast-build: remove malloc_or_die This should be fixed properly. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| a7b9c73d | 2013-02-25 16:08:08 | keycodes: fix spelling in error message Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 958b2728 | 2013-02-25 12:37:28 | Remove list.h We don't use it anymore and it's easy to add back if needed. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 98ccbf9a | 2013-02-25 12:17:27 | keymap-dump: move writing 'key {}' in symbols to its own function Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4a59c84e | 2013-02-25 12:09:17 | keymap-dump: remove some ugly empty lines 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> | ||
| e95dac76 | 2013-02-25 12:03:06 | keymap-dump: don't indent after xkb_keymap { xkbcomp doesn't indent there, so it's easier to diff. Also saves some horizontal space which is sorely needed when looking at these files (especially the xkb_symbols). Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 9842b7a5 | 2013-02-25 11:50:26 | keymap-dump: style cleanups Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| d1f7100b | 2013-02-25 01:12:38 | ast: add error handling to XkbFileFromComponents And try to not repeat ourselves. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| a46e4cc1 | 2013-02-25 00:19:51 | Fix dead assignments "Value stored to 'stmt' is never read" "Value stored to 'grp_to_use' is never read" And change 'grp' to 'group' if we're here. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| c7aef166 | 2013-02-19 15:57:14 | keysym: print unicode keysyms uppercase and 0-padded Use the same format as XKeysymToString. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| dd81d5e0 | 2013-02-08 00:07:28 | Change some log functions to take ctx instead of keymap They don't need the keymap, only the context. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| a4904ee1 | 2013-02-09 21:46:09 | keycodes: some minor style Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 60bb639b | 2013-02-08 14:03:36 | action: s/hndlrType/handler_type Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| fab28da3 | 2013-02-08 16:06:35 | compat: make it clear which 'dflt' is meant Also s/dflt/default. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| b5c1b1d2 | 2013-02-07 23:28:18 | symbols: make it clear which 'dflt' is meant A bit easier at a glance. Also, vowels are cool, so just say 'default'. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| fc56b513 | 2013-02-08 00:02:49 | ast: constify argument Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 164cec66 | 2013-02-19 11:10:23 | symbols: fix bad 'merge' assignment Bug introduced in 2a5b0c9dc1ad1488ecc6b139fd70e464eb687da6, was causing some keys to be merged incorrectly. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 8cee7490 | 2013-02-17 22:18:57 | Change 'indicator' to 'led' everywhere possible The code currently uses the two names interchangeably. Settle on 'led', because it is shorter, more recognizable, and what we use in our API (though of course the parser still uses 'indicator'). In camel case we make it 'Led'. We change 'xkb_indicator_map' to just 'xkb_led' and the variables of this type are 'led'. This mimics 'xkb_key' and 'key'. IndicatorNameInfo and LEDInfo are changed to 'LedNameInfo' and 'LedInfo', and the variables are 'ledi' (like 'keyi' etc.). This is instead of 'ii' and 'im'. This might make a few places a bit confusing, but less than before I think. It's also shorter. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 089c3a18 | 2013-02-17 14:59:50 | state: fix unbound virtual modifier bug Recent xkeyboard-config introduced the following line in symbols/level3: vmods = LevelThree, However, the XKM format which xkbcomp produces for the X server can't handle explicit virtual modifiers such as this: https://bugs.freedesktop.org/show_bug.cgi?id=4927 So by doing the following, for example: setxkbmap -layout de (or another 3-level layouts) xkbcomp $DISPLAY out.xkb xkbcomp out.xkb $DISPLAY The modifier is lost and can't be used for switching to Level3 (see the included test). We, however, are affected worse by this bug when we load the out.xkb keymap. First, the FOUR_LEVEL_ALPHABETIC key type has these entries: map[None] = Level1; map[Shift] = Level2; map[Lock] = Level2; map[LevelThree] = Level3; [...] Now, because the LevelThree virtual modifier is not bound to anything, the effective mask of the "map[LevelThree]" entry is just 0. So when the modifier state is empty (initial state), this entry is chosen, and we get Level3, instead of failing to match any entry and getting the default Level1. The difference in behavior from the xserver stems from this commit: acdad6058d52dc8a3e724dc95448300850d474f2 Which removed the entry->active field. Without bugs, this would be correct; however, it seems in this case we should just follow the server's behavior. The server sets the entry->active field like so in XKBMisc.c: /* entry is active if vmods are bound */ entry->active = (mask != 0); The xkblib spec explains this field, but does not specify how to initialize it. This commit does the same as above but more directly. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| bb620df7 | 2012-12-06 15:04:15 | Parser: Initialise geometry elements for VarDecl We were using uninitialised memory whilst parsing geometry, leaving random contents as the return for shape/overlay/etc sections. Somehow this actually worked everywhere but under Java. https://bugs.freedesktop.org/show_bug.cgi?id=57913 Signed-off-by: Daniel Stone <daniel@fooishbar.org> | ||
| f1598469 | 2012-11-11 16:14:30 | state: rename state->cur to state->components 'cur' doesn't make sense anymore. 'components' is a bit long for this, but not too bad, and nothing better comes to mind. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7372c9f1 | 2012-11-11 16:06:54 | state: don't keep the previous state components in xkb_state There is really no need to keep this in the struct, we can just allocate it on the stack when we need to. Don't know why I did it this way. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 60bd9202 | 2012-11-11 00:22:46 | keymap: wrap the layout parameter if it is out of range for the key The functions num_levels_for_key() and get_syms_by_level() have a 'layout' parameter. Currently it is expected that this value is always legal for the key, as determined by num_layouts_for_key(). However, there are legitimate use cases for passing an out-of-range layout there, most probably passing the effective layout, and expecting to get the keysyms/levels for just this layout. So we wrap it just as we do in the xkb_state_* functions. This is also useful for stuff like this: http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html#gdk-keymap-lookup-key If this behavior is not desired, the user has the option to check against num_layouts_for_key herself. https://bugs.freedesktop.org/show_bug.cgi?id=56866 Reported-by: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| d9317d5f | 2012-11-05 21:50:38 | keysym-utf: mark keysymtab array as static Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7891c917 | 2012-11-05 21:34:59 | keysym-utf: also translate special keysyms like Tab and Return The keysym2ucs.c file apparently leaves out some keysyms, which libX11 deals with separately (like in _XkbHandleSpecialSym()). The problematic keysyms are the keypad ones (for which we already added some support) and keysyms which use 0xff** instead of 0x00** < 0x20. This code should fix them properly, as much as I could gather from libX11 and http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c and other sources (which are not aware of locale). https://bugs.freedesktop.org/show_bug.cgi?id=56780 Reported-by: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 998c957a | 2012-10-30 18:21:56 | action: don't allow private actions with a known type Some obscure bug having to do with Private actions; see the comments. This was prompted by: https://bugs.freedesktop.org/show_bug.cgi?id=56491 Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7261f404 | 2012-10-29 01:00:27 | state, context: allow passing NULL to *_unref() For error handling code, it's nice to be able to pass NULL to these function without worrying about segfaults ensuing. free() sets the precedent here. Also document this fact. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| a51ee704 | 2012-10-26 16:24:11 | state: don't use xkb_keymap_num_layouts internally Clearer and more greppable this way. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| ee6f3f28 | 2012-10-26 16:12:28 | state: don't use xkb_state_serialize_* internally The code in these cases is clearer when done directly. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 6f093ad5 | 2012-10-24 23:09:26 | state: fix possible index-out-of-bounds in action dispatch table The current code assumes that action->type always falls in the range of the xkb_action_type enum. But keymaps can also have Private actions, which are allowed to set their own type number. So with a default xkeyboard-config keymap, keycode 86 at level 4, which triggers such an action, causes us to crash. Fix it by always checking the bounds. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| f76859bc | 2012-10-23 09:58:11 | keymap: use plain array for keymap->group_names Again it is not resized. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 867992cd | 2012-10-23 17:17:18 | state: fix typo in state component copying Gladly no-one should have been fast enough to hit this. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 4b81c9f3 | 2012-10-22 21:00:57 | Report which components of the state have changed We add a return value to the xkb_state_update_key and xkb_state_update_mask, which reports to the caller which of the state components have changed as a result. This restores the XKB functionality of the XkbStateNotify and XkbIndicatorsStateNotify events. See: http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Events It is quite useful in some situations. For example, it allows an application to avoid doing some work if nothing of relevance in the state has changed. Say, a keyboard layout applet. Also useful for debugging. The deltas themselves are not provided, because I can't see a use case. If needed, it should be possible to add some API for that. In xkbcommon, keymaps are immutable, so all of the other *Notify events from XKB are irrelevant. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 550cb24d | 2012-10-22 19:19:43 | state: add struct state_components This holds all of the state component fields in the state in one struct. We will later want to keep the previous state components after updates, so this will allow us to do it without duplicating the fields. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 6a94b122 | 2012-10-22 20:49:44 | Split the mods, layout, leds parts of xkb_state_components Note first: This commits breaks the ABI somewhat. If an application is run against this commit without recompiling against the updated header, these break: - xkb_state_layout_*_is_active always retuns false. - xkb_state_serialize_mods always returns 0. So it might break layout switching in some applications. However, xkbcommon-compat.h provides the necessary fixes, so recompiling should work (though updating the application is even better). Split the enum to its individual components, which enables us to refer to them individually. We will use that later for reporting which components of the state have changed after update. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 0779d9dc | 2012-10-21 17:13:25 | Silence a couple of warnings These appear to come and go randomly. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| bb82759c | 2012-10-18 23:08:10 | Move _text() functions from keymap-dump to text.c And make them use context_get_buffer() instead of using a static char array. This was the last non-thread-safe piece we had, as far as I can tell. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| e6946ae2 | 2012-10-18 22:55:17 | Remove a couple more uses of static char buffers Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 714e95e1 | 2012-10-18 22:51:10 | Contextualize GetBuffer() Instead storing the buffer in a non-thread-safe static array, we move it to the context. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| eb748ab6 | 2012-10-18 21:04:27 | Clean up xkb_sym_interpret a bit First we split the LEVEL_ONE_ONLY bit off of the 'match' field, which allows us to turn enum xkb_match_operation to a simple enum and remove the need for MATCH_OP_MASK. Next we rename 'act' to 'action', because we've settled on that everywhere else. Finally, SIMatchText is changed to not handle illegal values - it shouldn't get any. This removes one usage of the GetBuffer hack. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 5d9a5cb0 | 2012-10-17 19:52:47 | Commit and distribute ks_tables.h The ks_tables.h file is generated by makekeys.py from xkbcommon-keysyms.h, which in turn is generated initially by 'make update-keysyms'. The xkbcommon-keysyms.h file is commited to git and distributed in the tarball. Since ks_tables.h should only ever change when xkbcommon-keysyms.h changes, it is more sensible to update them together and treat them the same, instead of generating ks_tables.h every time for every builder with 'make', as we do now. This means we don't need python as a build dependency (only the one running update-keysyms, i.e. no one, needs this), and we can be sure exactly the same file is used by everyone. We also don't need to run makekeys.py on every build. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 17985511 | 2012-10-16 21:09:33 | utils: add and use ARRAY_SIZE macro Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| 7b3bd11f | 2012-10-16 16:05:34 | Add xkb_keysym_from_name() flags argument for case-insensitive search This adds a flags argument to xkb_keysym_from_name() so we can perform a case-insensitive search. This should really be supported as many keysyms have really weird capitalization-rules. However, as this may produce conflicts, users must be warned to only use this for fallback paths or error-recovery. This is also the reason why the internal XKB parsers still use the case-sensitive search. This also adds some test-cases so the expected results are really produced. The binary-size does _not_ change with this patch. However, case-sensitive search may be slightly slower with this patch. But this is barely measurable. [ran: use bool instead of int for icase, add a recommendation to the doc, and test a couple "thorny" cases.] Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> | ||
| 5fff637e | 2012-10-16 16:05:33 | makekeys: replace helper with python script and binary search This removes the complicated and undocumented hash-table creation-helper and replaces it with an autogenerated sorted array. The search uses simple bsearch() now. We also tried using gperf but it turned out to generate way to big hashtables and when reducing the size it isn't really faster than bsearch() anymore. There are no users complaining about the speed of keysym lookups and we have no benchmarks that tell that we are horribly slow. Hence, we can safely use the simpler approach and drop all that old code. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> | ||
| 3477d9e4 | 2012-10-05 16:23:03 | Finish first round of API documentation There are a few @todo's, but nothing serious. Signed-off-by: Ran Benita <ran234@gmail.com> | ||
| f43b33c0 | 2012-10-13 13:13:55 | state: make mod_index_is_consumed() return -1 on invalid input Like all the other functions. Signed-off-by: Ran Benita <ran234@gmail.com> |