Add a new warning for numeric keysyms
Usually it is better to use the corresponding human-friendly keysym names. If there is none, then the keysym is most probably not supported in the ecosystem. The only use case I see is similar to the PUA in Unicode (see: https://en.wikipedia.org/wiki/Private_Use_Areas). I am not aware of examples of this kind of use.master
parent
417d0747b6
commit
eafd3aceca
|
@ -6,7 +6,7 @@ NOTE: This file has been generated automatically by “update-message-registry.p
|
||||||
-->
|
-->
|
||||||
|
|
||||||
This page lists the warnings and errors generated by xkbcommon.
|
This page lists the warnings and errors generated by xkbcommon.
|
||||||
There are currently 20 entries.
|
There are currently 21 entries.
|
||||||
|
|
||||||
@todo The documentation of the log messages is a work in progress.
|
@todo The documentation of the log messages is a work in progress.
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ There are currently 20 entries.
|
||||||
| [XKB-305] | `non-base-group-name` | Warn if a group name was defined for group other than the first one | Warning |
|
| [XKB-305] | `non-base-group-name` | Warn if a group name was defined for group other than the first one | Warning |
|
||||||
| [XKB-312] | `unsupported-shift-level` | Warn when a shift level is not supported | Error |
|
| [XKB-312] | `unsupported-shift-level` | Warn when a shift level is not supported | Error |
|
||||||
| [XKB-461] | `conflicting-key-symbol` | Warn if there are conflicting keysyms while merging keys | Warning |
|
| [XKB-461] | `conflicting-key-symbol` | Warn if there are conflicting keysyms while merging keys | Warning |
|
||||||
|
| [XKB-489] | `numeric-keysym` | Warn on numeric keysym (other than 0-9) | Warning |
|
||||||
| [XKB-516] | `extra-symbols-ignored` | <span class="todo">TODO:</span> add description | Warning |
|
| [XKB-516] | `extra-symbols-ignored` | <span class="todo">TODO:</span> add description | Warning |
|
||||||
| [XKB-578] | `wrong-field-type` | Warn when a field has not the expected type | Error |
|
| [XKB-578] | `wrong-field-type` | Warn when a field has not the expected type | Error |
|
||||||
| [XKB-645] | `unknown-char-escape-sequence` | Warn on unknown escape sequence in string literal | Warning |
|
| [XKB-645] | `unknown-char-escape-sequence` | Warn on unknown escape sequence in string literal | Warning |
|
||||||
|
@ -165,6 +166,53 @@ as numbers and as identifiers `LevelN`, where `N` is in the range (1..8).
|
||||||
<dt>Summary</dt><dd>Warn if there are conflicting keysyms while merging keys</dd>
|
<dt>Summary</dt><dd>Warn if there are conflicting keysyms while merging keys</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
### XKB-489 – Numeric keysym {#XKB-489}
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>Since</dt><dd>1.6.0</dd>
|
||||||
|
<dt>Type</dt><dd>Warning</dd>
|
||||||
|
<dt>Summary</dt><dd>Warn on numeric keysym (other than 0-9)</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
Numeric keysyms are not human-friendly. Use the corresponding named keysym
|
||||||
|
or Unicode keysym, if available.
|
||||||
|
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Hexadecimal keysym `0x1001ed0`</summary>
|
||||||
|
|
||||||
|
**Error message:**
|
||||||
|
|
||||||
|
```
|
||||||
|
xkbcommon: WARNING: [XKB-489] numeric keysym "0x1001ed0"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
<div class="example-container">
|
||||||
|
<div class="example">
|
||||||
|
<div class="example-inner">
|
||||||
|
<div class="example-title">Before</div>
|
||||||
|
```c
|
||||||
|
key <AE01> { [ 0x1001ed0] };
|
||||||
|
```
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="example">
|
||||||
|
<div class="example-inner">
|
||||||
|
<div class="example-title">After</div>
|
||||||
|
```c
|
||||||
|
// Preferred form: human-friendly
|
||||||
|
key <AE01> { [ Ocircumflexacute ] };
|
||||||
|
// or
|
||||||
|
key <AE01> { [ U1ED0 ] };
|
||||||
|
```
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
### XKB-516 – Extra symbols ignored {#XKB-516}
|
### XKB-516 – Extra symbols ignored {#XKB-516}
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -280,6 +328,7 @@ xkbcommon support the following escape sequences in string literals:
|
||||||
[XKB-305]: @ref XKB-305
|
[XKB-305]: @ref XKB-305
|
||||||
[XKB-312]: @ref XKB-312
|
[XKB-312]: @ref XKB-312
|
||||||
[XKB-461]: @ref XKB-461
|
[XKB-461]: @ref XKB-461
|
||||||
|
[XKB-489]: @ref XKB-489
|
||||||
[XKB-516]: @ref XKB-516
|
[XKB-516]: @ref XKB-516
|
||||||
[XKB-578]: @ref XKB-578
|
[XKB-578]: @ref XKB-578
|
||||||
[XKB-645]: @ref XKB-645
|
[XKB-645]: @ref XKB-645
|
||||||
|
|
|
@ -100,6 +100,33 @@
|
||||||
added: ALWAYS
|
added: ALWAYS
|
||||||
type: warning
|
type: warning
|
||||||
description: "Warn if there are conflicting keysyms while merging keys"
|
description: "Warn if there are conflicting keysyms while merging keys"
|
||||||
|
- id: "numeric-keysym"
|
||||||
|
code: 489
|
||||||
|
added: 1.6.0
|
||||||
|
type: warning
|
||||||
|
description: "Warn on numeric keysym (other than 0-9)"
|
||||||
|
details: |
|
||||||
|
Numeric keysyms are not human-friendly. Use the corresponding named keysym
|
||||||
|
or Unicode keysym, if available.
|
||||||
|
examples:
|
||||||
|
- name: Hexadecimal keysym `0x1001ed0`
|
||||||
|
description: |
|
||||||
|
**Error message:**
|
||||||
|
|
||||||
|
```
|
||||||
|
xkbcommon: WARNING: [XKB-489] numeric keysym "0x1001ed0"
|
||||||
|
```
|
||||||
|
before: |
|
||||||
|
```c
|
||||||
|
key <AE01> { [ 0x1001ed0] };
|
||||||
|
```
|
||||||
|
after: |
|
||||||
|
```c
|
||||||
|
// Preferred form: human-friendly
|
||||||
|
key <AE01> { [ Ocircumflexacute ] };
|
||||||
|
// or
|
||||||
|
key <AE01> { [ U1ED0 ] };
|
||||||
|
```
|
||||||
- id: "extra-symbols-ignored"
|
- id: "extra-symbols-ignored"
|
||||||
code: 516
|
code: 516
|
||||||
added: ALWAYS
|
added: ALWAYS
|
||||||
|
|
|
@ -32,6 +32,8 @@ enum xkb_message_code {
|
||||||
XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL = 312,
|
XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL = 312,
|
||||||
/** Warn if there are conflicting keysyms while merging keys */
|
/** Warn if there are conflicting keysyms while merging keys */
|
||||||
XKB_WARNING_CONFLICTING_KEY_SYMBOL = 461,
|
XKB_WARNING_CONFLICTING_KEY_SYMBOL = 461,
|
||||||
|
/** Warn on numeric keysym (other than 0-9) */
|
||||||
|
XKB_WARNING_NUMERIC_KEYSYM = 489,
|
||||||
/** TODO: add description */
|
/** TODO: add description */
|
||||||
XKB_WARNING_EXTRA_SYMBOLS_IGNORED = 516,
|
XKB_WARNING_EXTRA_SYMBOLS_IGNORED = 516,
|
||||||
/** Warn when a field has not the expected type */
|
/** Warn when a field has not the expected type */
|
||||||
|
|
|
@ -673,6 +673,9 @@ ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val <= XKB_KEYSYM_MAX) {
|
if (val <= XKB_KEYSYM_MAX) {
|
||||||
|
log_warn_with_code(ctx, XKB_WARNING_NUMERIC_KEYSYM,
|
||||||
|
"numeric keysym \"0x%x\" (%d)",
|
||||||
|
(unsigned int) val, val);
|
||||||
*sym_rtrn = (xkb_keysym_t) val;
|
*sym_rtrn = (xkb_keysym_t) val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -765,6 +765,11 @@ KeySym : IDENT
|
||||||
);
|
);
|
||||||
$$ = XKB_KEY_NoSymbol;
|
$$ = XKB_KEY_NoSymbol;
|
||||||
}
|
}
|
||||||
|
parser_warn(
|
||||||
|
param, XKB_WARNING_NUMERIC_KEYSYM,
|
||||||
|
"numeric keysym \"0x%"PRIx64"\" (%"PRId64")",
|
||||||
|
$1, $1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
@ -47,6 +47,7 @@ static const struct xkb_message_entry xkb_messages[] = {
|
||||||
{XKB_WARNING_NON_BASE_GROUP_NAME, "Non base group name"},
|
{XKB_WARNING_NON_BASE_GROUP_NAME, "Non base group name"},
|
||||||
{XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL, "Unsupported shift level"},
|
{XKB_ERROR_UNSUPPORTED_SHIFT_LEVEL, "Unsupported shift level"},
|
||||||
{XKB_WARNING_CONFLICTING_KEY_SYMBOL, "Conflicting key symbol"},
|
{XKB_WARNING_CONFLICTING_KEY_SYMBOL, "Conflicting key symbol"},
|
||||||
|
{XKB_WARNING_NUMERIC_KEYSYM, "Numeric keysym"},
|
||||||
{XKB_WARNING_EXTRA_SYMBOLS_IGNORED, "Extra symbols ignored"},
|
{XKB_WARNING_EXTRA_SYMBOLS_IGNORED, "Extra symbols ignored"},
|
||||||
{XKB_ERROR_WRONG_FIELD_TYPE, "Wrong field type"},
|
{XKB_ERROR_WRONG_FIELD_TYPE, "Wrong field type"},
|
||||||
{XKB_WARNING_UNKNOWN_CHAR_ESCAPE_SEQUENCE, "Unknown char escape sequence"},
|
{XKB_WARNING_UNKNOWN_CHAR_ESCAPE_SEQUENCE, "Unknown char escape sequence"},
|
||||||
|
|
Loading…
Reference in New Issue