src/xkbcomp/keycodes.c


Log

Author Commit Date CI Message
Ran Benita 3fbf4ce3 2012-07-16T21:28:25 keycodes: use list instead of CommonInfo in IndicatorNameInfo Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4bf987e5 2012-07-16T21:25:00 keycodes: use list instead of CommonInfo in AliasInfo Always pass around the KeyNamesInfo which contains the list head. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita cc8b0682 2012-07-16T17:53:46 Move alias.c functions into keycodes.c They are only used in this file. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita dfa0929c 2012-07-16T22:15:43 Convert macros to inline functions Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 7d9f0313 2012-07-15T13:00:04 Get rid of struct xkb_key_name Just embed it directly. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e8a6a5f0 2012-07-15T10:38:05 Add common xkb_key struct Instead of having a million arrays from the keycode to various key-specific info in the keymap, add a single struct xkb_key to hold all of the data for the key in one object. This way we can pass it around, do some refactoring and make the code simpler. It's also nice to see everything in one place. The keys array is still indexed by keycode, which is suboptimal because there may be a lot of holes (i.e. unused keycodes between min_key_code and max_key_code). By the end of this series it would be abstracted enough to replace it by a hash table or similar if there's ever a need. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 81d029f5 2012-07-15T11:52:54 Replace xkb_keycode_t 'key' variable name by 'kc' We want to reserve the name 'key' for something else. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 1313af8f 2012-07-15T01:31:34 Get rid of xkb_key_names Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 50fef8eb 2012-07-15T00:46:31 Get rid of xkb_indicator Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 9308a460 2012-07-17T10: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>
Ran Benita 6c3e0811 2012-07-14T15:14:44 Convert missed enum merge_mode variables Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 43bf4136 2012-07-14T15: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>
Ran Benita 0765064b 2012-07-13T18:34:11 Remove MERGE_ALT_FORM merge mode The mode comes from the "alternate" keyword, which is unused in xkeyboard-config and mostly undocumented. Its purpose is to allow to assign the same key name to multiple key codes, which is not allowed otherwise (and doesn't make much sense). The xkblib specification implies that this was part of the overlay functionality, which we also no longer support. If we do encounter this keyword, we just treat it as MERGE_DEFAULT. The keycodes.c code will detect a collision and will ignore all but the first key code (and the error count is not incremented). Some peripheral code is also removed as a result. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f0599675 2012-07-11T16: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>
Ran Benita 213dcf68 2012-06-29T17: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>
Ran Benita 48b4d30a 2012-06-29T17: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>
Ran Benita f637d35a 2012-06-27T00:22:31 Use void* instead of old style char* in CommonInfo functions Removes some annoying casts. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita bc50cdd4 2012-06-05T18: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>
Ran Benita cb631c2d 2012-06-08T09: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>
Daniel Stone a3ae0e84 2012-05-29T16:12:54 Pass merge down through indicator creation To avoid using potentially undefined memory. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 89c5e886 2012-05-22T15:45:42 keycodes: use darray in KeyNamesInfo Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 374b0c98 2012-05-22T08:39:09 alloc: use darray in xkb_key_names Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita e7bb1e5f 2012-05-09T15: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.]
Ran Benita cdd2906d 2012-05-09T13: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.]
Ran Benita 8d680e80 2012-05-09T12: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.]
Ran Benita c117318f 2012-05-09T11: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'.]
Daniel Stone 38cb6390 2012-05-09T15: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>
Ran Benita 33273304 2012-05-08T13: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>
Ran Benita dccdf32c 2012-05-08T01: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>
Ran Benita 62a75dc1 2012-04-10T23:08:49 Remove unused stuff from XKBcommonint.h Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 12b3495d 2012-04-11T01:55:50 Remove unused 'which' and 'merge' arguments Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb_desc -> xkb_keymap changes.]
Ran Benita a641a185 2012-04-06T03: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.]
Daniel Stone ef88c7ef 2012-04-03T15: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>
Daniel Stone 034ffce6 2012-03-27T17: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>
Ran Benita d3908b63 2012-03-24T12: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>
Ran Benita 2165e16e 2012-03-24T02: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>
Ran Benita 813ddf25 2012-03-24T00:29:33 Silence -Wcast-qual warnings There are some cases where we must free a string with a const qualifier. Add a macro UNCONSTIFY to trick the compiler into silencing the warning in the cases where we know what we're doing. Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f08ce9b7 2012-03-24T00: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>
Ran Benita 3104a8ef 2012-03-24T00: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]
Daniel Stone a0e756fd 2012-03-09T19:09:25 Introduce xkb_atom_t type Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 731e5c40 2012-03-09T18: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>
Daniel Stone ed5c6c17 2012-03-09T16:26:34 Remove geometry support, again It still parses geometry, but happily throws it away. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone b28823cc 2012-03-09T16:04:00 Remove KcCGST names from the map Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Ran Benita 5c40bee6 2012-02-29T21:57:15 Don't leak the "minimum"/"maximum" string Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita d67e73bd 2012-03-01T00:10:37 Don't leak KeyNamesInfo Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita c50c87bc 2012-03-01T21:26:25 Don't leak the various *Info's names when overriding them Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 889a299e 2012-03-02T14:49:36 Free XkbFile's when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita a3e40917 2012-03-01T23:43:51 Remove return's at the end of void functions Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 4bc839ab 2012-02-29T20:50:17 Use memset instead of bzero Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f278cea1 2012-02-29T20:25:11 Remove all uses of the register keyword Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 6a34e4e1 2012-02-29T19:56:39 Don't check for NULL before free() Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita f3e4335f 2012-02-24T16: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>
Ran Benita cca1c050 2012-02-24T16: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>
Ran Benita a0dd0526 2012-02-25T11:46:12 Remove unused includes of "tokens.h" Signed-off-by: Ran Benita <ran234@gmail.com>
Daniel Stone 26285a7b 2012-02-20T14:15:08 Remove priv arguments from ExprResolveString They've never been used. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone fbb82199 2012-02-16T11:18:49 Respect explicit minimum/maximum keycodes Make sure we carry over an explicit minimum/maximum keycode setting, rather than just using the computed minimum/maximum; this got broken while changing the keycode range to be unsigned. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
Daniel Stone c45cdb0c 2012-02-16T00:22:11 Still more memory leak fixes Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 83f18b1c 2012-02-15T19:39:33 Fix xkbparse.y compilation Thanks to autotools happily building stale generated sources, I hadn't actually ever built my xkbparse.y changes. Fix that so it not only compiles, but works. This seems to parse long keycodes correctly, although I very much would not recommend testing this by declaring 0x1fffffff as your highest keycode. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 4e228511 2012-02-15T14:34:08 Introduce xkb_keycode_t for keycodes And use it consistently everywhere, including with a special long-safe internal keycode type, to ease the transition to large keycodes. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Kristian Høgsberg a63e82be 2010-12-17T21:14:54 Rename XkbcInternAtom() to xkb_intern_atom() and export Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Adam Jackson 73ca959d 2010-09-27T16:05:52 Dead code removal and static markup Signed-off-by: Adam Jackson <ajax@redhat.com>
Kristian Høgsberg 9f602686 2010-07-01T14: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.
Kristian Høgsberg 399d4bd6 2010-06-28T06:58:01 Drop malloc wrappers
Kristian Høgsberg 47d3b396 2010-06-28T06:50:12 Drop CARD32 and Opaque types
Daniel Stone 7257d4c8 2010-06-21T14:28:34 Use CARD32 instead of Atom, move geom headers in Use CARD32 instead of Atom/KeySym/et al to avoid type size confusion between server and non-server code; relatedly, move the geometry headers in from kbproto, so every non-simple type (i.e. structs containing nothing more than basic types) is now copied into xkbcommon. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone 4346e006 2010-06-15T16:41:10 xkbcomp: keycodes: Silence gcc warnings It was right to warn us: some of these were actually bogus. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Daniel Stone a22386d4 2010-06-15T15:23:23 xkbcomp: Don't leak atom text and string exprs, again Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Dan Nicholson 6a84a34d 2009-04-08T07:46:25 Remove all non-public API from XKBcommon.h header The noble intention was to expose all the new API and new generic types in the split out kbproto headers through XKBcommon.h. It turns out that would be a massive amount of work in the server. Someday, but first just wedging in XkbCompileKeymap* would be good. Most of the API is in new internal xkb*.h headers. In order to allow the XKBcommon.h header to be used from the server, we can't pull in other headers from kbproto since the server has its own copies. However, types that are different (XkbDescRec, XkbAction) still have Xkbc equivalents here, and I think they should be used in the server.
Dan Nicholson 5889cef8 2009-04-05T20:27:35 Require strdup and remove utils wrapper This kills a couple warnings from using the uStringDup wrapper. If you don't have strdup on your platform, you have bigger issues.
Dan Nicholson 5c910623 2009-04-04T09:19:51 Remove trailing spaces in source files
Dan Nicholson a27e56b6 2009-03-31T07:21:20 xkbcomp: Remove duplicated macros
Dan Nicholson a59ce8f5 2009-03-28T15:24:06 Drop another unneeded format argument Almost cleared of XkbMessage...
Dan Nicholson 2671b777 2009-03-28T14:06:26 Add more *Text functions from xkbfile This should cover all the usage in xkbcomp. The format arguments were dropped except for the special case of XkbModMaskText, which needs to write in XkbCFile format in HandleVModDef. This was just changed to a Bool to avoid the need for the macros in XKBfile.h. The function prefixes have been renamed to be unique from xkbfile.
Dan Nicholson b9335d58 2009-03-28T14:09:36 Kill off usage of Display The use of Display in xkbcomp always boiled down to passing it to XkbInternAtom and XkbAtomGetString. This shouldn't be a problem here.
Dan Nicholson 39d7be43 2009-03-28T11:45:05 xkbcomp: Use xkbcommon allocation functions s/XkbAlloc/XkbcAlloc/ so we don't know XKBlib.
Dan Nicholson 8544cde5 2009-03-28T06:56:26 xkbcomp: Drop unused Display argument in Atom functions The xkbcommon Atom implementation doesn't take Display into account.
Dan Nicholson 18337008 2009-03-27T20:58:27 libxkbcomp: Use the internal Atom implementation s/XkbInternAtom/XkbcInternAtom/ and s/XkbAtomGetString/XkbcAtomGetString/
Dan Nicholson 37769b5a 2009-03-27T20:01:32 libxkbcomp: s/XkbDescPtr/XkbcDescPtr/ We need to use the keyboard description structure from XKBcommon.h since it doesn't have the Display field.
Dan Nicholson dd25bbc9 2009-03-27T19:54:50 libxkbcomp: Eradicate XkbFileInfo usage The only real usage was in the frontend to generate a .xkm file. The rest of the code just operated on the attached XkbDescPtr. Note that here we've replaced the usage of the defined field in CompileKeymap with the equivalent field in a XkbcDescPtr.
Dan Nicholson 0c1bbb05 2009-03-27T06:55:32 Import xkbcomp sources for CompileKeymap A copy of the xkbcomp sources (except the frontend) have been copied in to provide a means to compile a XkbDescPtr. This definitely doesn't build or do the right thing yet.