Commit graph

27 commits

Author SHA1 Message Date
Uli Schlachter
cd2372e6ba Add a function for handling XGE events
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 17:37:10 +02:00
Uli Schlachter
a66bb6b232 Code generator: Add support for XGE events
This also pretends that XKB has XGE events since that extension has its own
event multiplexing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 17:28:36 +02:00
Uli Schlachter
5cf2876228 Save static info as a pointer instead of copying it
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 16:51:35 +02:00
Uli Schlachter
0ebef8dd7f Move extension name into static info
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 16:49:58 +02:00
Uli Schlachter
322f2e1b81 Document failure scenarios for *_new()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 16:46:07 +02:00
Uli Schlachter
862579778a Also return the extension name for events and errors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 16:45:47 +02:00
Uli Schlachter
fb56799357 Correctly handle calloc() failure
If an extension that we support is not present in the X11 server, this is not a
fatal error. We can just skip this extension. However, the code implementing
this accidentally also made calloc()-failures non-fatal which is wrong.

Spotted by Ran Benita.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 16:17:29 +02:00
Uli Schlachter
4ed12c46de Don't check codes to be in range, but find "best match"
If some new events are added to an extension, older implementations register a
smaller portion of the event number space than this library possible knows. So
we cannot just look for some extension that has some code "in range", but we
need to find the best one (with the largest base).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-04-04 10:59:12 +02:00
Uli Schlachter
863ada16c1 Code generator: Print a warning for xge events
These are currently not handled correctly.

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
2015-03-25 10:51:56 +01:00
Uli Schlachter
c4c9a4f098 Skip XKB events in the code generator
Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
2015-03-25 10:51:38 +01:00
Uli Schlachter
059bfdbed8 Add an autotools-based build system
This is based on util-cursor's build system and libxcb/configure.ac for finding
xcb-proto's XML files.

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
2015-03-25 10:32:21 +01:00
Uli Schlachter
456a9a6f0c Correctly ignore extensions without events / errors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:59:37 +01:00
Uli Schlachter
c4f199fdae Fix get_strings_entry() to actually work
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:57:49 +01:00
Uli Schlachter
fbd56b6b75 Fix error checking in call to register_extensions()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:57:36 +01:00
Uli Schlachter
55961e7d79 Code generator: Implement errorcopy and eventcopy
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:57:14 +01:00
Uli Schlachter
90dfd2682e Mark the auto-generated file as auto-generated
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:26:55 +01:00
Uli Schlachter
8f230431a6 static_extension_info_t: Use uint8_t again were possible
The previous commit changed these fields into uint16_t since xproto tries to
assign value 256 here. However, this isn't actually necessary, so this commit
reverts that and instead makes the code generator emit a 0 here, since this
value isn't used anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:23:35 +01:00
Uli Schlachter
278a19c566 Implement a working code generator
With this change, the output of the code generator actually compiles and can be
linked into a library. This also changes the API between the generated code and
the library code. Hopefully, this API is nicer.

The code generator generates a function register_extensions() that looks up all
extensions and calls register_extension() for each one. Also, a global variable
xproto_info is exported which contains the information for all core requests and
also provides fallback names for unknown major codes / event codes / error
codes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 21:18:53 +01:00
Uli Schlachter
71b018acc7 Add a first version of the code generator
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-24 20:21:31 +01:00
Uli Schlachter
92123f9f80 Include xcb_errors.h from errors.h
This makes errors.h self-contained. It needs the definitions of uint8_t &
friends that we get through xcb.h from stdint.h.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:13:05 +01:00
Uli Schlachter
925ab1e7fb Define the "unknown foo" lists as strings
This gets rid of lots of relocations that were needed for the pointers into the
strings.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:11:48 +01:00
Uli Schlachter
514070caf8 Add a TODO about round-trips
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:02:38 +01:00
Uli Schlachter
a000b288db Remove pretty much unused member from xcb_errors_context_t
The xcb_connection_t is only needed during xcb_errors_context_new() and can be
passed around via arguments here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:01:53 +01:00
Uli Schlachter
4b6a0d480c Fix memory leak in xcb_errors_context_new()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:01:35 +01:00
Uli Schlachter
c851709f01 Add and use helper macro for range checks
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:00:27 +01:00
Uli Schlachter
6d84293699 Fix off-by-one in length check
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 22:00:04 +01:00
Uli Schlachter
68cf24822c Initial version
This is an initial prototype on how this library might look like. All the parts
which should be auto-generated from XCB's XML protocol description are missing.
The C parts should work fine, but are completely untested.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-18 21:43:05 +01:00