kc3-lang/libxkbcommon/src/xkbcomp/keytypes.c

Branch :


Log

Author Commit Date CI Message
26c01d3b 2012-08-08 13:30:05 Warning fixes Signed-off-by: Daniel Stone <daniel@fooishbar.org>
262bf97f 2012-08-07 13:23:44 types: remove default type The default type is copied over for each new key type to build on. Further, it can be modified from within the xkb_types section itself, with statements such as "type.modifiers = Lock" which affect all subsequent type definitions. The default type is (well, by default) just the simplest one level type possible, with name "default". When no types are defined at all, it is copied over to the keymap as the single type. xkeyboard-config never changes the default type. There is also no sane use case for doing so; changing any thing there doesn't make sense. So instead of doing all the hard work of maintaining and copying this type, which is practically never used, just remove it and initialize new types appropriately. Signed-off-by: Ran Benita <ran234@gmail.com>
d327d3e2 2012-08-07 11:40:07 types: store atoms instead of strings for level and type names We don't use these strings much, so storing them in the manner they were compiled saves some copying and space. Signed-off-by: Ran Benita <ran234@gmail.com>
b2fba730 2012-08-07 08:52:23 types: use regular array for map entries This array is only initialized once. Signed-off-by: Ran Benita <ran234@gmail.com>
8ccfee82 2012-08-07 08:38:20 types: use regular array for types The current code doesn't resize it any more. Signed-off-by: Ran Benita <ran234@gmail.com>
a681c624 2012-08-07 08:17:26 types: remove DeleteLevel1MapEntries If there is no map entry for some modifier combination, the default is to use level 1. The removed code is an optimization to save some space by removing these entries. But it doesn't actually save any space, and did not in fact remove all level 1 entries (it walks the array while modifying it so there's an off-by-one error). We can instead keep them in the types but just not print them in keymap-dump.c, to get about the same behavior. Signed-off-by: Ran Benita <ran234@gmail.com>
233d85c4 2012-08-06 21:31:17 types: move preserve directly into xkb_kt_map_entry Currently each xkb_key_type has a preserve array, which is only allocated if a preserve[] statement is specified in the type. In this case each map entry has an element in the array. The space savings are negligible; put this field where it logically belongs. Signed-off-by: Ran Benita <ran234@gmail.com>
6b75dd2d 2012-08-05 19:38:31 Fix virtual modifiers mask extraction The calculations were performed incorrectly in several places, specifically shifting by 16 instead of 8 (= XkbNumModifiers) and masking with 0xff instead of 0xffff. More stuff that probably never worked as intended. This also makes these more grep-able when we remove the vmods/real_mods separation. Signed-off-by: Ran Benita <ran234@gmail.com>
796dccab 2012-08-05 14:05:03 types: small changes Just make things easier to follow, no functional changes. Signed-off-by: Ran Benita <ran234@gmail.com>
b0b11c4e 2012-08-02 00:29:07 types: don't use canonical/required types Xkb required every keymap to have at least the four following canonical types: ONE_LEVEL, TWO_LEVEL, ALPHABETIC, KEYPAD. This is specified in e.g. the kbproto spec and XkbKeyTypesForCoreSymbols(3) man page. If these types are not specified in the keymap, the code specifically checks for them and adds them to the 4 first places in the types array, such that they exist in every keymap. These are also the types (along with some non-required 4-level ones) that are automatically assigned to keys which do not explicitly declare a type (see FindAutomaticType in symbols.c, this commit doesn't touch these heuristics, whcih are also not very nice but necessary). The xkeyboard-config does not rely on the builtin xkbcomp definitions of these types and does specify them explicitly, in types/basic and types/numpad, which are virtually always included. This commit removes the special behavior: - The code is ugly and makes keytypes.c harder to read. - The code practically never gets run - everyone who uses xkeyboard-config or a keymap based upon it (i.e. everyone) doesn't need it. So it doesn't get tested. - It mixes policy with implementation for not very good reasons, it seems mostly for default compatibility with X11 core. - And of course we don't need to remain compatible with Xkb ABI neither. Instead, if we read a keymap with no types specified at all, we simply assign all keys a default one-level type (like ONE_LEVEL), and issue plenty of warnings to make it clear (with verbosity >= 3). Note that this default can actually be changed from within the keymap, by writing something like type.modifier = Shift type.whatever_field = value in the top level of the xkb_types section. (This functionality is completely unused as well today, BTW, but makes some sense). This change means that if someone writes a keymap from scratch and doesn't add say ALPHABETIC, then something like <AE11> = { [ q Q ]; }; will ignore the second level. But as stated above this should never happen. Signed-off-by: Ran Benita <ran234@gmail.com>
be82f082 2012-08-05 13:46:56 types: add a general overview Signed-off-by: Ran Benita <ran234@gmail.com>
cead8527 2012-08-01 22:12:13 Replace more defines with enums Mostly the ones used to track the fields of types/keys/leds which were already defined. Signed-off-by: Ran Benita <ran234@gmail.com>
3bea189b 2012-08-01 18:46:01 Make top level Handle*File functions nicer Signed-off-by: Ran Benita <ran234@gmail.com>
15541766 2012-08-05 14:10:45 expr: make ResolveLevel return zero-based level Signed-off-by: Ran Benita <ran234@gmail.com>
59d947c9 2012-08-05 19:24:44 Add and use xkb_level_index_t Several types are used over the code for shift levels; better to use just one. Signed-off-by: Ran Benita <ran234@gmail.com>
38614c88 2012-07-24 17:21:29 expr: drop ExprResult from ResolveMask Signed-off-by: Ran Benita <ran234@gmail.com>
27f94929 2012-07-23 15:46:50 expr: drop ExprResult from ResolveString Signed-off-by: Ran Benita <ran234@gmail.com>
025ca579 2012-07-23 12:20:05 expr: drop ExprResult from ResolveLhs Signed-off-by: Ran Benita <ran234@gmail.com>
6ec13570 2012-07-24 00:51:19 expr: drop ExprResult from ResolveLevel Signed-off-by: Ran Benita <ran234@gmail.com>
724f62c8 2012-07-25 17:29:08 Convert defines to enums in xkbcomp.h For statement / expression types. Signed-off-by: Ran Benita <ran234@gmail.com>
35fb8b94 2012-07-27 01:47:32 Fix incorrect comparison ExprFieldRef goes into the ExprDef op field, not the type field. Signed-off-by: Ran Benita <ran234@gmail.com>
89723b7c 2012-07-24 19:54:14 utils: add/replace string equality macros It's more tidy and less error prone, since we use strcasecmp == 0 a lot. We replace strcmp == 0 by streq, strcasecmp == 0 by istreq, uStrCasePrefix by istreq_prefix and uDupString by strdup_safe. Signed-off-by: Ran Benita <ran234@gmail.com>
4f843c81 2012-07-24 13:24:59 Drop Xkbc prefix of text functions Not really needed and inconsistent. Signed-off-by: Ran Benita <ran234@gmail.com>
6cb98200 2012-07-24 13:15:40 Use xkb_mod_mask_t and xkb_mask_index_t throughout Signed-off-by: Ran Benita <ran234@gmail.com>
74be1762 2012-07-23 21:30:28 Remove alloc.{c,h} These functions are more appropriate elsewhere now. Signed-off-by: Ran Benita <ran234@gmail.com>
112cccb1 2012-07-23 16:03:34 Some atom related optimizations We often get a strdup'd string, just to pass it over the atom_intern and then immediately free it. But atom_intern then strdup's it again (if it's not interned already); so instead we can have the interning "steal" the memory instead of allocing a new one and freeing the old one. This is done by a new xkb_atom_steal function. It also turns out, that every time we strdup an atom, we don't actually modify it afterwards. Since we are guaranteed that the atom table will live as long as the context, we can just use xkb_atom_text instead. This removes a some more dynamic allocations. For this change we had to remove the ability to append two strings, e.g. "foo" + "bar" -> "foobar" which is only possible with string literals. This is unused and quite useless for our purposes. xkb_atom_strdup is left unused, as it may still be useful. Running rulescomp in valgrind, Before: ==7907== total heap usage: 173,698 allocs, 173,698 frees, 9,775,973 bytes allocated After: ==6348== total heap usage: 168,403 allocs, 168,403 frees, 9,732,648 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com>
7662397f 2012-07-23 21:18:18 types: fix canonical types copying Without the re-initialization, the copying fails. This wasn't noticed because this code practically never gets executed with ordinary keymaps. Signed-off-by: Ran Benita <ran234@gmail.com>
70e3e7e5 2012-07-21 15:39:18 xkbcomp: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
d659f2b4 2012-07-21 15:12:31 expr: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
87444fb9 2012-07-21 02:08:14 types: use new log functions Signed-off-by: Ran Benita <ran234@gmail.com>
36df40c3 2012-07-21 02:03:25 types: add keymap to KeyTypesInfo Signed-off-by: Ran Benita <ran234@gmail.com>
8b0e9f92 2012-07-20 13:07:30 utils: remove uTypedAlloc/Calloc Signed-off-by: Ran Benita <ran234@gmail.com>
250c925c 2012-07-17 17:05:28 types: use list instead of CommonInfo for KeyTypeInfo Signed-off-by: Ran Benita <ran234@gmail.com>
85826c3c 2012-07-18 17:53:27 Simplify HandleInclude functions Instead of special casing the first include, process it inside the loop as well. It works perfectly fine. Signed-off-by: Ran Benita <ran234@gmail.com>
861e6a17 2012-07-18 16:30:55 Remove haveSelf include feature When including a file from another file, its possible to do something like this: include "+some(other)+files" with the "+" or "|" in the beginning. What will happen then is that instead of processing the include files separately and then merging into the existing info, we instead start with the existing info and merge into it as we go, as if it was written explicitly before the first "+". It's not particulary clear what this may be useful for. Since it's not used by xkeyboard-config, not documented anywhere (and google doesn't bring up anything), completely untested and kind of ugly, remove this "feature". It most likely never been used. Signed-off-by: Ran Benita <ran234@gmail.com>
730c2bc3 2012-07-17 15:50:24 types: use list instead of CommonInfo in PreserveInfo Signed-off-by: Ran Benita <ran234@gmail.com>
85abd36b 2012-07-17 15:39:27 types: move global static tok_ atoms into KeyTypesInfo The atoms are context-dependent. Signed-off-by: Ran Benita <ran234@gmail.com>
dfa0929c 2012-07-16 22:15:43 Convert macros to inline functions Signed-off-by: Ran Benita <ran234@gmail.com>
c705a82d 2012-07-17 11:51:32 Remove unused 'groupInfo' in KeyTypeInfo Signed-off-by: Ran Benita <ran234@gmail.com>
1313af8f 2012-07-15 01:31:34 Get rid of xkb_key_names Signed-off-by: Ran Benita <ran234@gmail.com>
219243fe 2012-07-15 00:06:11 Get rid of xkb_client_map We don't make this distinction anymore, and the separate allocations just make it harder to reason about. Since we require that all of symbols, types, compat etc. be present, we should just put stuff directly in the keymap struct. Signed-off-by: Ran Benita <ran234@gmail.com>
9308a460 2012-07-17 10:20:15 Run source tree through uncrustify .uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
6c3e0811 2012-07-14 15:14:44 Convert missed enum merge_mode variables Signed-off-by: Ran Benita <ran234@gmail.com>
43bf4136 2012-07-14 15:19:12 Fix fileID mess A few problems here: * In e.g. keycodes.c the fileID field of the Info struct was never initialized to the id of the appropriate file, so it was always 0. There's some code which uses it, mostly for warnings. * Some of the fileID fields were unsigned char, which overflows several times, seeing as the ID in some of our tests can get > 1000 (because we reuse the context). * Some sign mismatches. * fileID vs file_id. Hopefully this fixes everything. I doubt this stuff had ever worked as intended, in xkbcomp or otherwise. Signed-off-by: Ran Benita <ran234@gmail.com>
dd85790c 2012-07-13 17:51:26 Move InitCanonicalKeyTypes to keytypes.c It's only got one call site and it's in keytypes.c, so move it there and make it static. Signed-off-by: Ran Benita <ran234@gmail.com>
0aaa84d8 2012-07-13 17:37:31 Remove xkb_kt_map_entry::active Takes the advice of acdad6058d52dc8a3e724dc95448300850d474f2 and removes this field, since its not used anymore now. Signed-off-by: Ran Benita <ran234@gmail.com>
3e65531f 2012-07-13 17:31:30 Move ComputeEffectiveMap code and avoid some duplication The ComputeEffectiveMap function is only called from keytypes.c, with the last argument NULL, so we can move it there and remove some code. The function XkbcVirtualModsToRealMods, of which the above is the only user, is already implemented more simply in compat.c, so make this one non-static and use it. This leaves src/xkb.c empty, so remove it. Signed-off-by: Ran Benita <ran234@gmail.com>
f0599675 2012-07-11 16:16:20 dump: add back kccgst names Readd the component names to the keymap->names struct. This is used when printing the component, e.g. xkb_keymap { xkb_keycodes "evdev+aliases(qwerty)" { instead of xkb_keymap { xkb_keycodes { This makes diffing against xkbcomp $DISPLAY a bit easier and is kind of useful anyway. Signed-off-by: Ran Benita <ran234@gmail.com>
213dcf68 2012-06-29 17:31:10 Use enum for merge mode The merge mode shows up in a lot of functions, so it's useful to give it a distinct type. Signed-off-by: Ran Benita <ran234@gmail.com>
48b4d30a 2012-06-29 17:05:33 Use enum for file types enums are nice for some type safety and readability. This one also removes the distinction between file type mask / file type index and some naming consistency. Signed-off-by: Ran Benita <ran234@gmail.com>
f637d35a 2012-06-27 00:22:31 Use void* instead of old style char* in CommonInfo functions Removes some annoying casts. Signed-off-by: Ran Benita <ran234@gmail.com>
bc50cdd4 2012-06-05 18:46:24 darray: some changes for convenience - Make darray_free also initialize the array back to an empty state, and stop worrying about it everywhere. - Add darray_mem, to access the underlying memory, which we do manually now using &darray_item(arr, 0). This makes a bit more clear when we actually mean to take the address of a specific item. - Add darray_copy, to make a deep copy of a darray. - Add darray_same, to test whether two darrays have the same underlying memory (e.g. if the struct itself was value copied). This should used where previously two arrays were compared for pointer equality. Signed-off-by: Ran Benita <ran234@gmail.com>
cb631c2d 2012-06-08 09:25:38 Unconstify a few string struct fields These were made const when the structs were exposed in the API. Now they are private and we shouldn't mess around with the UNCONSTIFY business. Signed-off-by: Ran Benita <ran234@gmail.com>
4daa34b5 2012-05-22 14:18:48 keytypes: use darray for level names Signed-off-by: Ran Benita <ran234@gmail.com>
c65a3596 2012-05-22 10:59:46 keytypes: use darray for xkb_kt_map_entry's Signed-off-by: Ran Benita <ran234@gmail.com>
c2ac3a2b 2012-05-22 08:07:52 keytypes: use darray for key types in the client map Signed-off-by: Ran Benita <ran234@gmail.com>
d15fa57a 2012-05-13 17:21:02 Remove FileHandler callback argument It's unneeded; the same function is always passed. Signed-off-by: Ran Benita <ran234@gmail.com>
e7bb1e5f 2012-05-09 15:03:11 Shorten context to ctx (This breaks the API.) "context" is really annoying to type all the time (and we're going to type it a lot more :). "ctx" is clear, concise and common in many other libraries. Use it! Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fix for xkb -> keymap change.]
cdd2906d 2012-05-09 13:50:05 Make the context available for XkbcAtomText And rename the function to xkb_atom_text. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb -> keymap.]
8d680e80 2012-05-09 12:01:03 Make the context available for XkbcAtomGetString In preparation of contextualizing atom handling. Since we touch every function call, we also rename the function to xkb_atom_strdup to match xkb_atom_intern, and be more descriptive. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb -> keymap.]
c117318f 2012-05-09 11:47:20 Make the context available to xkb_intern_atom In preparation of contextualizing the atom table. Since we touch every function call, also rename the function to xkb_atom_intern, to match better with the rest (which will also be renamed). Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fixed for 'xkb' -> 'keymap'.]
38cb6390 2012-05-09 15:15:30 Change all 'xkb' xkb_keymap names to 'keymap' To make it a bit more clear what it actually is. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
33273304 2012-05-08 13:57:07 Rename xkbcomp/misc.h to xkbcomp-priv.h and use it The include dependencies were quite convoluted, where you change the order and get a ton of errors. Instead, change one file to act as the internal interface for the xkbcomp files, and make every file use it. Also drop the pointless "xkb" prefix to file names. Signed-off-by: Ran Benita <ran234@gmail.com>
dccdf32c 2012-05-08 01:08:07 Refactor Compile<component> functions The error handling was not ideal, so unify it. Also makes the functions a bit easier to read. Signed-off-by: Ran Benita <ran234@gmail.com>
12b3495d 2012-04-11 01:55:50 Remove unused 'which' and 'merge' arguments Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb_desc -> xkb_keymap changes.]
a641a185 2012-04-06 03:38:55 Use stdbool.h 'Cause defining your own True and False is so 1990's. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fixed for xkb_desc -> xkb_keymap changes.]
a39ed85f 2012-04-05 11:24:39 Fix formatting in xkbcomp headers Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Fixed for xkb_desc -> xkb_keymap change.]
ef88c7ef 2012-04-03 15:14:16 Rename xkb_desc to xkb_keymap struct xkb_desc was just a hangover from the old XkbDescRec, which isn't a very descriptive name. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
034ffce6 2012-03-27 17:22:35 Use xkb_contexts in keymap compilation Primarily for the include path, but also for the logging in future. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
d3908b63 2012-03-24 12:33:28 Define our own None atom value Since we define our own xkb_atom_t type, it makes sense not to use the X11/X.h None value. This way we can also remove a lot of X11 includes. Signed-off-by: Ran Benita <ran234@gmail.com>
2165e16e 2012-03-24 02:36:11 Fix all -Wsign-compare warnings i.e comparison of signed and unsigned values. These are mostly harmless but fixing them allows to compile cleanly with -Wextra. Signed-off-by: Ran Benita <ran234@gmail.com>
f08ce9b7 2012-03-24 00:26:12 Use strcasecmp consistently instead of uStrCaseCmp There's no use calling the same thing by a different name. Signed-off-by: Ran Benita <ran234@gmail.com>
3104a8ef 2012-03-24 00:12:08 Move utility macro from XKBcommonint.h to utils.h And merge all the similar ones into the same name. The u* prefix is chosen over the _Xkb prefix because it has more uses throughout the codebase. But It should now be simple to choose a nice prefix and stay consistent. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: fixed for the case where we have strcasecmp]
1b17708c 2012-03-24 02:33:18 Fix incorrect usage of && instead of & Signed-off-by: Ran Benita <ran234@gmail.com>
a0e756fd 2012-03-09 19:09:25 Introduce xkb_atom_t type Signed-off-by: Daniel Stone <daniel@fooishbar.org>
731e5c40 2012-03-09 18:53:47 Stringify public name types Ensure that all names under xkb_desc are strings, rather than atoms. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
b28823cc 2012-03-09 16:04:00 Remove KcCGST names from the map Signed-off-by: Daniel Stone <daniel@fooishbar.org>
ed18e65e 2012-03-05 15:07:28 Merge remote-tracking branch 'ran/fixes-cont' Conflicts: src/xkbcomp/expr.c Signed-off-by: Daniel Stone <daniel@fooishbar.org>
65e1ff2f 2012-03-05 15:00:39 Merge remote-tracking branch 'ran/fixes'
889a299e 2012-03-02 14:49:36 Free XkbFile's when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>
c50c87bc 2012-03-01 21:26:25 Don't leak the various *Info's names when overriding them Signed-off-by: Ran Benita <ran234@gmail.com>
baf6a677 2012-03-02 22:34:14 Remove unused global type tokens Signed-off-by: Ran Benita <ran234@gmail.com>
4bc839ab 2012-02-29 20:50:17 Use memset instead of bzero Signed-off-by: Ran Benita <ran234@gmail.com>
a3e40917 2012-03-01 23:43:51 Remove return's at the end of void functions Signed-off-by: Ran Benita <ran234@gmail.com>
f278cea1 2012-02-29 20:25:11 Remove all uses of the register keyword Signed-off-by: Ran Benita <ran234@gmail.com>
6a34e4e1 2012-02-29 19:56:39 Don't check for NULL before free() Signed-off-by: Ran Benita <ran234@gmail.com>
f3e4335f 2012-02-24 16:07:17 Fix all constness warnings These are all trivial/obvious fixes which clear a bunch of warnings. Signed-off-by: Ran Benita <ran234@gmail.com>
cca1c050 2012-02-24 16:03:44 Fix possible null dereferences Fix all reported null dereferences from clang-analyzer. There seems to be one false negative (in file indicators.c), but it is fixed anyway. Signed-off-by: Ran Benita <ran234@gmail.com>
a0dd0526 2012-02-25 11:46:12 Remove unused includes of "tokens.h" Signed-off-by: Ran Benita <ran234@gmail.com>
90f04e04 2012-02-20 18:07:29 Perform bounds checking in ExprResolveLevel Both callers perform the same bounds check, so move it into ExprResolveLevel itself. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
3431a089 2012-02-20 15:37:53 Introduce ExprResolveLevel helper Which returns an integer representing the level number represented by the given expression. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
26285a7b 2012-02-20 14:15:08 Remove priv arguments from ExprResolveString They've never been used. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
67605d2c 2012-02-20 13:32:09 Introduce ExprResolveVModMask Which is just a slightly more typesafe wrapper around the chained ExprResolveModMask everyone was using earlier. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
c45cdb0c 2012-02-16 00:22:11 Still more memory leak fixes Signed-off-by: Daniel Stone <daniel@fooishbar.org>
1a6c3807 2012-02-15 15:58:14 vmod: Pass xkb_desc explicitly to vmod functions Some error paths don't set info->xkb correctly, so just do like most utility functions and pass the xkb_desc explicitly. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
a63e82be 2010-12-17 21:14:54 Rename XkbcInternAtom() to xkb_intern_atom() and export Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
73ca959d 2010-09-27 16:05:52 Dead code removal and static markup Signed-off-by: Adam Jackson <ajax@redhat.com>
9f602686 2010-07-01 14:35:24 Pull in enough structs and defines from XKBstr.h to only need XKB.h We want to move away from sharing implementation structs and let libX11 and libxkbcommon use each their own set of structs.
e10e16ad 2010-06-30 17:20:56 Constify XkbcAtomText() Atoms aren't mutable and this lets us put tbGetBuffer() back in the box.
399d4bd6 2010-06-28 06:58:01 Drop malloc wrappers