keyboard: Handle number/phone input purposes specifically

Add OSK keymaps for these, with the special keys necessary to
type numbers(positive, negative, fractional, ...) and phone numbers
(with */+/#)

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6550
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3162>
This commit is contained in:
Carlos Garnacho 2024-01-26 18:51:14 +01:00
parent 32ada34e1d
commit b78b61a0be
4 changed files with 195 additions and 3 deletions

View File

@ -44,7 +44,9 @@
<file>my.json</file>
<file>nl.json</file>
<file>no.json</file>
<file>number.json</file>
<file>ph.json</file>
<file>phone.json</file>
<file>pl.json</file>
<file>pt.json</file>
<file>ro.json</file>

View File

@ -0,0 +1,95 @@
{
"levels": [
{
"level": "",
"mode": "default",
"rows": [
[
{
"strings": [
"7"
]
},
{
"strings": [
"8"
]
},
{
"strings": [
"9"
]
},
{
"action": "delete",
"iconName": "edit-clear-symbolic"
}
],
[
{
"strings": [
"4"
]
},
{
"strings": [
"5"
]
},
{
"strings": [
"6"
]
},
{
"iconName": "keyboard-enter-symbolic",
"keyval": "0xff0d",
"height": 2
}
],
[
{
"strings": [
"1"
]
},
{
"strings": [
"2"
]
},
{
"strings": [
"3"
]
}
],
[
{
"strings": [
"-",
"+",
"E"
]
},
{
"strings": [
"0"
]
},
{
"strings": [
".",
","
]
},
{
"action": "hide",
"iconName": "keyboard-hide-symbolic"
}
]
]
}
],
"name": "Numeric Keyboard"
}

View File

@ -0,0 +1,93 @@
{
"levels": [
{
"level": "",
"mode": "default",
"rows": [
[
{
"strings": [
"7"
]
},
{
"strings": [
"8"
]
},
{
"strings": [
"9"
]
},
{
"action": "delete",
"iconName": "edit-clear-symbolic"
}
],
[
{
"strings": [
"4"
]
},
{
"strings": [
"5"
]
},
{
"strings": [
"6"
]
},
{
"iconName": "keyboard-enter-symbolic",
"keyval": "0xff0d",
"height": 2
}
],
[
{
"strings": [
"1"
]
},
{
"strings": [
"2"
]
},
{
"strings": [
"3"
]
}
],
[
{
"strings": [
"*"
]
},
{
"strings": [
"0",
"+"
]
},
{
"strings": [
"#"
]
},
{
"action": "hide",
"iconName": "keyboard-hide-symbolic"
}
]
]
}
],
"name": "Phone"
}

View File

@ -1391,10 +1391,12 @@ export const Keyboard = GObject.registerClass({
y_expand: true,
});
if (purpose === Clutter.InputContentPurpose.DIGITS ||
purpose === Clutter.InputContentPurpose.NUMBER ||
purpose === Clutter.InputContentPurpose.PHONE) {
if (purpose === Clutter.InputContentPurpose.DIGITS) {
keyboardModel = new KeyboardModel('digits');
} else if (purpose === Clutter.InputContentPurpose.NUMBER) {
keyboardModel = new KeyboardModel('number');
} else if (purpose === Clutter.InputContentPurpose.PHONE) {
keyboardModel = new KeyboardModel('phone');
} else {
let groups = [groupName];
if (groupName.includes('+'))