Skip to content

Commit

Permalink
Add virtual keyboard unstable protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
vially committed Apr 9, 2021
1 parent 8229b8f commit 2f02f83
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
101 changes: 101 additions & 0 deletions protocols/external/virtual-keyboard-unstable-v1.xml
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="virtual_keyboard_unstable_v1">
<copyright>
Copyright © 2008-2011 Kristian Høgsberg
Copyright © 2010-2013 Intel Corporation
Copyright © 2012-2013 Collabora, Ltd.
Copyright © 2018 Purism SPC

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zwp_virtual_keyboard_v1" version="1">
<description summary="virtual keyboard">
The virtual keyboard provides an application with requests which emulate
the behaviour of a physical keyboard.

This interface can be used by clients on its own to provide raw input
events, or it can accompany the input method protocol.
</description>
<request name="keymap">
<description summary="keyboard mapping">
Provide a file descriptor to the compositor which can be memory-mapped
to provide a keyboard mapping description.
</description>
<arg name="format" type="uint" enum="wl_keyboard.keymap_format" summary="keymap format" />
<arg name="fd" type="fd" summary="keymap file descriptor" />
<arg name="size" type="uint" summary="keymap size, in bytes" />
</request>
<enum name="error">
<entry name="no_keymap" value="0" summary="No keymap was set" />
</enum>
<request name="key">
<description summary="key event">
A key was pressed or released.

The time argument is a timestamp with millisecond granularity, with an
undefined base. All requests regarding a single object must share the
same clock.

Keymap must be set before issuing this request.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity" />
<arg name="key" type="uint" summary="key that produced the event" />
<arg name="state" type="uint" enum="wl_keyboard.key_state" summary="physical state of the key" />
</request>
<request name="modifiers">
<description summary="modifier and group state">
Notifies the compositor that the modifier and/or group state has
changed, and it should update state.

Keymap must be set before issuing this request.
</description>
<arg name="mods_depressed" type="uint" summary="depressed modifiers" />
<arg name="mods_latched" type="uint" summary="latched modifiers" />
<arg name="mods_locked" type="uint" summary="locked modifiers" />
<arg name="group" type="uint" summary="keyboard layout" />
</request>
<request name="destroy" type="destructor">
<description summary="destroy the virtual keyboard object" />
</request>
</interface>
<interface name="zwp_virtual_keyboard_manager_v1" version="1">
<description summary="virtual keyboard manager">
A virtual keyboard manager allows an application to provide keyboard
input events as if they came from a physical keyboard.

If the compositor enables a keyboard to perform arbitrary actions, it
should prevent untrusted clients from using this interface.
</description>
<request name="create_virtual_keyboard">
<description summary="create a new virtual keyboard">
Creates a new virtual keyboard associated to a seat.
</description>
<arg name="seat" type="object" interface="wl_seat" />
<arg name="id" type="new_id" interface="zwp_virtual_keyboard_v1" summary="the id of the newly created virtual keyboard" />
</request>
<request name="destroy" type="destructor">
<description summary="destroy the virtual keyboard manager object">
Destroys the virtual keyboard manager.

Existing zwp_virtual_keyboard_v1 objects remain valid.
</description>
</request>
</interface>
</protocol>
1 change: 1 addition & 0 deletions scripts/bin/regenerate-protocols-data.ts
Expand Up @@ -9,6 +9,7 @@ const relativeProtocolDirs = [
path.join('protocols', 'wayland', 'stable'),
path.join('protocols', 'wayland', 'unstable'),
path.join('protocols', 'wlr', 'unstable'),
path.join('protocols', 'external'),
]

const jsonFilePathFor = (srcFileName: string): string =>
Expand Down
9 changes: 9 additions & 0 deletions src/data/protocol-registry.ts
Expand Up @@ -227,6 +227,15 @@ const protocols: WaylandProtocolRegistryItem[] = [
stability: WaylandProtocolStability.Unstable,
protocol: require('./protocols/wlr-virtual-pointer-unstable-v1.json'),
},
{
id: 'virtual-keyboard-unstable-v1',
name: 'Virtual keyboard',
source: WaylandProtocolSource.External,
stability: WaylandProtocolStability.Unstable,
protocol: require('./protocols/virtual-keyboard-unstable-v1.json'),
externalUrl:
'https://lists.freedesktop.org/archives/wayland-devel/2019-September/040882.html',
},
]

