-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for conditional comments #432
Comments
So, I slept on it and now I see a major use case I did not develop sufficiently: how to gracefully handle server → client keymap transfer, in case we have a different version of xkbcommon in both. I am going to close this issue and reformulate it properly, without proposing a specific solution. |
very much a quickfire comment only here: the wayland protocol specifies the format as Alas, there is no version negotiation, so we'd have to add something like "I support keymap versions blah" to this protocol, or alternatively move into a protocol extension that supplies other protocol formats. |
@whot Yes, I think this is the proper way. I really wanted to avoid this and do minimal effort to fix the aforementioned bugs. In my mind, This does not solves the issue in My current solution is more a hack and now I do not feel comfortable with it. |
So, the gist of my approach to solve the issues above12 in xkbcommon is to add a new boolean field “onRelease” (subject to bikeshedding) to As this is a backward-incompatible syntax, I opened the current ticket in order to assess the handling in Let’s put the pieces together. I understand that the feasibility of extending the syntax could be achieved:
That is certainly a good amount of work! Some further comments:
So, to me it sounds feasible this way, although this can be long way, especially in Wayland. @whot @bluetech I would like your feedback:
Footnotes |
Recommended addition: adding parsing (but not necessarily handling) to xkbcomp. This should be simple enough once the libxkbcommon part is done and will effectively give you full coverage on anything that updates, so you effectively punt much of the backwards compatibility trickiness to distributions that need to support old combinations. For xkeyboard-config: I would definitely advise against separate files within the installation. I think a easier-to-manage approach would be something like duplicating the whole tree via e.g. For Wayland: I'm not a 100% sure if it needs to be a new extension or can be added to a new version of I was hoping we might be able to add some new action like Other than my hope for a new action the only ad-hoc fixes I can think of are using the |
(EDIT: This need reformulation. See my comment below.
TLDR;
I propose to add support for conditional comments in the keymap text format, in order to introduce non-backward compatible features, in files parsable by both legacy XOrg tools and xkbcommon.
In a gist (syntax subject to change):
Context
I started to look at pretty old issues such as:
I am not going to discuss them in details here. What they have in common is that they need to act against the XKB protocol. Or rather, they need to extend the protocol. Also: they are not going to be fixed in XOrg1.
XKB devs were pretty clear that going against the XKB specification is risky in general. Hard-coding ad-hoc solutions for the issues mentioned before does not seem a good idea either.
Instead, I think we should extend the protocol and the keymap text syntax. Again, I am not going to share a solution here, but rather raise a question in the following section.
Note that we already introduced a backward-incompatible syntax for multiple keysyms:
Problem
Extending the syntax is viable only if we can maintain backward-compatible code in xkeyboard-config. I am convinced it should be answered before elaborating any solution that extends the syntax.
Possible solutions
Keep backward-incompatible code in separate files
Keep backward-incompatible code in separate files and use different rules files depending on the supported features.
Cons: related code (e.g. new feature & its fallback) are in separate files. Also, it may duplicate rules files and requires introduce a new logic to select the proper rules file.
Create the keymap text format 2
Same issue as previously: we will have duplication of the code. But above all, this solution should be probably kept for the wonderfull XKB V2 protocol.
(Ab)use existing syntax
The action
Private
is currently not supported in xkbcommon and is ignored. We could start parsing it and take advantage of the unused bits in the XKB protocol.Cons: Counter-intuitive ugly hack. Also, this would not allow to support the multiple keysyms feature.
Use a preprocessor with conditional macros, a la C
Big hammer solution.
Cons: What about XOrg tools? There is no plan to modify them. And even if it were the case, updating xkeyboard-config would require to wait that the new XOrg tools are used in most distributions, … which may never happen.
Proposed solution: use conditional special comments
The idea is similar to the C preprocessor2. See the section TLDR above for the commented syntax.
Pros:
Cons:
Footnotes
Well, they could, in the unlikely case somebody stands up. ↩
Also, some of you may remember the infamous Internet Explorer conditional comments. While ugly, they did their job. ↩
The text was updated successfully, but these errors were encountered: