-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add function to paste from clipboard and add support for non-US locales #1411
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
Open
chschnell
wants to merge
37
commits into
copy:master
Choose a base branch
from
chschnell:keyboard-i18n
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- added class DesktopKeyboard, moved related code from KeyboardAdapter into new class. - added class StringKeyboard, added KEYMAPS maps for US, UK and DE keyboards. - added SCANCODE map, maps string KeyboardEvent.code names to integer scancodes (was: KeyboardAdapter.codemap). - removed KeyboardAdapter.charmap, .asciimap and .codemap mappings. - KeyboardAdapter now only filters events and hands off to DesktopKeyboard and StringKeyboard, as needed.
Literal key values of Javascript Objects are shortened in V86 release mode, in debug mode they are kept unchanged. This lead to key lookup failures in mapping Object SCANCODE. Changed type of keys to string in SCANCODE to fix this.
- removed "delay" arguments from V86.keyboard_send_scancodes() and V86.keyboard_send_text(), no longer needed - removed function V86.keyboard_send_keys(codes, delay) entirely, we no longer support keyCode-to-scancode mappings - likely fixed broken Enter and Backspace keys in mobile browers
Prevent Closure Compiler from renaming keys by using strings instead of literals.
Replaces no longer supported API function V86.keyboard_send_keys(codes, delay).
config.lang defines a "locale region" and serves as a shortcut for predefined pairs of keyboard layout and codepage identifieres. Added three supported values for config.lang: - "us": United States (KBDUS, CP437) - "uk": United Kingdom (KBDUK, CP858) - "de": Germany (KBDGR, CP858)
If defined, hold_time is the time in milliseconds for which the keys are pressed down (default: 0).
If a key name with a length larger than 1 is passed to send_keypress() then the pyhsical keyboard mapping SCANCODE[] is used to determine the scancode. All key names in the KeyboardEvent.code naming convention have at least a length of 2. New: If a key name of length 1 is passed to send_keypress() then locale-dependent layout mapping KEYMAPS[] is used to determine the scancode. The raw scancode of the key's first (scancode, modifier) pair is used, modifier is ignored here. This is a bit closer to the removed V86.keyboard_send_keys(codes, delay) (which was based on deprecated KeyboardEvent.keyCode).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To paste text from the system clipboard into the emulator support for international keyboard layout mappings is needed for non-US users (in text mode, support for non-US codepages is additionally needed). This problem is laid out in detail in issue #1406.
User interface changes
us
,uk
,de
, default:us
), each locale defines a codepage and a keyboard layout mappingAPI changes
delay
argument fromV86.keyboard_send_scancodes()
andV86.keyboard_send_text()
, not needed any more (moved to KeyboardAdapter config)V86.keyboard_send_keys(codes, delay)
, this isn't supported any more (deprecated and wasn't used in the source tree anyway)V86.keyboard_send_keypress(keys, hold_time)
as a replacement,keys
is an array of strings in KeyboardEvent.code naming conventionoptions.locale
to set the Locale at startup (default:us
)Changes to class
KeyboardAdapter
DesktopKeyboard
andDataKeyboard
classesDemos
Use case 1: Pasting all extended German keys into nano (Debian 12 German in text console mode):
debian-de-paste-keyboard-kbdgr.mp4
Use case 2: Mobile screenshot FreeDOS 1.4 German:
Use case 3: German keyboard layout mapping and copdepage in vga2tty with FreeDOS 1.4 German:
See vga2tty.
freedos14-de-vga2tty-kbdgr.mp4
TODO