Commit Graph

600 Commits (3e86ebca0684d90899f34c2add6b1474c464613f)

Author SHA1 Message Date
Ran Benita 5eb0a70e61 Don't use typeof
clang complains with the xorg-macros warning flags:
src/context.c:58:36: error: extension used [-Werror,-pedantic,-Wlanguage-extension-token]
                                   typeof(new_paths));

This was not entirely correct, too. So bring back the casts to the
results of the allocation macros; might as well make them a bit more
type safe.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:54 +01:00
Ran Benita fbfbf0aa4b Remove left over filecomp.sh file
Should have removed it in a previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:53 +01:00
Ran Benita 40b56b0fe3 Update .gitignore for automake 1.12
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:52 +01:00
Ran Benita a1e07fb6f6 Uncomment sections of test/rulescomp.c
Fixes an 'unused' warning. There seems to be nothing wrong with these
sections though, all the tests pass.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:50 +01:00
Ran Benita b41c77f8a8 Revert "Unconstify xkb_rules_names"
This reverts commit d007cd0a1f.

This is in fact more restrictive, because it breaks the (common) case
where the strings are const themselved, e.g. "evdev", "us", etc. As is
you must either duplicate the strings or suppress the warnings.

If the user needs to retain the non-const strings, he should instead
just keep them in some other struct and use xkb_rules_names just as
a temporary parameter for xkb_map_new_from_names. Mildly annoying but
acceptable.
2012-05-08 17:28:49 +01:00
Daniel Stone 9797c918ca Use AC_ARG_VAR for X11 header and XKB paths
And don't call pkg-config unless we need to.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 17:30:47 +01:00
Daniel Stone 70dfe166f8 Rename YYLTYPE to struct YYLTYPE
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 14:23:46 +01:00
Ran Benita 409ec8a12e Merge src/alloc.c and src/malloc.c
The two files do exactly the same sort of things, without any discernible
reason for splitting them.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_desc -> xkb_keymap changes.]
2012-05-01 13:59:23 +01:00
Ran Benita aff531fb4d Remove unused stuff from xkbrules.h
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-01 13:58:09 +01:00
Ran Benita 62a75dc179 Remove unused stuff from XKBcommonint.h
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-01 13:57:55 +01:00
Ran Benita 12b3495ddf Remove unused 'which' and 'merge' arguments
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_desc -> xkb_keymap changes.]
2012-05-01 13:57:31 +01:00
Ran Benita 793908a046 Remove unused 'compiled' field in XkbFile
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:36 +01:00
Ran Benita 5fb494eca9 Remove unused debugging function
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:31 +01:00
Ran Benita afa34f3d2f Remove unused function XkbcNameMatchesPattern
Because the function is recursive, the compiler didn't say anything, eh.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:25 +01:00
Ran Benita 522be162b2 Use LT_INIT instead of deprecated AC_PROG_LIBTOOL
And add some warnings to the autoreconf step, for the developers to
see.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-30 17:06:15 +01:00
Ran Benita a641a1859b 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.]
2012-04-30 17:05:57 +01:00
Ran Benita a39ed85f56 Fix formatting in xkbcomp headers
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Fixed for xkb_desc -> xkb_keymap change.]
2012-04-30 17:00:47 +01:00
Daniel Stone 1f81c0e163 Dump include paths when we can't find rules
Since the most common failure mode here is a failure to properly set the
XKB data path, dump the include path so people at least have a clue
where to look.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-26 16:02:49 +02:00
Alan Coopersmith a1c08536a5 Include strings.h in XKBcommonint.h for strcasecmp etc
POSIX specifies that these functions require <strings.h>, but we were
only including <string.h>.  It did work, but still.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2012-04-26 13:49:00 +02:00
Ran Benita 4b49e0a117 Overhaul test suite
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
  pure C file per test. All of the .sh files are removed, but everything
  that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
  "parallel-test" mechanism. This will create a single log file for each
  test with it's stdout+stderr, and a top level "test-suite.log" file
  for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
  so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
  colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
  That way we can just put the directory in EXTRA_DIST and forget about
  it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
  for a completely non-recursive build.

Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.

It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:21:47 +01:00
Ran Benita b1e49ff980 Reformat actionHandler dispatch table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +01:00
Ran Benita 1b9635dfb5 Add xkb_state_get_map()
This is very useful because it avoids redundent pointers in structs
and/or parameter passing in the application.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +01:00
Ran Benita 8fbd44fde6 Implicitly include config.h in all files
The definitions in config.h should be available in all files an
implementation detail; it can be included through the build system
instead of having each file pull it every time.

This is especially helpful with AC_USE_SYSTEM_EXTENSIONS, as _GNU_SOURCE
and friends can have an effect by merely being defined, which can lead
to some confusion if its effective for only half the files.

And we don't really support a build _without_ config.h; so, one less
thing to worry about.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:16:17 +01:00
Ran Benita 5df53e4944 Remove xproto and kbproto from pkg-config file
These are no longer needed for using the library, only building it. Most
users would still want xproto though, for the keysym definitions.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 14:04:25 +01:00
Ran Benita 18e6a6a43e Remove Xfuncproto.h and XKB.h from xkbcommon/xkbcommon.h
The kbproto header is already not needed here anymore.

Move the _X_EXPORT's to the corresponding function definitions, and use
straight extern "C" clauses instead of _XFUNCPROTOBEGIN/END.