class WaylandProtocolRegistry {
Expand Down
1 change: 1 addition & 0 deletions src/data/protocols/virtual-keyboard-unstable-v1.json
@@ -0,0 +1 @@
{"type":"protocol","name":"virtual_keyboard_unstable_v1","copyright":{"type":"copyright","text":"Copyright © 2008-2011 Kristian Høgsberg\n\t\tCopyright © 2010-2013 Intel Corporation\n\t\tCopyright © 2012-2013 Collabora, Ltd.\n\t\tCopyright © 2018 Purism SPC\n\n\t\tPermission is hereby granted, free of charge, to any person obtaining a\n\t\tcopy of this software and associated documentation files (the \"Software\"),\n\t\tto deal in the Software without restriction, including without limitation\n\t\tthe rights to use, copy, modify, merge, publish, distribute, sublicense,\n\t\tand/or sell copies of the Software, and to permit persons to whom the\n\t\tSoftware is furnished to do so, subject to the following conditions:\n\n\t\tThe above copyright notice and this permission notice (including the next\n\t\tparagraph) shall be included in all copies or substantial portions of the\n\t\tSoftware.\n\n\t\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n\t\tTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n\t\tFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n\t\tDEALINGS IN THE SOFTWARE."},"interfaces":[{"type":"interface","name":"zwp_virtual_keyboard_v1","version":"1","description":{"type":"description","text":"The virtual keyboard provides an application with requests which emulate\n\t\t\tthe behaviour of a physical keyboard.\n\n\t\t\tThis interface can be used by clients on its own to provide raw input\n\t\t\tevents, or it can accompany the input method protocol.","summary":"virtual keyboard"},"requests":[{"type":"request","name":"keymap","description":{"type":"description","text":"Provide a file descriptor to the compositor which can be memory-mapped\n\t\t\t\tto provide a keyboard mapping description.","summary":"keyboard mapping"},"args":[{"type":"arg","name":"format","argType":"uint","summary":"keymap format","enum":"wl_keyboard.keymap_format"},{"type":"arg","name":"fd","argType":"fd","summary":"keymap file descriptor"},{"type":"arg","name":"size","argType":"uint","summary":"keymap size, in bytes"}]},{"type":"request","name":"key","description":{"type":"description","text":"A key was pressed or released.\n\n\t\t\t\tThe time argument is a timestamp with millisecond granularity, with an\n\t\t\t\tundefined base. All requests regarding a single object must share the\n\t\t\t\tsame clock.\n\n\t\t\t\tKeymap must be set before issuing this request.","summary":"key event"},"args":[{"type":"arg","name":"time","argType":"uint","summary":"timestamp with millisecond granularity"},{"type":"arg","name":"key","argType":"uint","summary":"key that produced the event"},{"type":"arg","name":"state","argType":"uint","summary":"physical state of the key","enum":"wl_keyboard.key_state"}]},{"type":"request","name":"modifiers","description":{"type":"description","text":"Notifies the compositor that the modifier and/or group state has\n\t\t\t\tchanged, and it should update state.\n\n\t\t\t\tKeymap must be set before issuing this request.","summary":"modifier and group state"},"args":[{"type":"arg","name":"mods_depressed","argType":"uint","summary":"depressed modifiers"},{"type":"arg","name":"mods_latched","argType":"uint","summary":"latched modifiers"},{"type":"arg","name":"mods_locked","argType":"uint","summary":"locked modifiers"},{"type":"arg","name":"group","argType":"uint","summary":"keyboard layout"}]},{"type":"request","name":"destroy","requestType":"destructor","description":{"type":"description","summary":"destroy the virtual keyboard object"},"args":[]}],"events":[],"enums":[{"type":"enum","name":"error","bitfield":false,"entries":[{"type":"entry","name":"no_keymap","value":"0","summary":"No keymap was set"}]}]},{"type":"interface","name":"zwp_virtual_keyboard_manager_v1","version":"1","description":{"type":"description","text":"A virtual keyboard manager allows an application to provide keyboard\n\t\t\tinput events as if they came from a physical keyboard.\n\n\t\t\tIf the compositor enables a keyboard to perform arbitrary actions, it\n\t\t\tshould prevent untrusted clients from using this interface.","summary":"virtual keyboard manager"},"requests":[{"type":"request","name":"create_virtual_keyboard","description":{"type":"description","text":"Creates a new virtual keyboard associated to a seat.","summary":"create a new virtual keyboard"},"args":[{"type":"arg","name":"seat","argType":"object","interface":"wl_seat"},{"type":"arg","name":"id","argType":"new_id","summary":"the id of the newly created virtual keyboard","interface":"zwp_virtual_keyboard_v1"}]},{"type":"request","name":"destroy","requestType":"destructor","description":{"type":"description","text":"Destroys the virtual keyboard manager.\n\n\t\t\t\tExisting zwp_virtual_keyboard_v1 objects remain valid.","summary":"destroy the virtual keyboard manager object"},"args":[]}],"events":[],"enums":[]}]}

0 comments on commit 2f02f83

Please sign in to comment.