Sorry, this is under construction,
expect updates here.
Thanks for your patience.
int kgi_register_keyboard(struct kgi_keyboard *kbd, int id);
This function registers a (new) keyboard to the KGI manager. It is given a pointer to a struct kgi_keyboard describing the keyboard and providing the neccessary functions to access it. <id> is the ID under which this keyboard should be registered. If <id> is negative, the first free ID is assigned. When successful, the following fields in *kbd are initialized:
field | value |
kbd->id | The ID under which the keyboard was registered. |
kbd->has_pointer | 0 |
kbd->input.next | NULL |
kbd->input.num | 0 |
kbd->input.focus | The number of the first devices that this keyboard is allowed to focus on. |
An error code is returned to indicate if the operation was successful or the reason for failing:
value | meaning |
EOK | Registration was successful. You must not change the fields initialized by the KGI manager nor are you allowed to free/move/reallocate the registered struct because references are made internally. |
-ENOMEM | The operation failed because there was no free ID to assign. |
-EINVAL | The operation failed because of invalid parameters (e.g. NULL pointer to struct kgi_keyboard, id out of range or a keyboard registered under the same ID already). |