feat(windows): apply suggestions from code review

Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
rc-swag 2021-11-07 21:42:11 +10:00 committed by Ross
parent edfa9bcddd
commit 4e1ccfdd4f
3 changed files with 13 additions and 15 deletions

View file

@ -660,8 +660,8 @@ typedef struct {
} km_kbp_keyboard_attrs;
typedef struct {
km_kbp_virtual_key key; // The key the belongs
uint32_t modifier_flag; // modifier flag for the rule
km_kbp_virtual_key key;
uint32_t modifier_flag;
} km_kbp_keyboard_key;
#define KM_KBP_KEYBOARD_KEY_LIST_END { 0, 0 }
@ -735,24 +735,22 @@ km_kbp_keyboard_get_attrs(km_kbp_keyboard const *keyboard,
```
### `km_kbp_keyboard_get_key_list`
##### Description:
Returns the list of keys that belong to the keyboard rules. The matching dispose
call needs to be called to free the memory.
Returns the unordered full set of modifier+virtual keys that are handled by the
keyboard. The matching dispose call needs to be called to free the memory.
##### Return status:
- `KM_KBP_STATUS_OK`: On success.
- `KM_KBP_STATUS_INVALID_ARGUMENT`: If non-optional parameters are null.
##### Parameters:
- __keyboard__: A pointer to the opaque keyboard object to be queried.
- __out__: A pointer to the result:
A pointer to a `km_kbp_keyboard_get_key_list` structure.
- __out__: A pointer to an array of `km_kbp_keyboard_key` structures,
terminated by `KM_KBP_KEYBOARD_KEY_LIST_END`.
```c
*/
/* Get keyboard rules */
KMN_API
km_kbp_status
km_kbp_keyboard_get_key_list(km_kbp_keyboard const *keyboard,
km_kbp_keyboard_key **out);
km_kbp_keyboard_key **out);

View file

@ -84,7 +84,7 @@ km_kbp_keyboard_get_attrs(km_kbp_keyboard const *keyboard,
km_kbp_status
km_kbp_keyboard_get_key_list(km_kbp_keyboard const *keyboard,
km_kbp_keyboard_key **out)
km_kbp_keyboard_key **out)
{
assert(keyboard); assert(out);
if (!keyboard || !out)

View file

@ -41,14 +41,14 @@ public:
/**
* Updates a map of preserved keys (with GUID) that are used in keyboard rules.
* Passing in NULL for pPreservedKeys will cause cPreservedKeys to be set to the number
* PreserveKeys needed for the supplied pKeyboard, this should be used in creating pPreservedKeys
* List to sufficent size. When pPreseredKeys list is passed the cPreservedKeys will be the actual
* count of the number of unique pPreseredKeys
* of preserved keys needed for the supplied pKeyboard; this should be used in creating
* pPreservedKeys list to sufficient size. When pPreservedKeys list is passed the
* cPreservedKeys will be the actual count of the number of unique pPreservedKeys
*
* @param pKeyboard the keyboard for which the rules will be extracted from
* @param pPreservedKeys list of or PreservedKeys
* @param pPreservedKeys preallocated array for preserved keys to be filled in, or nullptr to retrieve required size
* @param cPreservedKeys number of preserved keys in pPreservedKeys - or the size pPreservedKeys needs to be
* @return BOOL return TRUE if pPreveredKeys was updated
* @return BOOL return TRUE on success
*/
BOOL MapKeyboardCore(km_kbp_keyboard *pKeyboard, PreservedKey **pPreservedKeys, size_t *cPreservedKeys);