Log

Author Commit Date CI Message
Ran Benita d9317d5f 2012-11-05T21:50:38 keysym-utf: mark keysymtab array as static Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7891c917 2012-11-05T21: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>
Ran Benita fb201645 2012-11-04T16:07:30 Add some explanations on consumed modifiers This should hopefully clarify this somewhat subtle point to the uninitiated users. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 998c957a 2012-10-30T18: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>
Damien Lespiau 860fb171 2012-10-26T00:51:56 build: Require xorg macros 1.16 For XORG_TESTSET_CFLAG and XORG_MEMORY_CHECK_FLAGS. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Cc: Daniel Stone <daniel@fooishbar.org>
Damien Lespiau 2f7385d0 2012-10-26T00:51:46 build: Make autoreconf honour ACLOCAL_FLAGS When running autoreconf, it's possible to give flags to the underlying aclocal by declaring a ACLOCAL_AMFLAGS variable in the top level Makefile.am. Putting ${ACLOCAL_FLAGS} there allows the user to set an environment variable up before running autogen.sh and pull in the right directories to look for m4 macros, say an up-to-date version of the xorg-util macros. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Cc: Daniel Stone <daniel@fooishbar.org>
Ran Benita 94155878 2012-10-29T20:20:51 test/keyseq: add test for setting depressed group Tests the SetGroup action is working properly. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7261f404 2012-10-29T01: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>
Ran Benita a51ee704 2012-10-26T16: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>
Ran Benita b935d361 2012-10-26T16:15:27 doc: fix wrong comment Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita ee6f3f28 2012-10-26T16: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>
Ran Benita 92360016 2012-10-26T15:05:04 Makefile.am: move test.h to libtest_la_SOURCES Rather than EXTRA_DIST, where it doesn't belong. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 22b868fd 2012-10-26T15:00:33 Makefile.am: split sed script into multiple lines To make it visible on one screen. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0a5e9d90 2012-10-26T14:43:15 configure.ac: don't tramp on user's CFLAGS The configure test shouldn't touch CFLAGS, because they come last on the command line and allow to users to override settings if needed. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a851ef1e 2012-10-26T14:23:07 configure.ac: add explicit PKG_PROG_PKG_CONFIG We still use pkg-config to get the xkb_base variable from xkeyboard-config, but we removed all of the other PKG_ macro calls. This still works now, because XORG_DEFAULT_OPTIONS runs it somehow. But we shouldn't rely on it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c1c1b720 2012-10-24T23:27:40 test: add key processing benchmark This runs a bunch of random keys against xkb_state_update_key() and xkb_state_key_get_one_sym(), in a fairly unintelligent way. It might be nice to check when modifying this code path, or changing it, to see things haven't slowed down considerably. However, given the numbers this benchmark gives, it is pretty clear that we are not going to be the bottleneck for anything. So this can more-or-less be ignored. Incidentally, this also turned out to be a poor man's fuzzer, because it turned up the fix in the previous commit. Maybe we should consider beefing it up with an actual 'break stuff' intention and running it as part of 'make check'. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6f093ad5 2012-10-24T23: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>
Daniel Stone a35d3223 2012-10-24T17:38:28 More README Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 202f5606 2012-10-24T17:00:24 README updates Good thing I didn't check this before I made a release. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 5be22ad6 2012-10-24T00:34:07 Bump to 0.2.0 Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 3eac7599 2012-10-22T18:14:39 doc: various fixes Just moving around / fixing syntax / grammar. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 33bba368 2012-10-23T10:25:26 doc: move include_path functions to a separate group These are 'special intrest' function, like the logging functions, so it's nice to have them in their own logical group. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e24ed49c 2012-10-23T10:05:16 test/interactive: use num_layouts_for_key() This is the more appropriate for a specific key (also considering the num_layouts() is a bit of a made-up value). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f76859bc 2012-10-23T09:58:11 keymap: use plain array for keymap->group_names Again it is not resized. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 867992cd 2012-10-23T17: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>
Daniel Stone 6bc9480a 2012-10-24T00:58:51 autogen: use --force instead of --symlink --force copies and installs all the autotools support files, rather than making symlinks, which can sometimes break things when upgrading your system autotools. This is what xserver does. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 0c98237f 2012-10-22T21:46:43 Change update_mask arguments to read 'depressed' instead of 'base' Just to be consistent, as we use 'depressed' everywhere else in the API. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a807494e 2012-10-22T21:16:35 test/interactive: add option to show state changes Pass -c to see. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4b81c9f3 2012-10-22T21: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>
Ran Benita 550cb24d 2012-10-22T19: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>
Ran Benita 6a94b122 2012-10-22T20: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>
Ran Benita 3a5f87b8 2012-10-22T17:53:44 doc: add note about X11 vs. extended keycodes Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 0779d9dc 2012-10-21T17:13:25 Silence a couple of warnings These appear to come and go randomly. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bb82759c 2012-10-18T23: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>
Ran Benita e6946ae2 2012-10-18T22:55:17 Remove a couple more uses of static char buffers Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 714e95e1 2012-10-18T22: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>
Ran Benita eb748ab6 2012-10-18T21: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>
Ran Benita 5d9a5cb0 2012-10-17T19: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>
Ran Benita 17985511 2012-10-16T21:09:33 utils: add and use ARRAY_SIZE macro Signed-off-by: Ran Benita <ran234@gmail.com>
David Herrmann 7b3bd11f 2012-10-16T16: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>
Ran Benita 5fff637e 2012-10-16T16: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>
Ran Benita 3477d9e4 2012-10-05T16: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>
Ran Benita f43b33c0 2012-10-13T13: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>
Ran Benita 523e46f4 2012-10-12T10:15:43 Change log env vars to XKB_LOG_LEVEL/VERBOSITY A bit more consistent and descriptive. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bde066b9 2012-10-11T18:13:56 doc: use JAVADOC_AUTOBRIEF Don't have to type @brief all the time. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 89523789 2012-10-11T21:50:21 ast: simplify AppendStmt Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bbf388ec 2012-10-11T16:54:17 Make xkb_keymap_num_leds return the index range instead of active count Currently xkb_keymap_num_leds() returns a count of valid (settable) leds. Because the indexes might be non-consecutive, and some leds might not be settable, it is incorrect to use this function for iterating over the leds in the keymap. But this is the main use case of this function, so instead of the current behavior we adapt the function to the use case by making it return the needed range of iteration. The caller needs to handle invalid intermittent indexes, though. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita b6ddd105 2012-10-11T14:05:49 keymap: rename keymap->sym_interpret -> sym_interprets This can be a bit confusing. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e43f53a6 2012-10-11T14:03:03 compat: add documentation for interpret's Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 90b1984c 2012-10-11T12:07:43 compat: don't forget to copy XKB_MATCH_NONE interpret's Commit a8d462e3669b1790dfad75836d5ec59e390392ef accidentally removed the OR with XKB_MATCH_NONE. It is in fact unused though. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a86fa17a 2012-10-10T21:01:15 build: change to AM_MAINTAINER_MODE([enable]) Disabled maintainer mode is annoying, we have no reason to do it. The old behavior can still be had with --disable-maintainer-mode. See: http://lists.x.org/archives/xorg-devel/2012-September/033757.html http://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/maintainer_002dmode.html Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2c188833 2012-10-10T20:53:26 build: honor $NOCONFIGURE in autogen.sh Using NOCONFIGURE=1 ./autogen.sh can prevent it from running ./configure on its own, which is sometimes useful. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a05fbc17 2012-10-10T19:14:35 stringcomp: test compilation of a dump of a keymap created from rules This would have caught the regression fixed in 2ac319c. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9197eb0f 2012-10-10T19:08:01 Remove the XKB_NUM_INDICATORS limit Use a darray instead of a static array of size 32. We still enforce XKB_MAX_LEDS because of the size of xkb_led_mask_t. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f3732d83 2012-10-10T17:51:06 keymap: don't use darray for keymap->keys It's never resized. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bdea377c 2012-10-10T17:30:15 Rename XKB_NUM_GROUPS to XKB_MAX_GROUPS This is a more appropriate name now. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1dbb2c4a 2012-10-10T12:11:43 keycodes: refactor AddIndicatorName Make it shorter and fix the XXX. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2f4db8a9 2012-10-10T09:47:31 keymap, state: don't assume led index < xkb_keymap_num_leds xkb_keymap_num_leds() returns the number of leds that have any possibility of being set. Even if a led is defined but can not be set in any way, it is not counted. In a few places currently we assume that led indexes are smaller than this number, which is wrong both for the above reason and for the fact that the xkb format actually allows explicitly setting the indicator index, which means that the indexes might be non-consecutive. We don't really have good API to iterate on leds, now, because xkb_keymap_num_leds is pretty useless. To work around that we use sizeof(xkb_led_mask_t) * 8. This makes the "Group 2" led work (try switching to a layout other than the first in test/interactive). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9179fed7 2012-10-09T20:48:35 keysym: fix xkb_keysym_is_upper/lower() to work properly Our current code (taken from the xserver) doesn't handle unicode keysyms at all, and there seem to be some other changes compared to libX11, which is what xkbcomp uses. So we just copy the code that does that from libX11. It would be much better to not have to hardcode unicode tables like that, but it's probably better than dealing with glibc locale stuff for now. It also doesn't affect our binary size much. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 2ac319c5 2012-10-08T22:11:18 compat: fix bad interpret predicate mods "all" calculation Commit 9984d1d03cd78eb636c75cc2bbd2d240dc1dd72f changed the type of interpret->mods to xkb_mod_mask_t, but this bit of code assumes that the type is uint8_t. This code is not usually run (for example by our tests), but when it does keymap-dump would print out all of the modifiers (including the virtual ones) which causes recompilation of the output to fail miserably. https://bugs.freedesktop.org/show_bug.cgi?id=55769 Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9984d1d0 2012-10-06T21:37:43 keymap: use xkb_mod_mask_t for interpret->mods and modmap These are both real modifier masks, but we keep this information only in the program logic now so when we change it we don't have to worry about the type. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a1124b59 2012-10-06T17:42:21 expr: unify the real and virtual modifier functions This again pushes the mod type annotation to the original call site, to make it easier to grep to see where the real/virtual distinction matters. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 39232e6d 2012-10-06T17:21:09 Remove now-unneeded mod type annotations Most of the mod type annotations can now be changed to MOD_BOTH, because if you pass a mask which can only contain real mods in the first place to e.g. ModMaskText, then MOD_REAL and MOD_BOTH will give the same result. In the cases where MOD_BOTH is only ever the argument, we just remove it. What's left is where it really "matters". Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e6e3bda3 2012-10-06T17:00:26 expr: share code for modifier functions We can make more use of the functions in text.c now and remove some cruft. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fcceeeaf 2012-10-06T21:26:01 symbols: refactor AddModMapEntry It really asks for it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6d74e66e 2012-10-06T17:53:53 Replace 0xff with MOD_REAL_MASK_ALL To make it easier to see where it's used. The name is just to match MOD_REAL. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9ebd2f67 2012-10-06T14:34:17 text: explicitly take mod_type in mod functions This essentially "tags" each invocation of the functions with the modifier type of the argument, which allows for easy grepping for them (with the aim being, to remove anything but MOD_BOTH). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6d580127 2012-10-06T14:15:06 text: share code for modifiers Add static common functions which take enum mod_type, and change the existing ones to use them. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 424de613 2012-10-05T22:46:21 Keep real and virtual mods in the same table in the keymap We change the keymap->vmods array into keymap->mods, and change it's member type from struct xkb_vmod to struct xkb_mod. This table now includes the real modifiers in the first 8 places. To distinguish between them, we add an enum mod_type to struct xkb_mod. Besides being a more reasonable approach, this enables us to share some code later, remove XKB_NUM_CORE_MODS (though the 0xff mask still appears in a few places), and prepares us to flat out remove the distinction in the future. This commit just does the conversion. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1005b320 2012-10-05T22:07:04 Don't use shifted virtual modifier masks Modifier masks can be confusing in some places. For example, key->vmodmap only contains virtual modifiers, where the first is in position 0, the second in 1 etc., while normally in a xkb_mod_mask_t the virtual modifiers start from the 8th (XKB_NUM_CORE_MODS) position. This happens in some other places as well. Change all of the masks to be in the usual real+virtual format, and when we need to access e.g. keymap->vmods we just adjust by XKB_NUM_CORE_MODS. (This also goes for indexes, e.g. interpret->virtual_modifier). This makes this stuff easier to reason about. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6974e1f9 2012-10-05T21:40:49 expr: don't expose LookupModIndex The Lookup* functions should remain a private implementation detail of the expr.c file. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita aed3140e 2012-10-05T21:06:34 Remove VModInfo for now VModInfo currently is only used to track which virtual modifiers were declared in the file which owns the VModInfo. This, in turn, is only used in ResolveVirtualModifier, which in turn is only used to resolve the virtualModifier field in an interpret statement (compat.c). In other words, it is used to ensure that interprets can only use a vmod which was declared in the same map. We remove this now, because it doesn't do much and distracts from other changes; we will later re-add it properly. Specificly, we will make it so that virtual modifiers are not the exception in that they modify the keymap directly, instead of keeping the changes in some *Info struct and commiting them to the keymap at the end of the compilation. (This is bad because if a vmod is added to the keymap, and then the compilation of this specific file fails, the change sticks around nonetheless). Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 9a2ce2a5 2012-10-05T20:17:54 vmod: don't allow to add a vmod with the name of a real mod Otherwise strange thing might ensue. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita b65980cc 2012-10-05T15:10:41 state: don't needlessly fetch the xkb_key It's a leftover. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1f4009d4 2012-10-04T19:44:47 vmod: remove merge argument from HandleVModDef It's unused and unneeded. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a75989b9 2012-10-04T12:39:22 Omit struct '_Name' from non-recursive struct typedefs Just a pet peeve. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1401b0fb 2012-10-04T12:27:06 expr: don't allow "none" in LookupModIndex LookupModMask handles this before calling LookupModIndex, and the only other user in symbols.c doesn't handle this return value at all. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 239a5be1 2012-10-04T11:48:56 keysym-utf: make keysym->unicode table a bit smaller Saves a few kbytes, and unlikely to change. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita dd29b14e 2012-10-03T12:57:53 Remove the XKB_NUM_VIRTUAL_MODIFIERS limit Turn the virtual modifiers arrays in the keymap to a single darray, which doesn't use this limit. The number of virtual modifiers is still limited by the size of xkb_mod_mask_t, so we make sure not to go over that. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 8016c6f4 2012-10-03T20:21:05 state: simplify xkb_state_mod_index_is_active Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e5b6055b 2012-10-03T20:16:09 state: don't ignore type argument in xkb_state_mod_*_are_active Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1a6b1e07 2012-10-03T19:41:22 state: fix bad EFFECTIVE check in *_is_active() This is a regression introduced in ed78fbcb30888cbfc6cd00. XKB_STATE_EFFECTIVE is just a OR of the other states, so using & here is completely wrong. So test/state shows for example: dumping state for LCtrl down: group English (US) (0): effective depressed latched locked mod Control (2): depressed latched locked dumping state for LCtrl + RAlt down: group English (US) (0): effective depressed latched locked mod Control (2): depressed latched locked mod Mod1 (3): depressed latched locked dumping state for RAlt down: group English (US) (0): effective depressed latched locked mod Mod1 (3): depressed latched locked dumping state for Caps Lock: group English (US) (0): effective depressed latched locked mod Lock (1): depressed latched locked led Caps Lock (0): active dumping state for Alt-Shift-+ group English (US) (0): effective depressed latched locked mod Shift (0): depressed latched locked mod Mod1 (3): depressed latched locked which is bogus. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita fe1faa14 2012-10-03T20:08:13 Use our types instead of int/uint32_t in a few places Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1c880887 2012-09-30T11:55:11 Don't scan and parse useless maps One physical xkb file may (and usually does) contain multiple maps. For example, the us symbols file contains a map for every variant. Currently, when we need a map from a file (specific or default), we parse the entire file into a list of XkbFile's, find the map we want and discard the others. This happens for every include statement. This is a lot of unnecessary work; this commit is a first step at making it better. What we do now is make yyparse return one map at a time; if we find what we want, we can stop looking and avoid processing the rest of the file. This moves some logic from include.c to parser.y (i.e. finding the correct map, named or default). It also necessarily removes the CheckDefaultMap check, which warned about a file which contains multiple default maps. We can live without it. Some stats with test/rulecomp (under valgrind and the benchmark): Before: ==2280== total heap usage: 288,665 allocs, 288,665 frees, 13,121,349 bytes allocated compiled 1000 keymaps in 10.849487353s After: ==1070== total heap usage: 100,197 allocs, 100,197 frees, 9,329,900 bytes allocated compiled 1000 keymaps in 5.258960549s Pretty good. Note: we still do some unnecessary work, by parsing and discarding the maps before the one we want. However dealing with this is more complicated (maybe using bison's push-parser and sniffing the token stream). Probably not worth it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 26e685da 2012-09-30T14:27:37 scanner: don't strdup the file name We don't modify it and there's no way to modify the original in the scanner_extra life time. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita ee4ab30e 2012-09-28T10:15:27 scanner: share code in XkbParse{File,String} Some refactoring to prepare for changes in the parse() function. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 471ebad6 2012-09-30T14:23:58 scanner: remove uselss 'last symbol' error message It never shows something useful. Besides, you already get the line number, which is enough. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 22684cd1 2012-09-30T10:50:38 parser: remove XkbCompMapList rule This rule allows you to put several xkb_keymaps in one file. This doesn't make any sense: only the default/first can ever be used, yet the others are fully parsed as well. Different keymaps should just be put in different files. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3b5ada23 2012-09-30T10:33:59 parser: remove XkbConfig rule This rule allows you to write file maps as: xkb_keycodes <BLA> = 5; [...] instead of the usual format which is: xkb_keycodes { <BLA> = 5; [...] }; This is not documented, It is also not used in xkeyboard-config, and I have never run into it otherwise. It also only allows one map per file. It *might* be used in some obscure place, but probably nothing we should care about; the simplified grammar is more useful for us now. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 693a1f57 2012-09-30T10:42:30 test/interactive: allow -k to get any absolute path Instead of looking for a keymap in test/data. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 26cc2f40 2012-09-30T14:17:08 Don't use %z printf format Some libc's don't support it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita ed1203df 2012-09-30T12:42:44 rules: always initialize idx variable gcc didn't catch this one. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 92e07726 2012-09-27T20:16:12 test: add keycodes files which map directly to evdev codes This is a proof-of-concept for the long key names. The keycodes in the file evdev-xkbcommon are autogenerated from linux/input.h, and uses the names given there; all of the previous names are aliased to the new names, so they continue to work with the symbols files, etc. You can try it with 'sudo ./test/interactive -r evdev-xkbcommon -n 0' The -n 0 means that we don't offset the evdev scan codes - just feed them directly. The -r evdev-xkbcommon just means to use a new rules file which makes us use the new keycodes file. (The only problem I can see is with the MENU and LSGT names which has some conflicts). Maybe some day xkeyboard-config could ship something similar, so that the 8 offset is unneeded. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 32c19f4b 2012-09-27T21:30:29 keymap-dump: make it look better with long key names Not worth messing around with too much, just make it legible. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 984ebf98 2012-09-27T20:44:16 test/interactive: allow to set evdev offset If we want to test a keymap without the usual 8 offset. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 41a7fed3 2012-09-27T19:21:26 Fix type of keycode in parser and ast For some reason keycodes were listed under mapFlags in the yylval union. Fix it and some sanity checks. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 3b389b15 2012-09-27T18:49:13 Don't limit key names to 4 characters Currently you can't give a key in xkb_keycodes a name of more than XKB_KEY_NAME_LENGTH (= 4) chars. This is a pretty annoying and arbitrary limitation; it leads to names such as <RTSH>, <COMP>, <PRSC>, <KPAD> etc. which may be hard to decipher, and makes it impossible to give more standard names (e.g. from linux/input.h) to keycodes. The purpose of this, as far as I can tell, was to save memory and to allow encoding a key name directly to a 32 bit value (unsigned long it was). We remove this limitation by just storing the names as atoms; this lifts the limit, allows for easy comparison like the unsigned long thing, and doesn't use more memory than previous solution. It also relieves us from doing all of the annoying conversions to/from long. This has a large diffstat only because KeyNameText, which is used a lot, now needs to take the context in order to resolve the atom. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 53cfe8c3 2012-09-27T09:19:12 xkbcomp/keymap: use default interpret in ApplyInterpsToKey This makes the code easier to follow and does more explicitly what the xkblib spec says: If no matching symbol interpretation is found, the server uses a default interpretation where: sym = 0 flags = XkbSI_AutoRepeat match = XkbSI_AnyOfOrNone mods = 0 virtual_mod = XkbNoModifier act = SA_NoAction If a level doesn't have any keysyms, we don't apply anything to it. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 11df0632 2012-09-27T21:11:11 state: add missing const in get_one_sym Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 5aaf65b7 2012-09-27T23:27:49 Add xkb_state_key_get_one_sym The trivial wrapper around xkb_state_key_get_syms that every user to date has implemented. Signed-off-by: Daniel Stone <daniel@fooishbar.org>