Add missing JSDocs

This commit is contained in:
Romain Vigier
2020-08-04 10:20:51 +02:00
parent 114d0b6f53
commit 632e5db4dc
+17
View File
@@ -211,6 +211,11 @@ function applyShellStylesheet(stylesheet) {
logDebug('Shell stylesheet applied.');
}
/**
* Check if the given keyval is forbidden.
* @param {number} keyval The keyval number.
* @returns {boolean} `true` if the keyval is forbidden.
*/
function isKeyvalForbidden(keyval) {
const forbiddenKeyvals = [
Gdk.KEY_Home,
@@ -229,6 +234,12 @@ function isKeyvalForbidden(keyval) {
return forbiddenKeyvals.includes(keyval);
}
/**
* Check if the given key combo is a valid binding
* @param {{mask: number, keycode: number, keyval:number}} combo An object
* representing the key combo.
* @returns {boolean} `true` if the key combo is a valid binding.
*/
function isBindingValid({ mask, keycode, keyval }) {
if ((mask === 0 || mask === Gdk.SHIFT_MASK) && keycode !== 0) {
if (
@@ -250,6 +261,12 @@ function isBindingValid({ mask, keycode, keyval }) {
return true;
}
/**
* Check if the given key combo is a valid accelerator.
* @param {{mask: number, keyval:number}} combo An object representing the key
* combo.
* @returns {boolean} `true` if the key combo is a valid accelerator.
*/
function isAccelValid({ mask, keyval }) {
return Gtk.accelerator_valid(keyval, mask) || (keyval === Gdk.KEY_Tab && mask !== 0);
}