Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: US-International Keyboard Deadkeys #1907

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions core/input/keysym.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
/* eslint-disable key-spacing */

export default {
// TODO remove unused
XK_dead_grave: 0xfe50, // `
XK_dead_acute: 0xfe51, // ´
XK_dead_circumflex: 0xfe52, // ^
XK_dead_tilde: 0xfe53, // ~
XK_dead_macron: 0xfe54,
XK_dead_breve: 0xfe55,
XK_dead_abovedot: 0xfe56,
XK_dead_diaeresis: 0xfe57,
XK_dead_abovering: 0xfe58,
XK_dead_doubleacute: 0xfe59,
XK_dead_caron: 0xfe5a,
XK_dead_cedilla: 0xfe5b,
XK_dead_ogonek: 0xfe5c,
XK_dead_iota: 0xfe5d,
XK_dead_voiced_sound: 0xfe5e,
XK_dead_semivoiced_sound: 0xfe5f,
XK_dead_belowdot: 0xfe60,
XK_dead_hook: 0xfe61,
XK_dead_horn: 0xfe62,
XK_dead_stroke: 0xfe63,
XK_dead_abovecomma: 0xfe64,
XK_dead_psili: 0xfe64, /* non-deprecated alias for dead_abovecomma */
XK_dead_abovereversedcomma: 0xfe65,
XK_dead_dasia: 0xfe65, /* non-deprecated alias for dead_abovereversedcomma */
XK_dead_doublegrave: 0xfe66,
XK_dead_belowring: 0xfe67,
XK_dead_belowmacron: 0xfe68,
XK_dead_belowcircumflex: 0xfe69,
XK_dead_belowtilde: 0xfe6a,
XK_dead_belowbreve: 0xfe6b,
XK_dead_belowdiaeresis: 0xfe6c,
XK_dead_invertedbreve: 0xfe6d,
XK_dead_belowcomma: 0xfe6e,
XK_dead_currency: 0xfe6f,

XK_VoidSymbol: 0xffffff, /* Void symbol */

XK_BackSpace: 0xff08, /* Back space, back char */
Expand Down
32 changes: 32 additions & 0 deletions core/input/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ export function getKeysym(evt) {
return DOMKeyTable[key][location];
}

if(key === "Dead" ){
return getDeadKeysym(evt);
}

Copy link

@sergiomb2 sergiomb2 Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to me that key==="Dead" just works in Firefox and not in Chrome .

In firefox I got all accents working perfectly .

But I'd like use one electron app , because I can use ctrl + key , how we catch dead keys in chrome as it here ?

// Now we need to look at the Unicode symbol instead

// Special key? (FIXME: Should have been caught earlier)
Expand All @@ -189,3 +193,31 @@ export function getKeysym(evt) {

return null;
}

// Try to guess Keysym for Dead key. For now only should work for US-int
// TODO test
// TODO try to find and implement Dead keys for more keyboard layouts
export function getDeadKeysym(evt) {
switch(evt.code){
case "Quote":
if (evt.shiftKey){
return KeyTable.XK_dead_diaeresis //
} else {
return KeyTable.XK_dead_acute // ´
}
case "Backquote":
if (evt.shiftKey){
return KeyTable.XK_dead_grave
} else {
return KeyTable.XK_dead_tilde
}
case 'Digit6':
if (evt.shiftKey){
return KeyTable.XK_dead_circumflex
}

default:
console.log(evt)
return null
}
}