Skip to content

Commit 421b5a7

Browse files
committed
#142 query and dump the keyboard layout map
1 parent 246c92b commit 421b5a7

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

html5/index.html

+24-1
Original file line numberDiff line numberDiff line change
@@ -1495,9 +1495,32 @@ <h2>Xpra Bug Report</h2>
14951495
xhr.send();
14961496
}
14971497

1498+
function query_keyboard_map() {
1499+
var keyboard = navigator.keyboard;
1500+
keyboard.getLayoutMap().then(keyboardLayoutMap => {
1501+
clog("got a keyboard layout map:", keyboardLayoutMap);
1502+
//TODO: build the client keymap somehow
1503+
load_default_settings();
1504+
clog("keys:", Array.from(keyboardLayoutMap.keys()));
1505+
for (const [key, value] of keyboardLayoutMap.entries()) {
1506+
cdebug("keyboard", key, "=", value);
1507+
}
1508+
});
1509+
if (keyboard.addEventListener) {
1510+
keyboard.addEventListener("layoutchange", function() {
1511+
clog("keyboard layout has changed!");
1512+
});
1513+
}
1514+
}
1515+
14981516
$(document).ready(function() {
14991517
clog("document is ready, browser is", navigator.platform, "64-bit:", Utilities.is_64bit());
1500-
load_default_settings();
1518+
if (navigator.keyboard && navigator.keyboard.getLayoutMap) {
1519+
query_keyboard_map();
1520+
}
1521+
else {
1522+
load_default_settings();
1523+
}
15011524
});
15021525
</script>
15031526
</body>

0 commit comments

Comments
 (0)