It also makes more sense to have the EXPORT's in the source files, as it
provides some documentation to the reader, whereas in the header it's
obvious.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:04:11 +01:00
Ran Benita 073a21076c Constify the syms_out argument to xkb_key_get_syms()
The caller should not mess around with these as they come directly from
our internal structs.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:58:44 +01:00
Ran Benita 467d7bb64e Implement missing xkb_state_ref and add return value
xkb_state_ref was missing.

Also modify the _ref functions to return the object instead of being
void. This is a useful idiom:

    struct my_object my_object_new(struct xkb_state *state)
    {
        [...]
        my_object->state = xkb_state_ref(state);
        [...]
    }

Essentially "taking" a reference, such that you don't forget to
increment it and it's one line less (see example in our own code).

A case could also be made for _unref to return the object or NULL, but
this is quite uncommon.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_keymap changes.]
2012-04-09 13:57:36 +01:00
Ran Benita b08629f92b Do not enable yacc trace facility unconditionally
Define DEBUG and set yydebug if you want that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:32 +01:00
Ran Benita 913e0740cb Constify a global table and function arguments
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:23 +01:00
Ran Benita d116aaef9f Remove unused struct definition
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:56:20 +01:00
Ran Benita 28011e71ad Replace remaining use of Atom instead of xkb_atom_t
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:55:59 +01:00
Ran Benita e9537d50d0 Fix possible overflow in scanner
Also reduce the size of scanBuf given that it's allocated on the stack,
and 1024 is enough.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:54:15 +01:00
Ran Benita 8feba630fa Fix KeyInfo's syms array size calculation
When merging group info from two KeyInfo's, the new size of the keysym
array was off. Fix it to match how it is used a few lines below.

There are also some peripheral fixes, and some comments (took me a
few minutes to get what's going on).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:53:26 +01:00
Ran Benita 518debb3bc Set xorg-macros CFLAGS correctly
A previous commit messed up all warning flags. Oops.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-09 13:52:38 +01:00
Ran Benita 2590b5a15d Fix compiler warnings
(They were not reported, see next commit).
The reset function declaration didn't match its name in the definition;
the _defaults variant matches better with the rest.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated to current master.]
2012-04-09 13:48:00 +01:00
Daniel Stone d007cd0a1f Unconstify xkb_rules_names
Since we never return an xkb_rules_names and it's all user-provided
strings, seems a bit harsh to have it const.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone ef88c7efab 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>
2012-04-09 13:47:23 +01:00
Daniel Stone bc872252f3 Use xorg CFLAGS and fix AC_USE_SYSTEM_EXTENSIONS
autotools was warning that AC_USE_SYSTEM_EXTENSIONS was being called too
late, so move it earlier.  Also shove BASE_CFLAGS into CFLAGS so we get
all the added warning flags from xorg.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone 632d9f0336 Eliminate remaining gcc warnings
Various one-liners (mostly removing unused variables) to make the code
safe for the full set of warnings used by the xorg macros.

On Debian-based systems, flex generates incorrect code resulting in two
warnings about yy_getcolumn and yy_setcolumn having no previous
declaration despite being non-static.  Fedora carries a patch to fix
this, and a bug has been filed on Debian's flex to add the patch:
http://bugs.debian.org/667027

Aside from this, it's now safe for --enable-strict-compilation.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone 495d87b06d Don't parse nonsense Unicode/hex keycodes
If a keysym was specified as "U1039andsomeextrastuffontheend", return
NoSymbol rather than 0x10001039; similarly, return NoSymbol for
"0xdeadbeefhitherehowsyourdaybeen" rather than 0xdeadbeef.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 15:12:04 +01:00
Daniel Stone 151fb4fc6d Remove unused device_spec
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 15:12:03 +01:00
Daniel Stone f249919ec6 include resets group compatibility modifiers #43091
This change makes sure that include does not overwrite previous
compatibility modifier settings when the included files does not
explicitly specify them.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>

[Cross-picked from xkbcomp commit 14470719.]
2012-04-03 15:11:42 +01:00
Daniel Stone 0002b8524c Add cscope output to .gitignore
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 13:01:10 +01:00
Daniel Stone 69111405b0 Properly document xkb_key_get_syms
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-03 12:48:05 +01:00
Ran Benita aeaa623d27 Constify a global table
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:12:31 +01:00
Ran Benita c83043b3c1 Make temporary fix for stale xkb_atoms
When xkb_free_keymap is called the atoms are all free'd, but action.c
keeps a global copy of interned "true" and "false", which remains stale.

The correct fix is to remove the need for the ActionsInit function
entirely.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:12:27 +01:00
Ran Benita 3c9493795b Fix bugs to allow multiple keymaps in one process
These were several initializations that were forgotten in the previous
memory leak fixes.

Now several xkb_desc's can coexist (relatively) peacefully.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Only the atom.c is relevant with the new context API.]
2012-04-02 13:11:59 +01:00
Ran Benita ffb610c943 Remove useless check from xkb_intern_atom
The "makeit" variable is always true. Remove it and de-indent.
(Also change the type of the "len" variable to size_t to avoid some
useless casting).

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:10:52 +01:00
Ran Benita 7a7ec9b14a Avoid leak in CompileKeymap error path
The NULL check is unneeded, and prevented the atoms from being free'd.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_map_unref.]
2012-04-02 13:10:38 +01:00
Ran Benita 5c5f7fcb7c makekeys: use correct format strings
The new glibc (2.15) appear to cause trouble, particularly the sscanf
call, where makekeys will output empty hash tables. Using the appropriate
macros from inttypes.h makes it work again.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-04-02 13:09:44 +01:00