upgrade InputStickAPI

This commit is contained in:
Philipp Crocoll 2016-01-27 05:25:01 +01:00
parent 4b0d727a41
commit c0f2b68963
47 changed files with 4672 additions and 385 deletions

25
src/java/InputStickAPI/.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Intellij project files
*.iml
*.ipr
*.iws
.idea/

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//src/com/inputstick/api/layout/NorwegianLayout.java=UTF-8

View File

@ -6,7 +6,7 @@
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
android:targetSdkVersion="19" />
<application
android:allowBackup="true"

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) [2015] [Jakub Zawadzki Embedded Solutions, inputstick.com]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,203 @@
# InputStickAPI for Android OS
## About InputStick:
InputStick is an Android-compatible USB receiver. It allows to use your smartphone as a wireless keyboard, mouse, multimedia and game controller.
##How does it work?
InputStick acts as a proxy between USB host and Android device:
* USB host detects is as a generic HID device. It knows nothing about Bluetooth interface. As a result, in most cases, there is no need to install any drivers or configure anything.
* Android device knows only about Bluetooth interface. Everything works with stock OS: root is NOT required, there is also no need to install customized OS.
`Android device <-(Bluetooth)-> InputStick <-(USB)-> PC`
![alt text](http://inputstick.com/images/how_2.png "How does it work diagram")
InputStick is detected as a generic keyboard and mouse (USB HID), it makes it compatible with wide range of hardware:
* PC (Windows, Linux, OS X),
* embedded systems (RaspberryPi etc.),
* consoles (PS3, Xbox360, only as keyboard, NOT game controller!),
* any USB-HID compatible USB host.
Remember: InputStick behaves EXACTLY as a USB keyboard and mouse - nothing more and nothing less. It is not able to put text directly into system clipboard etc.
## More info:
[Visit inputstick.com](http://inputstick.com)
[Download section](http://inputstick.com/download)
[GooglePlay](https://play.google.com/store/apps/developer?id=InputStick)
## Getting started:
Eclipse: Import InputStickAPI into workspace, add InputStickAPI as a library to your project: Project -> Properties -> Android -> Add.
It is recommended to start with: `com.inputstick.api.broadcast.InputStickBroadcast`
this can be as easy as a single line of code (InputStickUtility takes care of everything else):
```java
InputStickBroadcast.type(context, "text to type", "en-US);
```
If you need more control:
Managing connection:
`com.inputstick.api.basic.InputStickHID`
```java
connect(getApplication());
disconnect();
getState();
```
Implement callback:
`com.inputstick.api.InputStickStateListener`
```java
onStateChanged(int state);
```
Keyboard interface:
`com.inputstick.api.basic.InputStickKeyboard`
```java
type("text to type", "en-US");
pressAndRelease(HIDKeycodes.ALT_LEFT, HIDKeycodes.KEY_ENTER);
```
Mouse interface:
`com.inputstick.api.basic.InputStickMouse`
```java
move((byte)10, (byte)5);
click(InputStickMouse.BUTTON_LEFT, 2);
```
Consumer control interface:
`com.inputstick.api.basic.InputStickConsumer`
```java
consumerAction(InputStickConsumer.VOL_UP);
```
Gamepad interface:
`com.inputstick.api.basic.InputStickGamepad`
```java
customReport((byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00);
```
For more details and usage examples, please take a look at Android demo applications.
[Download section](http://inputstick.com/download)
## Known bugs:
Due to a bug in Bluetooth Stack in Android OS, calling type() methods from non-UI thread can result in missing characters when BT4.0 InputStick is used. Latest firmware (0.98) allows to create fix for the bug.
## InputStickUtility:
It is highly recommended that InputStickUtility application is installed (available on GooglePlay). It allows to make application development much easier.
InputStickUtility provides background service that acts as a proxy between your application and InputStick. When InputStickUtility is used, you don't have to care about:
* enabling Bluetooth radio,
* discovering available devices,
* detecting type of InputStick device (BT2.1, BT4.0),
* password protection (if enabled).
![alt text](http://inputstick.com/images/apilayerssmall.png "InputStickUtility and API diagram")
There are two ways to communicate with InputStickUtility:
* Sending Broadcasts : simplest way to get started. InputStickUtility takes care of almost everything. Use `com.inputstick.api.broadcast.InputStickBroadcast`
* IPC connection: fast, low latency, gives you a lot of control, but makes application more complex. Use `com.inputstick.api.basic.InputStickHID`
## Direct connection:
If you want to avoid installing InputStickUtility application you can make direct connection from your application. You must be able to provide following parameters:
* Bluetooth MAC address of InputStick device,
* Bluetooth version (BT2.1, BT4.0),
* encryption key (if password protection is enabled).
Your application should also take care of notifying user about InputStick-related errors (connection failed, connection lost, etc.).
Your application must have `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions. Since Android M, it is also necessary to have `LOCATION_COARSE` permission to scan for nearby Bluetooth devices.
## Keyboard layouts:
Always make sure that selected layout matches layout used by USB host (PC). Due to limitations of USB-HID it is not possible for InputStick to know what layout is use by the USB host. This must be manually provided by the user.
List of currently available keyboard layouts:
* da-DK - Danish (Denmark),
* de-CH - German (Switzerland),
* de-DE - German (Germany),
* de-DE (MAC) - German (Germany), Mac compatible version,
* en-DV - English (United States), Dvorak layout,
* en-GB - English (United Kingdom),
* en-US - English (United States),
* es-ES - Spanish (Spain),
* fi-FI - Finnish (Finland),
* fr-CH - French (Switzerland),
* fr-FR - French (France),
* he-IL - Hebrew (Israel),
* it-IT - Italian (Italy),
* nb-NO - Norwegian, Bokmal (Norway),
* pl-PL - Polish (Poland),
* pt-BR - Portuguese (Brazil),
* ru-RU - Russian (Russia),
* sk-SK - Slovak (Slovakia),
* sv-SE - Swedish (Sweden).
## Requirements (BT2.1 version):
* InputStick BT2.1 receiver,
* Android 2.3 or later,
* Bluetooth 2.1 or later.
## Requirements (BT4.0 version):
* InputStick BT4.0 receiver,
* Android 4.3 or later,
* Bluetooth 4.0 (Bluetooth Low Energy).
## Technical limitations and things to consider:
USB device - InputStick
USB host - PC, game consoles, Raspberry Pi, etc.
HID - Human Interface Device (keyboard, mouse, gamepad, etc.)
InputStick communicates with USB host by sending HID reports for each interface (keyboard, mouse, consumer control).
HID report - data representing state or change of state of HID interface.
[Learn more: USB HID1.11 pdf](www.usb.org/developers/hidpage/HID1_11.pdf)
**Compatibility:**
USB host detects InputStick as a generic keyboard, mouse and consumer control composite device. It sees NO difference between physical keyboard/mouse and InputStick. Host does not know anything about Bluetooth interface.
In most cases, generic drivers for HID devices are used, there is no need to install any additional software or drivers.
If your USB host works with generic USB keyboard, it will most likely also work with InputStick. If necessary, you can make some adjustments to USB interface using InputStickUtility app (requires some knowledge about USB interface).
**NO feedback:**
In case of HID class devices, USB host does NOT provide any information about itself to USB device:
* type of hardware is unknown,
* OS is unknown,
* keyboard layout used by OS is unknown,
* there is no feedback whether characters were typed correctly.
Think of InputStick as of a blind person with en-US keyboard:
* you provide instructions, example: type "abC"
* InputStick executes the instruction by simulating user actions: press "A" key, release, press "B" key, release, press and hold "Shift" key, press "C" key, release all keys.
* InputStick has no way of knowing if these actions produced correct result
You (app user) must provide all necessary information and feedback!
**Typing speed:**
InputStick can type text way faster than any human. In some cases this can result in missing characters. Use slower typing speed when necessary.
Example: when PC is experiencing have CPU load, it is possible that in sometimes characters will be skipped (same thing will happen when using regular USB keyboard).
**Consumer control interface.**
Multimedia keys: allows to control media playback, system volume, launch applications.
Unfortunately there are differences between OSes in how consumer control actions are interpreted.
Example 1: there are 100 volume levels in Windows OS and 10 levels on Ubuntu. Increasing system volume by 1 will have different effect on each of them.
Example 2: when audio output is muted, increasing system volume by 1 can have different effects: Windows - volume level is increased by 1, but audio output will remain muted. Linux - volume level is uncreased by 1, audio output is unmuted.
**Bluetooth:**
Time required to establish connection:
* BT2.1 - usually 1-3 seconds,
* BT4.0 - usually less than a second.
Latency:
Bluetooth introduces additional latency (several ms in most cases, in some conditions can increase to several hundreds).
Range:
Walls and other obstacles will decrease performance of Bluetooth link. BT4.0 devices are generally more sensitive to this (due to Low Energy approach).

View File

@ -7,8 +7,8 @@ import android.os.Handler;
import android.os.Message;
import com.inputstick.api.bluetooth.BTService;
import com.inputstick.init.InitManager;
import com.inputstick.init.InitManagerListener;
import com.inputstick.api.init.InitManager;
import com.inputstick.api.init.InitManagerListener;
public class BTConnectionManager extends ConnectionManager implements InitManagerListener {
@ -67,6 +67,7 @@ public class BTConnectionManager extends ConnectionManager implements InitManage
private void onDisconnected() {
stateNotify(ConnectionManager.STATE_DISCONNECTED);
mInitManager.onDisconnected();
}
private void onFailure(int code) {

View File

@ -0,0 +1,53 @@
package com.inputstick.api;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
public class DownloadDialog {
public static final int NOT_INSTALLED = 0;
public static final int NOT_UPDATED = 1;
public static AlertDialog getDialog(final Context ctx, final int messageCode) {
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(ctx);
if (messageCode == NOT_UPDATED) {
downloadDialog.setTitle("InputStickUtility app must be updated");
downloadDialog.setMessage("It appears that you are using older version of InputStickUtility application. Update now (GoolePlay)?");
} else {
downloadDialog.setTitle("InputStickUtility app NOT installed");
downloadDialog.setMessage("InputStickUtility is required to complete this action. Download now (GoolePlay)?\nNote: InputStick USB receiver (HARDWARE!) is also required.");
}
downloadDialog.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
final String appPackageName = "com.inputstick.apps.inputstickutility";
try {
ctx.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id="
+ appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
ctx.startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id="
+ appPackageName)));
}
}
});
downloadDialog.setNegativeButton("No",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
return downloadDialog.show();
}
}

View File

@ -63,7 +63,7 @@ public class IPCConnectionManager extends ConnectionManager {
public void onServiceConnected(ComponentName className, IBinder service) {
mService = new Messenger(service);
mBound = true;
sendMessage(SERVICE_CMD_CONNECT, 0, 0);
sendConnectMessage();
}
public void onServiceDisconnected(ComponentName className) {
@ -81,7 +81,11 @@ public class IPCConnectionManager extends ConnectionManager {
private void sendConnectMessage() {
Bundle b = new Bundle();
b.putLong("TIME", System.currentTimeMillis());
sendMessage(SERVICE_CMD_CONNECT, 0, 0, b);
}
private void sendMessage(int what, int arg1, int arg2, Bundle b) {
@ -131,11 +135,12 @@ public class IPCConnectionManager extends ConnectionManager {
mErrorCode = InputStickError.ERROR_NONE;
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.inputstick.apps.inputstickutility","com.inputstick.apps.inputstickutility.service.InputStickService"));
intent.putExtra("TIME", System.currentTimeMillis());
mCtx.startService(intent);
mCtx.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
if (mBound) {
//already bound
sendMessage(SERVICE_CMD_CONNECT, 0, 0);
sendConnectMessage();
}
} else {
mErrorCode = InputStickError.ERROR_ANDROID_NO_UTILITY_APP;

View File

@ -1,5 +1,6 @@
package com.inputstick.api;
import android.annotation.SuppressLint;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -31,6 +32,7 @@ public abstract class Util {
}
}
@SuppressLint("DefaultLocale")
public static String byteToHexString(byte b) {
String s;
//0x0..0xF = 0x00..0x0F

View File

@ -5,8 +5,6 @@ import com.inputstick.api.hid.HIDTransaction;
public class InputStickConsumer {
//CONSUMER PAGE (consumerAction)
public static final int VOL_UP = 0x00E9;
public static final int VOL_DOWN = 0x00EA;
@ -20,7 +18,7 @@ public class InputStickConsumer {
public static final int LAUNCH_EMAIL = 0x018A;
public static final int LAUNCH_CALC = 0x0192;
//Android OS:
//Android OS (consumer):
public static final int HOME = 0x0223;
public static final int BACK = 0x0224;
public static final int SEARCH = 0x0221;
@ -35,7 +33,12 @@ public class InputStickConsumer {
}
//use only for SYSTEM_POWER_DOWN, SYSTEM_SLEEP and SYSTEM_WAKEUP
/*
* Use only for system actions SYSTEM_POWER_DOWN, SYSTEM_SLEEP and SYSTEM_WAKEUP
*
* @param action code of system action
*/
public static void systemAction(byte action) {
HIDTransaction t = new HIDTransaction();
t.addReport(new ConsumerReport(ConsumerReport.SYSTEM_REPORT_ID, action, (byte)0));
@ -43,19 +46,39 @@ public class InputStickConsumer {
InputStickHID.addConsumerTransaction(t);
}
/*
* Requests USB host to power down. Must be supported and enabled by USB host.
*/
public static void systemPowerDown() {
systemAction(SYSTEM_POWER_DOWN);
}
/*
* Requests USB host to go into sleep/standby mode. Must be supported and enabled by USB host.
*/
public static void systemSleep() {
systemAction(SYSTEM_SLEEP);
}
/*
* Requests USB host to resume from sleep/standby mode. Must be supported and enabled by USB host.
* Note: USB host must supply USB power when suspended. Otherwise InputStick will not work.
*/
public static void systemWakeUp() {
systemAction(SYSTEM_WAKEUP);
}
//action - see http://www.usb.org/developers/hidpage/Hut1_12v2.pdf (consumer page)
/*
* Consumer control action: media playback, volume etc.
* See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf (consumer page).
* USB host may not support certain action codes
*
* @param action code of consumer control action
*/
public static void consumerAction(int action) {
HIDTransaction t = new HIDTransaction();
t.addReport(new ConsumerReport(action));

View File

@ -9,8 +9,17 @@ public class InputStickGamepad {
}
//buttons1 - button0, button1, ..., button7
//buttons2 - button8, button1, ..., button15
/*
* Sends custom HID gamepad report
*
* @param buttons1 state (on/off) of buttons0..7
* @param buttons2 state (on/off) of buttons8..15
* @param x value of X axis
* @param y value of Y axis
* @param z value of Z axis
* @param rx value of rX axis
*/
public static void customReport(byte buttons1, byte buttons2, byte x, byte y, byte z, byte rX) {
if (InputStickHID.isReady()) {
Packet p = new Packet(false, (byte)0x2B, (byte)0x03); //write directly to endp3in, no buffering

View File

@ -7,12 +7,10 @@ import java.util.Vector;
import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import com.inputstick.api.BTConnectionManager;
import com.inputstick.api.ConnectionManager;
import com.inputstick.api.DownloadDialog;
import com.inputstick.api.HIDInfo;
import com.inputstick.api.IPCConnectionManager;
import com.inputstick.api.InputStickDataListener;
@ -20,13 +18,12 @@ import com.inputstick.api.InputStickError;
import com.inputstick.api.InputStickStateListener;
import com.inputstick.api.OnEmptyBufferListener;
import com.inputstick.api.Packet;
import com.inputstick.api.Util;
import com.inputstick.api.hid.HIDReport;
import com.inputstick.api.hid.HIDTransaction;
import com.inputstick.api.hid.HIDTransactionQueue;
import com.inputstick.init.BasicInitManager;
import com.inputstick.init.DeviceInfo;
import com.inputstick.init.InitManager;
import com.inputstick.api.init.BasicInitManager;
import com.inputstick.api.init.DeviceInfo;
import com.inputstick.api.init.InitManager;
public class InputStickHID implements InputStickStateListener, InputStickDataListener {
@ -34,8 +31,6 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
public static final int INTERFACE_CONSUMER = 1;
public static final int INTERFACE_MOUSE = 2;
//private static final String mTag = "InputStickBasic";
private static ConnectionManager mConnectionManager;
private static Vector<InputStickStateListener> mStateListeners = new Vector<InputStickStateListener>();
@ -50,10 +45,8 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
private static HIDTransactionQueue consumerQueue;
// >= FW 0.93
private static Timer t1;
private static boolean constantUpdateMode;
//FW 0.93 - 0.95
private static Timer updateQueueTimer;
private static int mKeyboardReportMultiplier; //enables "slow" typing by multiplying HID reports
@ -67,7 +60,6 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
private static void init() {
mHIDInfo = new HIDInfo();
constantUpdateMode = false;
keyboardQueue = new HIDTransactionQueue(INTERFACE_KEYBOARD, mConnectionManager);
mouseQueue = new HIDTransactionQueue(INTERFACE_MOUSE, mConnectionManager);
consumerQueue = new HIDTransactionQueue(INTERFACE_CONSUMER, mConnectionManager);
@ -77,52 +69,138 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
mConnectionManager.connect();
}
//direct Bluetooth connection, custom InitManager (use BT2.0)
//mac - Bluetooth MAC address
//key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password)
public static void connect(Application app, String mac, byte[] key, InitManager initManager) {
connect(app, mac, key, initManager, false);
/*
* Returns download InputStickUtility AlertDialog if InputStickUtility is not installed. Returns null is InputStickUtility application is installed.
* Should be called when your application is started or before InputStick functionality is about to be used.
*
* @return download InputStickUtility AlertDialog or null
*/
public static AlertDialog getDownloadDialog(final Context ctx) {
if (mConnectionManager.getErrorCode() == InputStickError.ERROR_ANDROID_NO_UTILITY_APP) {
return DownloadDialog.getDialog(ctx, DownloadDialog.NOT_INSTALLED);
} else {
return null;
}
}
//direct Bluetooth connection, custom InitManager
//is40 - use true if target device is BluetoothLowEnergy (4.0) type
//mac - Bluetooth MAC address
//key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password)
//is40 - use true if target device is BluetoothLowEnergy (4.0) type
public static void connect(Application app, String mac, byte[] key, InitManager initManager, boolean isBT40) {
mConnectionManager = new BTConnectionManager(initManager, app, mac, key, isBT40);
init();
}
//direct Bluetooth connection
//key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password)
//is40 - use true if target device is BluetoothLowEnergy (4.0) type
public static void connect(Application app, String mac, byte[] key, boolean isBT40) {
mConnectionManager = new BTConnectionManager(new BasicInitManager(key), app, mac, key, isBT40);
init();
}
//direct Bluetooth connection (use BT2.0)
//key - use null if InputStick is not password protected, otherwise provide 16byte key: MD5(password)
public static void connect(Application app, String mac, byte[] key) {
connect(app, mac, key, false);
}
//use InputStickUtility to connect with InputStick
/*
* Connect using InputStickUtility application.
* IN MOST CASES THIS METHOD SHOULD BE USED TO INITIATE CONNECTION!
*
* @param app Application
*/
public static void connect(Application app) {
mConnectionManager = new IPCConnectionManager(app);
init();
}
//closes Bluetooth connection
/*
* Close connection
*/
public static void disconnect() {
if (mConnectionManager != null) {
mConnectionManager.disconnect();
}
}
//requests USB host to resume from sleep mode (must be supported by USB host)
//note: InputStick will most likely be in STATE_CONNECTED state instead of STATE_READY
/*
* Direct connection to InputStick (BT2.1 only!). InputStickUtility application is not required in this case.
* TIP: use Util.getPasswordBytes(plainText) to get key.
*
* @param app Application
* @param mac Bluetooth MAC address
* @param key MD5(password) - must be provided if InputStick is password protected. Use null otherwise
* @param initManager custom init manager
*/
public static void connect(Application app, String mac, byte[] key, InitManager initManager) {
connect(app, mac, key, initManager, false);
}
/*
* Direct connection to InputStick. InputStickUtility application is not required in this case.
* TIP: use Util.getPasswordBytes(plainText) to get key.
*
* @param app Application
* @param mac Bluetooth MAC address
* @param key MD5(password) - must be provided if InputStick is password protected. Use null otherwise
* @param initManager custom init manager
* @param isBT40 specify Bluetooth version. Must match your hardware (InputStick BT2.1 or BT4.0)!
*/
public static void connect(Application app, String mac, byte[] key, InitManager initManager, boolean isBT40) {
mConnectionManager = new BTConnectionManager(initManager, app, mac, key, isBT40);
init();
}
/*
* Direct connection to InputStick. InputStickUtility application is not required in this case.
* TIP: use Util.getPasswordBytes(plainText) to get key.
*
* @param app Application
* @param mac Bluetooth MAC address
* @param key MD5(password) - must be provided if InputStick is password protected. Use null otherwise
* @param initManager custom init manager
* @param isBT40 specify Bluetooth version. Must match your hardware (InputStick BT2.1 or BT4.0)!
*/
public static void connect(Application app, String mac, byte[] key, boolean isBT40) {
mConnectionManager = new BTConnectionManager(new BasicInitManager(key), app, mac, key, isBT40);
init();
}
/*
* Direct connection to InputStick (BT2.1 only!). InputStickUtility application is not required in this case.
* TIP: use Util.getPasswordBytes(plainText) to get key.
*
* @param app Application
* @param mac Bluetooth MAC address
* @param key MD5(password) - must be provided if InputStick is password protected. Use null otherwise
*/
public static void connect(Application app, String mac, byte[] key) {
connect(app, mac, key, false);
}
/*
* When keyboard transactions are queued, each individual HID keyboard report is duplicated by reportMultiplier.
* Allows to control typing speed. Can help with missing characters (for example in BIOS).
* Important! Value of multiplier should be manually restored back to 1, when slow typing is no longer needed!
*
* Example: press and release "a" key:
* 1) Multiplier = 1
* "a" key presses, all keys released
* 2 HID reports, fastest typing speed
* 2) Multiplier = 2
* "a" key presses, "a" key presses, all keys released, all keys released
* 4 HID reports, 50% slower typing speed
*
*
* @param reportMultiplier number by which each HID report will be duplicated
*/
public static void setKeyboardReportMultiplier(int reportMultiplier) {
mKeyboardReportMultiplier = reportMultiplier;
}
/*
* Returns value of keyboard report multiplier
*
* @return keyboard report multiplier
*/
public static int getKeyboardReportMultiplier(int reportMultiplier) {
return mKeyboardReportMultiplier;
}
/*
* Requests USB host to resume from sleep / suspended state. Feature must be supported and enabled by USB host.
* Note 1: when USB host is suspended, device state will be STATE_CONNECTED.
* Note 2: some USB hosts may cut off USB power when suspended.
*/
public static void wakeUpUSBHost() {
if (isConnected()) {
Packet p = new Packet(false, Packet.CMD_USB_RESUME);
@ -131,6 +209,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
/*
* Get device info of connected device
*
* @return Device info of connected device. Null if info is not available
*/
public static DeviceInfo getDeviceInfo() {
if ((isReady()) && (mDeviceInfo != null)) {
return mDeviceInfo;
@ -139,11 +223,22 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
/*
* Get latest status update received from InputStick.
*
* @return latest status update
*/
public static HIDInfo getHIDInfo() {
return mHIDInfo;
}
//returns current connection state
/*
* Returns current state of the connection.
*
* @return state of the connection
*/
public static int getState() {
if (mConnectionManager != null) {
return mConnectionManager.getState();
@ -152,7 +247,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns last error code
/*
* Returns last error code. See class InputStickError.
*
* @return last error code
*/
public static int getErrorCode() {
if (mConnectionManager != null) {
return mConnectionManager.getErrorCode();
@ -161,8 +261,13 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if Bluetooth connection is established between the device and InputStick.
//note - InputStick may be not ready yet to accept keyboard/mouse data
/*
* Checks if Bluetooth connection between Android device and InputStick is established.
* Note - InputStick may be not ready yet to accept keyboard/mouse data.
*
* @return true if Bluetooth connection is established
*/
public static boolean isConnected() {
if ((getState() == ConnectionManager.STATE_READY) || (getState() == ConnectionManager.STATE_CONNECTED)) {
return true;
@ -171,7 +276,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if InputStick is ready for keyboard/mouse data
/*
* Checks if InputStick is ready to accept keyboard/mouse/etc. data.
*
* @return true if InputStick is ready to accept data
*/
public static boolean isReady() {
if (getState() == ConnectionManager.STATE_READY) {
return true;
@ -180,7 +290,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//adds state listener. Listeners will be notified about change of connection state
/*
* Adds InputStickStateListener. Listener will be notified when connection state changes.
*
* @param listener listener to add
*/
public static void addStateListener(InputStickStateListener listener) {
if (listener != null) {
if ( !mStateListeners.contains(listener)) {
@ -190,13 +305,23 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
/*
* Removes InputStickStateListener. Listener will no longer be notified when connection state changes.
*
* @param listener listener to remove
*/
public static void removeStateListener(InputStickStateListener listener) {
if (listener != null) {
mStateListeners.remove(listener);
}
}
//adds buffer listener. Listeners will be notified when local (application) or remote (InputStick) HID report buffer is empty
/*
* Adds OnEmptyBufferListener. Listeners will be notified when local (application) or remote (InputStick) HID report buffer is empty.
*
* @param listener listener to add
*/
public static void addBufferEmptyListener(OnEmptyBufferListener listener) {
if (listener != null) {
if ( !mBufferEmptyListeners.contains(listener)) {
@ -205,25 +330,36 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
/*
* Removes OnEmptyBufferListener.
*
* @param listener listener to remove
*/
public static void removeBufferEmptyListener(OnEmptyBufferListener listener) {
if (listener != null) {
mBufferEmptyListeners.remove(listener);
}
}
/*
* Returns vector with registered OnEmptyBuffer listeners.
*
* @return vector with OnEmptyBuffer listeners
*/
public static Vector<OnEmptyBufferListener> getBufferEmptyListeners() {
return mBufferEmptyListeners;
}
//reports added to keyboard queue will be multiplied by reportMultiplier times. This allows to type text slower.
//NOTE: using high multiplier values can make transactions larger than available buffer and as a result they will be splitted!
//this can cause problem if connection is lost (stuck keys)
//TIP: remember to manually set multiplier value back to 1 when slow typing mode is no longer needed!!!
public static void setKeyboardReportMultiplier(int reportMultiplier) {
mKeyboardReportMultiplier = reportMultiplier;
}
//adds transaction to keyboard queue. If possible, all reports form a signel transactions will be sent in a single packet
/*
* Adds transaction to keyboard queue.
* If possible, all reports form a single transactions will be sent in a single packet.
* This should prevent from key being stuck in pressed position when connection is suddenly lost.
*
* @param transaction transaction to be queued
*/
public static void addKeyboardTransaction(HIDTransaction transaction) {
if ((transaction != null) && (keyboardQueue != null)) {
//keyboardQueue.addTransaction(transaction);
@ -244,42 +380,68 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//adds transaction to mouse queue. If possible, all reports form a signel transactions will be sent in a single packet
/*
* Adds transaction to mouse queue.
* If possible, all reports form a single transactions will be sent in a single packet.
*
* @param transaction transaction to be queued
*/
public static void addMouseTransaction(HIDTransaction transaction) {
if ((transaction != null) && (mouseQueue != null)) {
mouseQueue.addTransaction(transaction);
}
}
//adds transaction to consumer queue. If possible, all reports form a signel transactions will be sent in a single packet
/*
* Adds transaction to consumer control queue.
* If possible, all reports form a single transactions will be sent in a single packet.
*
* @param transaction transaction to be queued
*/
public static void addConsumerTransaction(HIDTransaction transaction) {
if ((transaction != null) && (consumerQueue != null)) {
consumerQueue.addTransaction(transaction);
}
}
//removes all reports from keyboard buffer
/*
* Removes all reports from keyboard buffer.
*/
public static void clearKeyboardBuffer() {
if (keyboardQueue != null) {
keyboardQueue.clearBuffer();
}
}
//removes all reports from mouse buffer
/*
* Removes all reports from mouse buffer.
*/
public static void clearMouseBuffer() {
if (mouseQueue != null) {
mouseQueue.clearBuffer();
}
}
//removes all reports from consumer buffer
/*
* Removes all reports from consumer control buffer.
*/
public static void clearConsumerBuffer() {
if (consumerQueue != null) {
consumerQueue.clearBuffer();
}
}
//sends packet to InputStick
/*
* Sends custom packet to InputStick.
*
* @param p packet to send.
*/
public static boolean sendPacket(Packet p) {
if (mConnectionManager != null) {
mConnectionManager.sendPacket(p);
@ -289,18 +451,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
@Override
public void onStateChanged(int state) {
if ((state == ConnectionManager.STATE_DISCONNECTED) && (t1 != null)) {
t1.cancel();
t1 = null;
}
for (InputStickStateListener listener : mStateListeners) {
listener.onStateChanged(state);
}
}
//returns true if local (application) keyboard report buffer is empty. It is still possible that there are reports queued in InputStick's buffer.
/*
* Checks if local (Android device) keyboard report buffer is empty. It is possible that there are reports queued in InputStick's buffer.
*
* @return true if local keyboard buffer is empty, false otherwise
*/
public static boolean isKeyboardLocalBufferEmpty() {
if (keyboardQueue != null) {
return keyboardQueue.isLocalBufferEmpty();
@ -309,7 +465,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if local (application) mouse report buffer is empty. It is still possible that there are reports queued in InputStick's buffer.
/*
* Checks if local (Android device) mouse report buffer is empty. It is possible that there are reports queued in InputStick's buffer.
*
* @return true if local mouse buffer is empty, false otherwise
*/
public static boolean isMouseLocalBufferEmpty() {
if (mouseQueue != null) {
return mouseQueue.isLocalBufferEmpty();
@ -318,7 +479,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if local (application) consumer report buffer is empty. It is still possible that there are reports queued in InputStick's buffer.
/*
* Checks if local (Android device) consumer control report buffer is empty. It is possible that there are reports queued in InputStick's buffer.
*
* @return true if local consumer control buffer is empty, false otherwise
*/
public static boolean isConsumerLocalBufferEmpty() {
if (consumerQueue != null) {
return consumerQueue.isLocalBufferEmpty();
@ -327,7 +493,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if remote (InputStick) keyboard report buffer is empty. No more keyboard reports will be send to USB host
/*
* Checks if local (Android device) AND remote (InputStick) keyboard report buffers are empty.
*
* @return true if local and remote keyboard buffers are empty, false otherwise
*/
public static boolean isKeyboardRemoteBufferEmpty() {
if (keyboardQueue != null) {
return keyboardQueue.isRemoteBufferEmpty();
@ -336,7 +507,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if remote (InputStick) mouse report buffer is empty. No more mouse reports will be send to USB host
/*
* Checks if local (Android device) AND remote (InputStick) mouse report buffers are empty.
*
* @return true if local and remote mouse buffers are empty, false otherwise
*/
public static boolean isMouseRemoteBufferEmpty() {
if (mouseQueue != null) {
return mouseQueue.isRemoteBufferEmpty();
@ -345,7 +521,12 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns true if remote (InputStick) consumer report buffer is empty. No more consumer reports will be send to USB host
/*
* Checks if local (Android device) AND remote (InputStick) consumer control report buffers are empty.
*
* @return true if local and remote consumer control buffers are empty, false otherwise
*/
public static boolean isConsumerRemoteBufferEmpty() {
if (consumerQueue != null) {
return consumerQueue.isRemoteBufferEmpty();
@ -354,6 +535,22 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
@Override
public void onStateChanged(int state) {
if ((state == ConnectionManager.STATE_DISCONNECTED) && (updateQueueTimer != null)) {
updateQueueTimer.cancel();
updateQueueTimer = null;
}
for (InputStickStateListener listener : mStateListeners) {
listener.onStateChanged(state);
}
}
@Override
public void onInputStickData(byte[] data) {
byte cmd = data[0];
@ -370,18 +567,18 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
mouseQueue.deviceReady(mHIDInfo, mHIDInfo.getMouseReportsSentToHost());
consumerQueue.deviceReady(mHIDInfo, mHIDInfo.getConsumerReportsSentToHost());
if ( !constantUpdateMode) {
Util.log("Constatnt update mode enabled");
constantUpdateMode = true;
t1 = new Timer();
t1.schedule(new TimerTask() {
@Override
public void run() {
keyboardQueue.sendToBuffer(false);
mouseQueue.sendToBuffer(false);
consumerQueue.sendToBuffer(false);
}
}, 5,5);
if (mDeviceInfo != null) {
if ((updateQueueTimer == null) && (mDeviceInfo.getFirmwareVersion() < 97)) {
updateQueueTimer = new Timer();
updateQueueTimer.schedule(new TimerTask() {
@Override
public void run() {
keyboardQueue.sendToBuffer(false);
mouseQueue.sendToBuffer(false);
consumerQueue.sendToBuffer(false);
}
}, 5, 5);
}
}
} else {
//previous FW versions
@ -400,42 +597,6 @@ public class InputStickHID implements InputStickStateListener, InputStickDataLis
}
}
//returns "Download InputStickUtility" dialog, if connection attepmt resulted in error caused by InputStickUtility not being installed on the device.
//otherwise returns null
public static AlertDialog getDownloadDialog(final Context ctx) {
if (mConnectionManager.getErrorCode() == InputStickError.ERROR_ANDROID_NO_UTILITY_APP) {
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(ctx);
downloadDialog.setTitle("No InputStickUtility app installed");
downloadDialog.setMessage("InputStickUtility is required to run this application. Download now?\nNote: InputStick USB receiver hardware is also required.");
downloadDialog.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
final String appPackageName = "com.inputstick.apps.inputstickutility";
try {
ctx.startActivity(new Intent(
Intent.ACTION_VIEW, Uri
.parse("market://details?id="
+ appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
ctx.startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id="
+ appPackageName)));
}
}
});
downloadDialog.setNegativeButton("No",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
return downloadDialog.show();
} else {
return null;
}
}
}

View File

@ -8,11 +8,10 @@ import com.inputstick.api.InputStickKeyboardListener;
import com.inputstick.api.hid.HIDKeycodes;
import com.inputstick.api.hid.HIDTransaction;
import com.inputstick.api.hid.KeyboardReport;
import com.inputstick.api.layout.KeyboardLayout;
public class InputStickKeyboard {
//private static final String mTag = "InputStickKeyboard";
private static final byte NONE = (byte)0;
private static final byte LED_NUM_LOCK = 1;
@ -38,78 +37,13 @@ public class InputStickKeyboard {
private InputStickKeyboard() {
}
//listener will be notified when status of keyboard LEDs changes (NumLock, CapsLock, ScrollLock)
public static void addKeyboardListener(InputStickKeyboardListener listener) {
if (listener != null) {
if ( !mKeyboardListeners.contains(listener)) {
mKeyboardListeners.add(listener);
}
}
}
public static void removeKeyboardListener(InputStickKeyboardListener listener) {
if (listener != null) {
mKeyboardListeners.remove(listener);
}
}
protected void setReportProtocol(boolean reportProtocol) {
mReportProtocol = reportProtocol;
}
public boolean isReportProtocol() {
return mReportProtocol;
}
protected static void setLEDs(boolean numLock, boolean capsLock, boolean scrollLock) {
boolean mustUpdate = false;
if ((numLock != mNumLock) || (capsLock != mCapsLock) || (scrollLock != mScrollLock)) {
mustUpdate = true;
}
mNumLock = numLock;
mCapsLock = capsLock;
mScrollLock = scrollLock;
if (mustUpdate) {
for (InputStickKeyboardListener listener : mKeyboardListeners) {
listener.onLEDsChanged(mNumLock, mCapsLock, mScrollLock);
}
}
}
//returns true if NumLock LED is set to ON by USB host, otherwise false is returned.
public static boolean isNumLock() {
return mNumLock;
}
//returns true if CapsLock LED is set to ON by USB host, otherwise false is returned.
public static boolean isCapsLock() {
return mCapsLock;
}
//returns true if ScrollLock LED is set to ON by USB host, otherwise false is returned.
public static boolean isScrollLock() {
return mScrollLock;
}
//same as pressing NumLock key
public static void toggleNumLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_NUM_LOCK);
}
//same as pressing CapsLock key
public static void toggleCapsLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_CAPS_LOCK);
}
//same as pressing ScrollLock key
public static void toggleScrollLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_SCROLL_LOCK);
}
//following key combination will be pressed and immediately released
//modifier - see HIDKeycodes (CTRL_LEFT .. GUI_RIGHT)
//key - see HIDKeycodes
/*
* Uses InputStick to press and then immediately release key combination specified by parameters.
*
* @param modifier state of modifier keys (CTRL_LEFT .. GUI_RIGHT, see HIDKeycodes)
* @param key non-modifier key (see HIDKeycodes)
*/
public static void pressAndRelease(byte modifier, byte key) {
HIDTransaction t = new HIDTransaction();
t.addReport(new KeyboardReport(modifier, NONE));
@ -118,7 +52,26 @@ public class InputStickKeyboard {
InputStickHID.addKeyboardTransaction(t);
}
//types text assuming that USB host uses en-US keyboard layout.
/*
* Type text via InputStick, using selected keyboard layout. USB host must use matching keyboard layout.
* For available keyboard layouts see: com.inputstick.api.layout.
* If layout is null or not found, en-US will be used.
*
* @param toType text to type
* @param layoutCode code of keyboard layout ("en-US", "de-DE", etc.)
*/
public static void type(String toType, String layoutCode) {
KeyboardLayout layout = KeyboardLayout.getLayout(layoutCode);
layout.type(toType);
}
/*
* Type text via InputStick. ASCII characters only! It is assumed that USB host uses en-US keyboard layout.
*
* @param toType text to type
*/
public static void typeASCII(String toType) {
int keyCode;
int index;
@ -144,15 +97,101 @@ public class InputStickKeyboard {
}
}
//modifier - see HIDKeycodes (CTRL_LEFT .. GUI_RIGHT)
//key0..key5 - see HIDKeycodes
//note: keys will not be released until next report is sent!
/*
* Sends custom keyboard HID report.
* Note: keys must be "manually" released by sending next custom HID report (with 0x00s as key0..key5).
*
* @param modifier state of modifier keys (CTRL_LEFT .. GUI_RIGHT, see HIDKeycodes)
* @param key0 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
* @param key1 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
* @param key2 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
* @param key3 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
* @param key4 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
* @param key5 non modifier keyboard key (see HIDKeycodes). Use 0x00 when no key is pressed.
*/
public static void customReport(byte modifier, byte key0, byte key1, byte key2, byte key3, byte key4, byte key5) {
HIDTransaction t = new HIDTransaction();
t.addReport(new KeyboardReport(modifier, key0, key1, key2, key3, key4, key5));
InputStickHID.addKeyboardTransaction(t);
}
/*
* Checks is report protocol is used.
* Report protocol is in most cases used by OS
* Boot protocol is used by BIOS, or when OS is booting
*
* @return true if USB host uses report protocol, false if USB host uses boot protocol
*/
public boolean isReportProtocol() {
return mReportProtocol;
}
/*
* Checks states of NumLock keyboard LED
*
* @return true if NumLock LED is on, false if off.
*/
public static boolean isNumLock() {
return mNumLock;
}
/*
* Checks states of CapsLock keyboard LED
*
* @return true if CapsLock LED is on, false if off.
*/
public static boolean isCapsLock() {
return mCapsLock;
}
/*
* Checks states of ScrollLock keyboard LED
*
* @return true if ScrollLock LED is on, false if off.
*/
public static boolean isScrollLock() {
return mScrollLock;
}
/*
* Toggle state of NumLock by press and release NumLock key.
*/
public static void toggleNumLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_NUM_LOCK);
}
/*
* Toggle state of CapsLock by press and release CapsLock key.
*/
public static void toggleCapsLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_CAPS_LOCK);
}
/*
* Toggle state of ScrollLock by press and release ScrollLock key.
*/
public static void toggleScrollLock() {
pressAndRelease(NONE, HIDKeycodes.KEY_SCROLL_LOCK);
}
/*
* Converts state of keyboard LEDs to String. Example: "CapsLock, ScrollLock".
*
* @return String description of keyboard LEDs.
*/
public static String ledsToString(byte leds) {
String result = "None";
boolean first = true;
@ -173,4 +212,52 @@ public class InputStickKeyboard {
return result;
}
/*
* Adds InputStickKeyboardListener. Listener will be notified when state of keyboard LEDs changes (NumLock, CapsLock, ScrollLock).
*
* @param listener listener to add
*/
public static void addKeyboardListener(InputStickKeyboardListener listener) {
if (listener != null) {
if ( !mKeyboardListeners.contains(listener)) {
mKeyboardListeners.add(listener);
}
}
}
/*
* Removes InputStickKeyboardListener.
*
* @param listener listener to remove
*/
public static void removeKeyboardListener(InputStickKeyboardListener listener) {
if (listener != null) {
mKeyboardListeners.remove(listener);
}
}
protected void setReportProtocol(boolean reportProtocol) {
mReportProtocol = reportProtocol;
}
protected static void setLEDs(boolean numLock, boolean capsLock, boolean scrollLock) {
boolean mustUpdate = false;
if ((numLock != mNumLock) || (capsLock != mCapsLock) || (scrollLock != mScrollLock)) {
mustUpdate = true;
}
mNumLock = numLock;
mCapsLock = capsLock;
mScrollLock = scrollLock;
if (mustUpdate) {
for (InputStickKeyboardListener listener : mKeyboardListeners) {
listener.onLEDsChanged(mNumLock, mCapsLock, mScrollLock);
}
}
}
}

View File

@ -29,15 +29,13 @@ public class InputStickMouse {
}
protected void setReportProtocol(boolean reportProtocol) {
mReportProtocol = reportProtocol;
}
public boolean isReportProtocol() {
return mReportProtocol;
}
//clicks button (BUTTON_LEFT..BUTTON_MIDDLE) n times.
/*
* Clicks selected mouse button (BUTTON_LEFT etc) N times
*
* @param button code of mouse button
* @param n number of button clicks (press and release events)
*/
public static void click(byte button, int n) {
HIDTransaction t = new HIDTransaction();
t.addReport(new MouseReport()); //release
@ -48,14 +46,23 @@ public class InputStickMouse {
InputStickHID.addMouseTransaction(t);
}
//moves mouse pointer by x,y
/*
* Move mouse pointer
*
* @param x x displacement
* @param y y dispalcement
*/
public static void move(byte x, byte y) {
HIDTransaction t = new HIDTransaction();
t.addReport(new MouseReport(NONE, x, y, NONE));
InputStickHID.addMouseTransaction(t);
}
//moves scroll wheel by "wheel"
/*
* Moves mouse scroll wheel
*
* @param wheel scroll wheel displacement
*/
public static void scroll(byte wheel) {
HIDTransaction t = new HIDTransaction();
t.addReport(new MouseReport(NONE, NONE, NONE, wheel));
@ -63,12 +70,27 @@ public class InputStickMouse {
}
//sends custom mouse report (buttons will remain in pressed state until released by next report)
/*
* Sends custom HID mouse report. Mouse buttons will remain in selected state until new report is received.
*
* @param buttons state of mouse buttons
* @param x x displacement
* @param y y dispalcement
* @param wheel scroll wheel displacement
*/
public static void customReport(byte buttons, byte x, byte y, byte wheel) {
HIDTransaction t = new HIDTransaction();
t.addReport(new MouseReport(buttons, x, y, wheel));
InputStickHID.addMouseTransaction(t);
}
/*
* Returns names of buttons in "pressed" state
*
* @param buttons state of mouse buttons
*/
public static String buttonsToString(byte buttons) {
String result = "None";
boolean first = true;
@ -89,4 +111,21 @@ public class InputStickMouse {
return result;
}
/*
* When report protocol is used, scroll wheel is enabled. Otherwise, simplified boot protocol is selected by USB host.
* Report protocol is in most cases used by OS.
* Boot protocol is used by BIOS, or when OS is booting.
*
* @return true if USB host uses report protocol, false if USB host uses boot protocol
*/
public boolean isReportProtocol() {
return mReportProtocol;
}
protected void setReportProtocol(boolean reportProtocol) {
mReportProtocol = reportProtocol;
}
}

View File

@ -119,18 +119,12 @@ public class BT20Connection extends BTConnection {
return;
}
//synchronized (BTService.this) {
mConnectThread = null; //TODO
//}
//connected(mmSocket, mmDevice); :
mConnectThread = null;
cancelThreads();
//receiver
// Start the thread to manage the connection and perform transmissions
//now connected:
mConnectedThread = new ConnectedThread(mmSocket);
mConnectedThread.start();
mBTservice.connectedEstablished();
}

View File

@ -1,10 +1,8 @@
package com.inputstick.api.bluetooth;
import java.util.LinkedList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.Vector;
import android.annotation.SuppressLint;
import android.app.Application;
@ -18,6 +16,7 @@ import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.os.Handler;
import com.inputstick.api.InputStickError;
import com.inputstick.api.Util;
@ -25,10 +24,12 @@ import com.inputstick.api.Util;
@SuppressLint("NewApi")
public class BT40Connection extends BTConnection {
private static String MOD_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
private static String MOD_CONF = "0000ffe0-0000-1000-8000-00805f9b34fb";
private static String MOD_RX_TX = "0000ffe1-0000-1000-8000-00805f9b34fb";
private final static UUID UUID_HM_RX_TX = UUID.fromString(MOD_RX_TX);
private static final int CONNECTION_TIMEOUT = 10000;
private static final String MOD_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
private static final String MOD_CONF = "0000ffe0-0000-1000-8000-00805f9b34fb";
private static final String MOD_RX_TX = "0000ffe1-0000-1000-8000-00805f9b34fb";
private static final UUID UUID_HM_RX_TX = UUID.fromString(MOD_RX_TX);
private BluetoothManager mBluetoothManager;
private BluetoothAdapter mBluetoothAdapter;
@ -36,11 +37,11 @@ public class BT40Connection extends BTConnection {
private BluetoothGattCharacteristic characteristicTX;
private BluetoothGattCharacteristic characteristicRX;
private static final int REFRESH_INTERVAL = 10;
private Timer t1;
private Vector<byte[]> txBuffer;
private LinkedList<byte[]> txBuffer;
private boolean canSend;
private boolean isConnecting;
private Handler handler;
public BT40Connection(Application app, BTService btService, String mac, boolean reflections) {
super(app, btService, mac, reflections);
@ -54,6 +55,18 @@ public class BT40Connection extends BTConnection {
final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mMac);
if (device != null) {
mBluetoothGatt = device.connectGatt(mCtx, false, mGattCallback);
isConnecting = true;
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (isConnecting) {
disconnect();
mBTservice.connectionFailed(true, 0);
}
}
}, CONNECTION_TIMEOUT);
} else {
mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_NO_REMOTE_DEVICE);
}
@ -62,14 +75,6 @@ public class BT40Connection extends BTConnection {
@Override
public void disconnect() {
txBuffer = null;
try {
if (t1 != null) {
t1.cancel();
t1 = null;
}
} catch (Exception e) {
}
try {
if (mBluetoothGatt != null) {
mBluetoothGatt.close();
@ -90,6 +95,8 @@ public class BT40Connection extends BTConnection {
//SPECIAL CASES for flashing utility
if (Util.flashingToolMode) {
//txBuffer.add(out);
//return;
if (out.length == 1) {
txBuffer.add(out);
return;
@ -122,7 +129,7 @@ public class BT40Connection extends BTConnection {
offset += 16;
addData16(tmp);
}
sendNext();
}
}
@ -161,8 +168,7 @@ public class BT40Connection extends BTConnection {
private synchronized byte[] getData() {
if (txBuffer != null) {
if (!txBuffer.isEmpty()) {
byte[] data = txBuffer.firstElement();
txBuffer.removeElementAt(0);
byte[] data = txBuffer.poll();
return data;
}
}
@ -175,6 +181,8 @@ public class BT40Connection extends BTConnection {
if (data != null) {
canSend = false;
characteristicTX.setValue(data);
characteristicTX.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE); //TODO
//characteristicTX.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT); //TODO
mBluetoothGatt.writeCharacteristic(characteristicTX);
}
}
@ -187,9 +195,11 @@ public class BT40Connection extends BTConnection {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
isConnecting = false;
Util.log("Connected to GATT server.");
Util.log("Attempting to start service discovery:" + mBluetoothGatt.discoverServices());
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
isConnecting = false;
Util.log("Disconnected from GATT server.");
mBTservice.connectionFailed(false, InputStickError.ERROR_BLUETOOTH_CONNECTION_LOST);
}
@ -231,15 +241,7 @@ public class BT40Connection extends BTConnection {
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
txBuffer = new Vector<byte[]>();
t1 = new Timer();
t1.schedule(new TimerTask() {
@Override
public void run() {
sendNext();
}
}, REFRESH_INTERVAL, REFRESH_INTERVAL);
txBuffer = new LinkedList<byte[]>();
canSend = true;
sendNext();
@ -266,10 +268,8 @@ public class BT40Connection extends BTConnection {
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
byte b[] = characteristic.getValue();
if (b != null) {
for (int i = 0; i < b.length; i++) {
mBTservice.onByteRx(b[i]);
}
} //TODO error code?
mBTservice.onByteRx(b);
}
}
@Override

View File

@ -204,8 +204,14 @@ public class BTService {
}
protected void onByteRx(int rxByte) {
mPacketReader.rxByte(rxByte);
protected synchronized void onByteRx(int rxByte) {
mPacketReader.rxByte((byte)rxByte);
}
protected synchronized void onByteRx(byte[] rxBytes) {
for (int i = 0; i < rxBytes.length; i++) {
mPacketReader.rxByte(rxBytes[i]);
}
}

View File

@ -30,8 +30,8 @@ public class PacketReader {
}
public void rxByte(int rxByte) {
byte b = (byte)rxByte;
public void rxByte(byte b) {
//byte b = (byte)rxByte;
long time = System.currentTimeMillis();
if (time > lastRxTime + RX_TIMEOUT) {
rxState = RX_TAG;

View File

@ -0,0 +1,430 @@
package com.inputstick.api.broadcast;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import com.inputstick.api.DownloadDialog;
/*
* IMPORTANT:
*
* Using InputStickBroadcast is the easiest and fastest way to use InputStick with your application.
* InputStickUility takes care of almost everything:
* -enabling Bluetooth if necessary,
* -selecting InputStick device (if more than one is available),
* -establishing connection,
* -deals with potential connection problems (connection failed, lost),
* -user preferences (keyboard layout, typing speed).
*
* as a result of that, your application has little to no control over:
* -connection,
* -buffers
* -timing,
*
*
* Using InputStickBroadcast is recommended only for simple use cases: typing strings.
* Example: barcode scanner app, assuming that user will use InputStick to type only some of scanned codes.
*
* Using InputStickBroadcast is NOT recommended if
* -timing is critical,
* -low latency is necessary,
* -many actions can be executed in a short period of time
*
* Example: remote control app.
*
* In such case use classes from com.inputstick.api.hid package and implement all necessary callbacks.
*
*/
public class InputStickBroadcast {
private static boolean AUTO_SUPPORT_CHECK;
public static final String PARAM_REQUEST = "REQUEST";
public static final String PARAM_RELEASE = "RELEASE";
public static final String PARAM_CLEAR = "CLEAR";
public static final String PARAM_TEXT = "TEXT";
public static final String PARAM_LAYOUT = "LAYOUT";
public static final String PARAM_MULTIPLIER = "MULTIPLIER";
public static final String PARAM_KEY = "KEY";
public static final String PARAM_MODIFIER = "MODIFIER";
public static final String PARAM_REPORT_KEYB = "REPORT_KEYB";
public static final String PARAM_REPORT_EMPTY = "REPORT_EMPTY";
public static final String PARAM_REPORT_MOUSE = "REPORT_MOUSE";
public static final String PARAM_MOUSE_BUTTONS ="MOUSE_BUTTONS";
public static final String PARAM_MOUSE_CLICKS = "MOUSE_CLICKS";
public static final String PARAM_CONSUMER = "CONSUMER";
/*
* Checks whether InputStickUtility is installed and supports intents (version code >= 11).
* Optionally download dialog can be displayed if InputStickUtility is not installed.
*
* @param ctx context
* @param allowMessages when true, download dialog will be displayed if necessary
*
*/
public static boolean isSupported(Context ctx, boolean allowMessages) {
PackageInfo pInfo;
try {
pInfo = ctx.getPackageManager().getPackageInfo("com.inputstick.apps.inputstickutility", 0);
//System.out.println("ver: " + pInfo.versionName + " code: " + pInfo.versionCode);
if (pInfo.versionCode < 11) {
if (allowMessages) {
DownloadDialog.getDialog(ctx, DownloadDialog.NOT_UPDATED).show();
}
return false;
} else {
return true;
}
} catch (NameNotFoundException e) {
//e.printStackTrace();
//InputStickUtility not installed
if (allowMessages) {
DownloadDialog.getDialog(ctx, DownloadDialog.NOT_INSTALLED).show();
}
return false;
}
}
/*
* When Auto Support Check is enabled, isSupported(ctx, true) will be called each time before sending broadcast.
* You do not have to check support manually. Download dialog will be displayed if InputStickUtility is not installed.
*
* WARNING: checking support each time after sending broadcast can be very time consuming!!!
*
* @param enabled true to enable Auto Support Check, false to disable
*/
public static void setAutoSupportCheck(boolean enabled) {
AUTO_SUPPORT_CHECK = enabled;
}
/*
* Indicates that it is very likely that this application will want to use InputStick within next few seconds.
* Depending on user preferences this action may be ignored! In such case InputStickUtility will wait until some data arrives (text etc.).
* In many cases this will allow to reduce delay between requesting some action and executing it (typing text etc).
*
* @param ctx context used to send broadcast.
*/
public static void requestConnection(Context ctx) {
Intent intent = new Intent();
intent.putExtra(PARAM_REQUEST, true);
send(ctx, intent);
}
/*
* Indicates that application will no longer need InputStick in nearest future.
* Allows to save power.
* Depending on user preferences this action may be ignored!
* Ignored if not connected.
*
* @param ctx context used to send broadcast.
*/
public static void releaseConnection(Context ctx) {
Intent intent = new Intent();
intent.putExtra(PARAM_RELEASE, true);
send(ctx, intent);
}
/*
* Removes all actions from queue. Clears all interface buffers.
* Use to immediately stop all actions
* Depending on user preferences this action may be ignored!
*
* @param ctx context used to send broadcast.
*/
public static void clearQueue(Context ctx) {
Intent intent = new Intent();
intent.putExtra(PARAM_CLEAR, true);
send(ctx, intent);
}
//#######################################################################################################
//##### KEYBOARD INTERFACE ##############################################################################
//#######################################################################################################
/*
* Puts "type text" action into queue. Fastest typing speed, use en-US layout.
*
* @param ctx context used to send broadcast.
* @param text text to be typed. \n and \t characters are allowed.
*/
public static void type(Context ctx, String text) {
type(ctx, text, null, 1);
}
/*
* Puts "type text" action into queue. Fastest typing speed.
*
* Keyboard layout must match layout used by USB host. en-US is used by default.
* Depending on user preferences value of layoutCode may be ignored!
*
* @param ctx context used to send broadcast
* @param text text to be typed. \n and \t characters are allowed.
* @param layoutCode keyboard layout to be used: en-US, de-DE, pl-PL etc.
*/
public static void type(Context ctx, String text, String layoutCode) {
type(ctx, text, layoutCode, 1);
}
/*
* Puts "type text" action into queue.
*
* Keyboard layout must match layout used by USB host. en-US is used by default.
* Depending on user preferences value of layoutCode may be ignored!
*
* When multiplier is set to 1, keys will be "pressed" at fastest possible speed. Increase value of this parameter to obtain slower typing speed, by multiplying number of HID keyboard reports.
* Depending on user preferences value of multiplier may be ignored!
*
* @param ctx context used to send broadcast
* @param text text to be typed. \n and \t characters are allowed.
* @param layoutCode keyboard layout to be used: en-US, de-DE, pl-PL etc.
* @param multiplier controls typing speed.
*/
public static void type(Context ctx, String text, String layoutCode, int multiplier) {
Intent intent = new Intent();
intent.putExtra(PARAM_TEXT, text);
if (layoutCode != null) {
intent.putExtra(PARAM_LAYOUT, layoutCode);
}
if (multiplier > 1) {
intent.putExtra(PARAM_MULTIPLIER, multiplier);
}
send(ctx, intent);
}
/*
* Puts "press and release key" action into queue.
*
* @param ctx context used to send broadcast.
* @param modifiers modifier keys: Shift, Alt, Ctrl, Gui/Win/Command keys, (see HIDKeycodes class.
* @param key any non-modifier key, see HIDKeycodes class.
*/
public static void pressAndRelease(Context ctx, byte modifiers, byte key) {
pressAndRelease(ctx, modifiers, key, 1);
}
/*
* Puts "press and release key" action into queue.
* When multiplier is set to 1, keys will be "pressed" at fastest possible speed. Increase value of this parameter to obtain slower typing speed, by multiplying number of HID reports.
*
* @param ctx context used to send broadcast.
* @param modifiers modifier keys: Shift, Alt, Ctrl, Gui/Win/Command keys, (see HIDKeycodes class).
* @param key any non-modifier key, see HIDKeycodes class.
* @param multiplier controls typing speed.
*/
public static void pressAndRelease(Context ctx, byte modifiers, byte key, int multiplier) {
Intent intent = new Intent();
intent.putExtra(PARAM_MODIFIER, modifiers);
intent.putExtra(PARAM_KEY, key);
if (multiplier > 1) {
intent.putExtra(PARAM_MULTIPLIER, multiplier);
}
send(ctx, intent);
}
/*
* Puts single HID keyboard report into queue.
* HID keyboard report represents state of keyboard (which keys are pressed) at a given moment.
* Must be 8 bytes long:
* report[0] = modifier keys
* report[1] = 0x00
* report[2] = key1
* report[3] = key2
* report[4] = key3
* report[5] = key4
* report[6] = key5
* report[7] = key6
* To avoid keys getting "stuck" they should be released (by adding empty report).
*
* @param ctx context used to send broadcast.
* @param report HID keyboard report.
* @param addEmptyReport empty keyboard report (all keys released) will be added if true.
*/
public static void keyboardReport(Context ctx, byte[] report, boolean addEmptyReport) {
Intent intent = new Intent();
intent.putExtra(PARAM_REPORT_KEYB, report);
if (addEmptyReport) {
intent.putExtra(PARAM_REPORT_EMPTY, true);
}
send(ctx, intent);
}
/*
* Puts single HID keyboard report into queue.
* HID keyboard report represents state of keyboard (which keys are pressed) at a given moment.
* To avoid keys getting "stuck" they should be released (by adding empty report).
*
* @param ctx context used to send broadcast.
* @param modifiers modifier keys: Shift, Alt, Ctrl, Gui/Win/Command keys, (see HIDKeycodes class).
* @param key1 any non-modifier key, see HIDKeycodes class.
* @param key2 any non-modifier key, see HIDKeycodes class.
* @param key3 any non-modifier key, see HIDKeycodes class.
* @param key4 any non-modifier key, see HIDKeycodes class.
* @param key5 any non-modifier key, see HIDKeycodes class.
* @param key6 any non-modifier key, see HIDKeycodes class.
* @param addEmptyReport empty keyboard report (all keys released) will be added if true.
*/
public static void keyboardReport(Context ctx, byte modifiers, byte key1, byte key2, byte key3, byte key4, byte key5, byte key6, boolean addEmptyReport) {
byte[] report = new byte[8];
report[0] = modifiers;
report[2] = key1;
report[3] = key2;
report[4] = key3;
report[5] = key4;
report[6] = key5;
report[7] = key6;
keyboardReport(ctx, report, addEmptyReport);
}
//#######################################################################################################
//##### MOUSE INTERFACE #################################################################################
//#######################################################################################################
/*
* Puts single HID mouse report into queue.
* HID mouse report represents change in state of a mouse.
* Must be 4 bytes long:
* report[0] = buttons
* report[1] = x axis displacement
* report[2] = y axis displacement
* report[3] = scroll wheel displacement
*
* @param ctx context used to send broadcast.
* @param report HID mouse report.
*/
public static void mouseReport(Context ctx, byte[] report) {
Intent intent = new Intent();
intent.putExtra(PARAM_REPORT_MOUSE, report);
send(ctx, intent);
}
/*
* Puts single HID mouse report into queue.
* Left mouse button = 0x01
* Right mouse button = 0x02
* Middle mouse button = 0x04
*
* @param ctx context used to send broadcast.
* @param buttons mouse buttons to click.
* @param dx x axis displacement.
* @param dy y axis displacement.
* @param scroll scroll wheel displacement.
*/
public static void mouseReport(Context ctx, byte buttons, byte dx, byte dy, byte scroll) {
byte[] report = new byte[4];
report[0] = buttons;
report[1] = dx;
report[2] = dy;
report[3] = scroll;
mouseReport(ctx, report);
}
/*
* Puts mouse click (button(s) press-release) action into queue.
* Left mouse button = 0x01
* Right mouse button = 0x02
* Middle mouse button = 0x04
*
* @param ctx context used to send broadcast.
* @param buttons mouse buttons to click.
* @param n number of clicks.
*/
public static void mouseClick(Context ctx, byte buttons, int n) {
Intent intent = new Intent();
intent.putExtra(PARAM_MOUSE_BUTTONS, buttons);
intent.putExtra(PARAM_MOUSE_CLICKS, n);
send(ctx, intent);
}
/*
* Puts mouse move action into queue.
*
* @param ctx context used to send broadcast.
* @param dx x axis displacement.
* @param dy y axis displacement.
*/
public static void mouseMove(Context ctx, byte dx, byte dy) {
mouseReport(ctx, (byte)0x00, dx, dy, (byte)0x00);
}
/*
* Puts mouse scroll action into queue.
* Positive values: scroll up; negative values: scroll down
*
* @param ctx context used to send broadcast.
* @param scroll scroll wheel displacement.
*/
public static void mouseScroll(Context ctx, byte scroll) {
mouseReport(ctx, (byte)0x00, (byte)0x00, (byte)0x00, scroll);
}
//#######################################################################################################
//##### CONSUMER CONTROL INTERFACE ######################################################################
//#######################################################################################################
/*
* Puts "consumer" action into queue. See InputStickConsumer class for list available actions.
*
* @param ctx context used to send broadcast.
* @param action code of consumer action.
*/
public static void consumerControlAction(Context ctx, int action) {
Intent intent = new Intent();
intent.putExtra(PARAM_CONSUMER, action);
send(ctx, intent);
}
private static void send(Context ctx, Intent intent) {
intent.setAction("com.inputstick.apps.inputstickutility.HID");
intent.setClassName("com.inputstick.apps.inputstickutility", "com.inputstick.apps.inputstickutility.service.HIDReceiver");
//if necessary, show download dialog message
if (AUTO_SUPPORT_CHECK) {
if (isSupported(ctx, true)) {
ctx.sendBroadcast(intent);
}
} else {
ctx.sendBroadcast(intent);
}
}
}

View File

@ -1,14 +1,14 @@
package com.inputstick.api.hid;
import java.util.Vector;
import java.util.LinkedList;
public class HIDTransaction {
private int mID;
private Vector<HIDReport> reports;
private LinkedList<HIDReport> reports;
public HIDTransaction() {
reports = new Vector<HIDReport>();
reports = new LinkedList<HIDReport>();
}
public void addReport(HIDReport report) {
@ -32,14 +32,11 @@ public class HIDTransaction {
}
public byte[] getNextReport() {
byte[] report;
report = reports.elementAt(0).getBytes();
reports.removeElementAt(0);
return report;
return reports.poll().getBytes();
}
public HIDReport getHIDReportAt(int pos) {
return reports.elementAt(pos);
return reports.get(pos);
}
public HIDTransaction split(int n) {
@ -47,8 +44,7 @@ public class HIDTransaction {
HIDReport report;
if (n <= reports.size()) {
while(n > 0) {
report = reports.firstElement();
reports.remove(0);
report = reports.poll();
result.addReport(report);
n--;
}

View File

@ -1,5 +1,6 @@
package com.inputstick.api.hid;
import java.util.LinkedList;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
@ -18,7 +19,7 @@ public class HIDTransactionQueue {
private static final int MAX_PACKETS_PER_UPDATE = 10;
private static final int MAX_IMMEDIATE_PACKETS = 3;
private final Vector<HIDTransaction> queue;
private final LinkedList<HIDTransaction> queue;
private final ConnectionManager mConnectionManager;
private final byte cmd;
private boolean ready;
@ -39,16 +40,16 @@ public class HIDTransactionQueue {
private boolean constantUpdateMode;
private int bufferFreeSpace;
private int immediatePacketsLeft;
//private int reportsSentSinceLastUpdate;
private int packetsSentSinceLastUpdate;
private int interfaceReadyCnt; //fix BT4.0 lost packet problem
public HIDTransactionQueue(int interfaceType, ConnectionManager connectionManager) {
constantUpdateMode = false;
bufferFreeSpace = BUFFER_SIZE;
interfaceReadyCnt = 0;
queue = new Vector<HIDTransaction>();
queue = new LinkedList<HIDTransaction>();
mConnectionManager = connectionManager;
ready = false;
sentAhead = false;
@ -60,6 +61,8 @@ public class HIDTransactionQueue {
switch (interfaceType) {
case InputStickHID.INTERFACE_KEYBOARD:
cmd = Packet.CMD_HID_DATA_KEYB;
//TODO mod
//cmd = Packet.CMD_HID_DATA_KEYB_FAST;
break;
case InputStickHID.INTERFACE_MOUSE:
cmd = Packet.CMD_HID_DATA_MOUSE;
@ -76,7 +79,7 @@ public class HIDTransactionQueue {
HIDTransaction transaction;
//assume there is at least 1 element in queue
transaction = queue.firstElement();
transaction = queue.peek();
if (transaction.getReportsCount() > maxReports) {
// v0.92
if (maxReports < BUFFER_SIZE) {
@ -87,7 +90,7 @@ public class HIDTransactionQueue {
//transaction too big to fit single packet! split
transaction = transaction.split(BUFFER_SIZE);
} else {
queue.removeElementAt(0);
queue.removeFirst();
}
byte reports = 0;
@ -96,6 +99,11 @@ public class HIDTransactionQueue {
while (transaction.hasNext()) {
p.addBytes(transaction.getNextReport());
//TODO mod
//byte[] r = transaction.getNextReport();
//p.addByte(r[0]);
//p.addByte(r[2]);
reports++;
}
@ -104,11 +112,16 @@ public class HIDTransactionQueue {
break;
}
transaction = queue.firstElement();
transaction = queue.peek();
if (reports + transaction.getReportsCount() < maxReports) {
queue.removeElementAt(0);
queue.removeFirst();
while (transaction.hasNext()) {
p.addBytes(transaction.getNextReport());
//TODO mod
//byte[] r = transaction.getNextReport();
//p.addByte(r[0]);
//p.addByte(r[2]);
reports++;
}
} else {
@ -120,6 +133,7 @@ public class HIDTransactionQueue {
p.modifyByte(1, reports); //set reports count
mConnectionManager.sendPacket(p);
interfaceReadyCnt = 0;
lastReports = reports;
lastTime = System.currentTimeMillis();
minNextTime = lastTime + (lastReports * 4) + BT_DELAY;
@ -162,7 +176,7 @@ public class HIDTransactionQueue {
}
public synchronized void clearBuffer() {
queue.removeAllElements();
queue.clear();
}
public synchronized void addTransaction(HIDTransaction transaction) {
@ -210,6 +224,30 @@ public class HIDTransactionQueue {
if (hidInfo != null) {
if (hidInfo.isSentToHostInfoAvailable()) {
//BT4.0 lost packets fix:
if (bufferFreeSpace < BUFFER_SIZE) {
boolean interfaceReady = false;
if (mInterfaceType == InputStickHID.INTERFACE_KEYBOARD) {
interfaceReady = hidInfo.isKeyboardReady();
}
if (mInterfaceType == InputStickHID.INTERFACE_MOUSE) {
interfaceReady = hidInfo.isMouseReady();
}
if (mInterfaceType == InputStickHID.INTERFACE_CONSUMER) {
interfaceReady = hidInfo.isConsumerReady();
}
if (interfaceReady) {
interfaceReadyCnt++;
if (interfaceReadyCnt == 10) {
bufferFreeSpace = BUFFER_SIZE;
}
} else {
interfaceReadyCnt = 0;
}
}
constantUpdateMode = true;
// >= FW 0.93
bufferFreeSpace += reportsSentToHost;

View File

@ -0,0 +1,97 @@
package com.inputstick.api.init;
import android.os.Handler;
import com.inputstick.api.InputStickError;
import com.inputstick.api.Packet;
public class BasicInitManager extends InitManager {
private int lastStatusParam;
private Handler handler;
private boolean cancelled;
public BasicInitManager(byte[] key) {
super(key);
lastStatusParam = 0;
}
@Override
public void onConnected() {
lastStatusParam = 0;
cancelled = false;
initDone = false;
sendPacket(new Packet(true, Packet.CMD_RUN_FW));
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if ((!cancelled) && ( !initDone)) {
sendPacket(new Packet(true, Packet.CMD_RUN_FW));
}
}
}, 1000);
handler.postDelayed(new Runnable() {
@Override
public void run() {
if ((!cancelled) && ( !initDone)) {
mListener.onInitFailure(InputStickError.ERROR_INIT_TIMEDOUT);
}
}
}, 2000);
}
@Override
public void onDisconnected() {
cancelled = true;
}
@Override
public void onData(byte[] data) {
byte cmd = data[0];
byte respCode = data[1];
byte param = data[1];
switch (cmd) {
case Packet.CMD_RUN_FW:
sendPacket(new Packet(true, Packet.CMD_FW_INFO));
break;
case Packet.CMD_FW_INFO:
onFWInfo(data, true, true, new Packet(true, Packet.CMD_INIT)); //TODO next FW: params!
break;
case Packet.CMD_INIT:
if (respCode == Packet.RESP_OK) {
initDone = true;
sendPacket(new Packet(true, Packet.CMD_HID_STATUS_REPORT));
} else {
mListener.onInitFailure(respCode);
}
break;
case Packet.CMD_INIT_AUTH:
initDone = onAuth(data, true, new Packet(true, Packet.CMD_INIT)); //TODO next FW: params!
break;
case Packet.CMD_HID_STATUS:
if (mKey == null) {
initDone = true;
}
if (initDone) {
if (param != lastStatusParam) {
lastStatusParam = param;
if (param == 0x05) {
mListener.onInitReady();
} else {
mListener.onInitNotReady();
}
}
}
break;
}
}
}

View File

@ -0,0 +1,93 @@
package com.inputstick.api.init;
public class DeviceInfo {
private int firmwareType;
private int versionMajor;
private int versionMinor;
private int versionHardware;
private int securityStatus;
private boolean passwordProtected;
public DeviceInfo(byte[] data) {
//cmd, param
firmwareType = data[2];
versionMajor = data[3];
versionMinor = data[4];
versionHardware = data[5];
//6,7,8,9
//10,11,12,13
//14,15,16,17
//18,19
securityStatus = data[19];
if (data[20] == 0) {
passwordProtected = false;
} else {
passwordProtected = true;
}
}
public int getSecurityStatus() {
return securityStatus;
}
public boolean isAuthenticated() {
return ((securityStatus & 0x10) != 0);
}
public boolean isUnlocked() {
if (getFirmwareVersion() < 96) {
return true;
} else {
return ((securityStatus & 0x08) != 0);
}
}
public int getFirmwareType() {
return firmwareType;
}
public boolean isPasswordProtected() {
return passwordProtected;
}
public int getVersionMinor() {
return versionMinor;
}
public int getVersionMajor() {
return versionMajor;
}
public int getHardwareVersion() {
return versionHardware;
}
public int getFirmwareVersion() {
return (versionMajor) * 100 + versionMinor;
}
public boolean supportsEncryption() {
return (getFirmwareVersion() >= 91);
}
public boolean supportsPinChange() {
return (getFirmwareVersion() >= 97);
}
public boolean supportsGamepad() {
return (getFirmwareVersion() >= 97);
}
public boolean supportsRestoreOptions() {
return (getFirmwareVersion() >= 98);
}
}

View File

@ -0,0 +1,112 @@
package com.inputstick.api.init;
import com.inputstick.api.InputStickError;
import com.inputstick.api.Packet;
import com.inputstick.api.PacketManager;
public class InitManager {
public static final int DEFAULT_INIT_TIMEOUT = 60000; //60s init timeout
protected PacketManager mPacketManager;
protected InitManagerListener mListener;
protected byte[] mKey;
protected DeviceInfo mInfo;
protected boolean initDone;
public InitManager(byte[] key) {
mKey = key;
}
public DeviceInfo getDeviceInfo() {
return mInfo;
}
public boolean isEncrypted() {
return mPacketManager.isEncrypted();
}
public void init(InitManagerListener listener, PacketManager packetManager) {
mListener = listener;
mPacketManager = packetManager;
initDone = false;
}
public void onConnected() {
mListener.onInitReady();
}
public void onDisconnected() {
}
public void onData(byte[] data) {
//byte cmd = data[0];
//byte param = data[1];
}
public void sendPacket(Packet p) {
mPacketManager.sendPacket(p);
}
public void onFWInfo(byte[] data, boolean authenticate, boolean enableEncryption, Packet sendNext) {
mInfo = new DeviceInfo(data);
if (authenticate) {
if (mInfo.isPasswordProtected()) {
if (mKey != null) {
//authenticate
sendPacket(mPacketManager.encPacket(enableEncryption));
} else {
mListener.onInitFailure(InputStickError.ERROR_SECURITY_NO_KEY);
}
} else {
if (mKey != null) {
//possible scenarios: FW upgrade / password removed using other device/app / tampering!
mListener.onInitFailure(InputStickError.ERROR_SECURITY_NOT_PROTECTED);
}
sendPacket(sendNext);
}
} else {
sendPacket(sendNext);
}
}
public boolean onAuth(byte[] data, boolean enableOutEncryption, Packet sendNext) {
byte respCode = data[1];
switch (respCode) {
case Packet.RESP_OK:
byte[] cmp = new byte[16];
//TODO check length!
System.arraycopy(data, 2, cmp, 0, 16);
if (mPacketManager.setEncryption(cmp, enableOutEncryption)) {
sendPacket(sendNext);
return true;
} else {
mListener.onInitFailure(InputStickError.ERROR_SECURITY_CHALLENGE);
}
break;
case 0x20:
mListener.onInitFailure(InputStickError.ERROR_SECURITY_INVALID_KEY);
break;
case 0x21:
mListener.onInitFailure(InputStickError.ERROR_SECURITY_NOT_PROTECTED);
break;
case Packet.RESP_UNKNOWN_CMD:
mListener.onInitFailure(InputStickError.ERROR_SECURITY_NOT_SUPPORTED);
break;
default:
mListener.onInitFailure(InputStickError.ERROR_SECURITY);
}
return false;
}
}

View File

@ -0,0 +1,9 @@
package com.inputstick.api.init;
public interface InitManagerListener {
public void onInitReady();
public void onInitNotReady();
public void onInitFailure(int code);
}

View File

@ -4,6 +4,173 @@ public class DanishLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "da-DK";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//da-DK
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 53, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 64, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 49, 0, 0 }, // *
{ 43, 0, 45, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 37, 0, 0 }, // [
{ 92, 64, 100, 0, 0 }, // \
{ 93, 64, 38, 0, 0 }, // ]
{ 94, 0, 44, 2, 48 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 36, 0, 0 }, // {
{ 124, 64, 46, 0, 0 }, // |
{ 125, 64, 39, 0, 0 }, // }
{ 126, 0, 44, 64, 48 }, // ~
{ 163, 64, 32, 0, 0 }, // ?
{ 164, 2, 33, 0, 0 }, // ¤
{ 167, 2, 53, 0, 0 }, // §
{ 168, 0, 44, 0, 48 }, // ¨
{ 180, 0, 44, 0, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 189, 0, 53, 0, 0 }, // ?
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 0, 46 }, // Á
{ 194, 2, 4, 2, 48 }, // Â
{ 195, 2, 4, 64, 48 }, // ?
{ 196, 2, 4, 0, 48 }, // Ä
{ 197, 2, 47, 0, 0 }, // ?
{ 198, 2, 51, 0, 0 }, // ?
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 0, 46 }, // É
{ 202, 2, 8, 2, 48 }, // ?
{ 203, 2, 8, 0, 48 }, // Ë
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 0, 46 }, // Í
{ 206, 2, 12, 2, 48 }, // Î
{ 207, 2, 12, 0, 48 }, // ?
{ 209, 2, 17, 64, 48 }, // ?
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 0, 46 }, // Ó
{ 212, 2, 18, 2, 48 }, // Ô
{ 213, 2, 18, 64, 48 }, // ?
{ 214, 2, 18, 0, 48 }, // Ö
{ 216, 2, 52, 0, 0 }, // ?
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 0, 46 }, // Ú
{ 219, 2, 24, 2, 48 }, // ?
{ 220, 2, 24, 0, 48 }, // Ü
{ 221, 2, 28, 0, 46 }, // Ý
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 0, 46 }, // á
{ 226, 0, 4, 2, 48 }, // â
{ 227, 0, 4, 64, 48 }, // ?
{ 228, 0, 4, 0, 48 }, // ä
{ 229, 0, 47, 0, 0 }, // ?
{ 230, 0, 51, 0, 0 }, // ?
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 0, 46 }, // é
{ 234, 0, 8, 2, 48 }, // ?
{ 235, 0, 8, 0, 48 }, // ë
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 0, 46 }, // í
{ 238, 0, 12, 2, 48 }, // î
{ 239, 0, 12, 0, 48 }, // ?
{ 241, 0, 17, 64, 48 }, // ?
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 0, 46 }, // ó
{ 244, 0, 18, 2, 48 }, // ô
{ 245, 0, 18, 64, 48 }, // ?
{ 246, 0, 18, 0, 48 }, // ö
{ 248, 0, 52, 0, 0 }, // ?
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 0, 46 }, // ú
{ 251, 0, 24, 2, 48 }, // ?
{ 252, 0, 24, 0, 48 }, // ü
{ 253, 0, 28, 0, 46 }, // ý
{ 255, 0, 28, 0, 48 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -185,14 +352,19 @@ public class DanishLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,110 @@ public class DvorakLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "en-DV";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//en-DV
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 45, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 46, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 20, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 20, 0, 0 }, // '
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 48, 0, 0 }, // +
{ 44, 0, 26, 0, 0 }, // ,
{ 45, 0, 52, 0, 0 }, // -
{ 46, 0, 8, 0, 0 }, // .
{ 47, 0, 47, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 29, 0, 0 }, // :
{ 59, 0, 29, 0, 0 }, // ;
{ 60, 2, 26, 0, 0 }, // <
{ 61, 0, 48, 0, 0 }, // =
{ 62, 2, 8, 0, 0 }, // >
{ 63, 2, 47, 0, 0 }, // ?
{ 64, 2, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 17, 0, 0 }, // B
{ 67, 2, 12, 0, 0 }, // C
{ 68, 2, 11, 0, 0 }, // D
{ 69, 2, 7, 0, 0 }, // E
{ 70, 2, 28, 0, 0 }, // F
{ 71, 2, 24, 0, 0 }, // G
{ 72, 2, 13, 0, 0 }, // H
{ 73, 2, 10, 0, 0 }, // I
{ 74, 2, 6, 0, 0 }, // J
{ 75, 2, 25, 0, 0 }, // K
{ 76, 2, 19, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 15, 0, 0 }, // N
{ 79, 2, 22, 0, 0 }, // O
{ 80, 2, 21, 0, 0 }, // P
{ 81, 2, 27, 0, 0 }, // Q
{ 82, 2, 18, 0, 0 }, // R
{ 83, 2, 51, 0, 0 }, // S
{ 84, 2, 14, 0, 0 }, // T
{ 85, 2, 9, 0, 0 }, // U
{ 86, 2, 55, 0, 0 }, // V
{ 87, 2, 54, 0, 0 }, // W
{ 88, 2, 5, 0, 0 }, // X
{ 89, 2, 23, 0, 0 }, // Y
{ 90, 2, 56, 0, 0 }, // Z
{ 91, 0, 45, 0, 0 }, // [
{ 92, 0, 49, 0, 0 }, // \
{ 93, 0, 46, 0, 0 }, // ]
{ 94, 2, 35, 0, 0 }, // ^
{ 95, 2, 52, 0, 0 }, // _
{ 96, 0, 53, 0, 0 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 17, 0, 0 }, // b
{ 99, 0, 12, 0, 0 }, // c
{ 100, 0, 11, 0, 0 }, // d
{ 101, 0, 7, 0, 0 }, // e
{ 102, 0, 28, 0, 0 }, // f
{ 103, 0, 24, 0, 0 }, // g
{ 104, 0, 13, 0, 0 }, // h
{ 105, 0, 10, 0, 0 }, // i
{ 106, 0, 6, 0, 0 }, // j
{ 107, 0, 25, 0, 0 }, // k
{ 108, 0, 19, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 15, 0, 0 }, // n
{ 111, 0, 22, 0, 0 }, // o
{ 112, 0, 21, 0, 0 }, // p
{ 113, 0, 27, 0, 0 }, // q
{ 114, 0, 18, 0, 0 }, // r
{ 115, 0, 51, 0, 0 }, // s
{ 116, 0, 14, 0, 0 }, // t
{ 117, 0, 9, 0, 0 }, // u
{ 118, 0, 55, 0, 0 }, // v
{ 119, 0, 54, 0, 0 }, // w
{ 120, 0, 5, 0, 0 }, // x
{ 121, 0, 23, 0, 0 }, // y
{ 122, 0, 56, 0, 0 }, // z
{ 123, 2, 45, 0, 0 }, // {
{ 124, 2, 49, 0, 0 }, // |
{ 125, 2, 46, 0, 0 }, // }
{ 126, 2, 53, 0, 0 }, // ~
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -127,14 +231,19 @@ public class DvorakLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,169 @@ public class FinnishLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "fi-FI";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//fi-FI
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 24, 64, 33, 0, 0 }, // 
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 53, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 49, 0, 0 }, // *
{ 43, 0, 45, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 37, 0, 0 }, // [
{ 92, 64, 45, 0, 0 }, // \
{ 93, 64, 38, 0, 0 }, // ]
{ 94, 0, 44, 2, 48 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 36, 0, 0 }, // {
{ 124, 64, 100, 0, 0 }, // |
{ 125, 64, 39, 0, 0 }, // }
{ 126, 0, 44, 64, 48 }, // ~
{ 163, 64, 32, 0, 0 }, // ?
{ 164, 2, 33, 0, 0 }, // ¤
{ 167, 0, 53, 0, 0 }, // §
{ 168, 0, 44, 0, 48 }, // ¨
{ 180, 0, 44, 0, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 189, 2, 53, 0, 0 }, // ?
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 0, 46 }, // Á
{ 194, 2, 4, 2, 48 }, // Â
{ 195, 2, 4, 64, 48 }, // ?
{ 196, 2, 52, 0, 0 }, // Ä
{ 197, 2, 47, 0, 0 }, // ?
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 0, 46 }, // É
{ 202, 2, 8, 2, 48 }, // ?
{ 203, 2, 8, 0, 48 }, // Ë
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 0, 46 }, // Í
{ 206, 2, 12, 2, 48 }, // Î
{ 207, 2, 12, 0, 48 }, // ?
{ 209, 2, 17, 64, 48 }, // ?
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 0, 46 }, // Ó
{ 212, 2, 18, 2, 48 }, // Ô
{ 213, 2, 18, 64, 48 }, // ?
{ 214, 2, 51, 0, 0 }, // Ö
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 0, 46 }, // Ú
{ 219, 2, 24, 2, 48 }, // ?
{ 220, 2, 24, 0, 48 }, // Ü
{ 221, 2, 28, 0, 46 }, // Ý
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 0, 46 }, // á
{ 226, 0, 4, 2, 48 }, // â
{ 227, 0, 4, 64, 48 }, // ?
{ 228, 0, 52, 0, 0 }, // ä
{ 229, 0, 47, 0, 0 }, // ?
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 0, 46 }, // é
{ 234, 0, 8, 2, 48 }, // ?
{ 235, 0, 8, 0, 48 }, // ë
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 0, 46 }, // í
{ 238, 0, 12, 2, 48 }, // î
{ 239, 0, 12, 0, 48 }, // ?
{ 241, 0, 17, 64, 48 }, // ?
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 0, 46 }, // ó
{ 244, 0, 18, 2, 48 }, // ô
{ 245, 0, 18, 64, 48 }, // ?
{ 246, 0, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 0, 46 }, // ú
{ 251, 0, 24, 2, 48 }, // ?
{ 252, 0, 24, 0, 48 }, // ü
{ 253, 0, 28, 0, 46 }, // ý
{ 255, 0, 28, 0, 48 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -187,14 +350,19 @@ public class FinnishLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,157 @@ public class FrenchLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "fr-FR";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//fr-FR
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 0, 56, 0, 0 }, // !
{ 34, 0, 32, 0, 0 }, // "
{ 35, 64, 32, 0, 0 }, // #
{ 36, 0, 48, 0, 0 }, // $
{ 37, 2, 52, 0, 0 }, // %
{ 38, 0, 30, 0, 0 }, // &
{ 39, 0, 33, 0, 0 }, // '
{ 40, 0, 34, 0, 0 }, // (
{ 41, 0, 45, 0, 0 }, // )
{ 42, 0, 49, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 16, 0, 0 }, // ,
{ 45, 0, 35, 0, 0 }, // -
{ 46, 2, 54, 0, 0 }, // .
{ 47, 2, 55, 0, 0 }, // /
{ 48, 2, 39, 0, 0 }, // 0
{ 49, 2, 30, 0, 0 }, // 1
{ 50, 2, 31, 0, 0 }, // 2
{ 51, 2, 32, 0, 0 }, // 3
{ 52, 2, 33, 0, 0 }, // 4
{ 53, 2, 34, 0, 0 }, // 5
{ 54, 2, 35, 0, 0 }, // 6
{ 55, 2, 36, 0, 0 }, // 7
{ 56, 2, 37, 0, 0 }, // 8
{ 57, 2, 38, 0, 0 }, // 9
{ 58, 0, 55, 0, 0 }, // :
{ 59, 0, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 16, 0, 0 }, // ?
{ 64, 64, 39, 0, 0 }, // @
{ 65, 2, 20, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 51, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 4, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 29, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 26, 0, 0 }, // Z
{ 91, 64, 34, 0, 0 }, // [
{ 92, 64, 37, 0, 0 }, // \
{ 93, 64, 45, 0, 0 }, // ]
{ 94, 0, 44, 64, 38 }, // ^
{ 95, 0, 37, 0, 0 }, // _
{ 96, 0, 44, 64, 36 }, // `
{ 97, 0, 20, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 51, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 4, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 29, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 26, 0, 0 }, // z
{ 123, 64, 33, 0, 0 }, // {
{ 124, 64, 35, 0, 0 }, // |
{ 125, 64, 46, 0, 0 }, // }
{ 126, 0, 44, 64, 31 }, // ~
{ 163, 2, 48, 0, 0 }, // ?
{ 164, 64, 48, 0, 0 }, // ¤
{ 167, 2, 56, 0, 0 }, // §
{ 168, 0, 44, 2, 47 }, // ¨
{ 176, 2, 45, 0, 0 }, // °
{ 178, 0, 53, 0, 0 }, // ?
{ 181, 2, 49, 0, 0 }, // µ
{ 192, 2, 20, 64, 36 }, // ?
{ 194, 2, 20, 64, 38 }, // Â
{ 195, 2, 20, 64, 31 }, // ?
{ 196, 2, 20, 2, 47 }, // Ä
{ 200, 2, 8, 64, 36 }, // ?
{ 202, 2, 8, 64, 38 }, // ?
{ 203, 2, 8, 2, 47 }, // Ë
{ 204, 2, 12, 64, 36 }, // ?
{ 206, 2, 12, 64, 38 }, // Î
{ 207, 2, 12, 2, 47 }, // ?
{ 209, 2, 17, 64, 31 }, // ?
{ 210, 2, 18, 64, 36 }, // ?
{ 212, 2, 18, 64, 38 }, // Ô
{ 213, 2, 18, 64, 31 }, // ?
{ 214, 2, 18, 2, 47 }, // Ö
{ 217, 2, 24, 64, 36 }, // ?
{ 219, 2, 24, 64, 38 }, // ?
{ 220, 2, 24, 2, 47 }, // Ü
{ 224, 0, 39, 0, 0 }, // ?
{ 226, 0, 20, 64, 38 }, // â
{ 227, 0, 20, 64, 31 }, // ?
{ 228, 0, 20, 2, 47 }, // ä
{ 231, 0, 38, 0, 0 }, // ç
{ 232, 0, 36, 0, 0 }, // ?
{ 233, 0, 31, 0, 0 }, // é
{ 234, 0, 8, 64, 38 }, // ?
{ 235, 0, 8, 2, 47 }, // ë
{ 236, 0, 12, 64, 36 }, // ?
{ 238, 0, 12, 64, 38 }, // î
{ 239, 0, 12, 2, 47 }, // ?
{ 241, 0, 17, 64, 31 }, // ?
{ 242, 0, 18, 64, 36 }, // ?
{ 244, 0, 18, 64, 38 }, // ô
{ 245, 0, 18, 64, 31 }, // ?
{ 246, 0, 18, 2, 47 }, // ö
{ 249, 0, 52, 0, 0 }, // ?
{ 251, 0, 24, 64, 38 }, // ?
{ 252, 0, 24, 2, 47 }, // ü
{ 255, 0, 28, 2, 47 }, // ?
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -172,14 +323,19 @@ public class FrenchLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,156 @@ public class GermanLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "de-DE";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//de-DE
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 0, 49, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 2, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 48, 0, 0 }, // *
{ 43, 0, 48, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 20, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 29, 0, 0 }, // Y
{ 90, 2, 28, 0, 0 }, // Z
{ 91, 64, 37, 0, 0 }, // [
{ 92, 64, 45, 0, 0 }, // \
{ 93, 64, 38, 0, 0 }, // ]
{ 94, 0, 44, 0, 53 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 29, 0, 0 }, // y
{ 122, 0, 28, 0, 0 }, // z
{ 123, 64, 36, 0, 0 }, // {
{ 124, 64, 100, 0, 0 }, // |
{ 125, 64, 39, 0, 0 }, // }
{ 126, 64, 48, 0, 0 }, // ~
{ 167, 2, 32, 0, 0 }, // §
{ 176, 2, 53, 0, 0 }, // °
{ 178, 64, 31, 0, 0 }, // ?
{ 179, 64, 32, 0, 0 }, // ?
{ 180, 0, 44, 0, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 0, 46 }, // Á
{ 194, 2, 4, 0, 53 }, // Â
{ 196, 2, 52, 0, 0 }, // Ä
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 0, 46 }, // É
{ 202, 2, 8, 0, 53 }, // ?
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 0, 46 }, // Í
{ 206, 2, 12, 0, 53 }, // Î
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 0, 46 }, // Ó
{ 212, 2, 18, 0, 53 }, // Ô
{ 214, 2, 51, 0, 0 }, // Ö
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 0, 46 }, // Ú
{ 219, 2, 24, 0, 53 }, // ?
{ 220, 2, 47, 0, 0 }, // Ü
{ 221, 2, 29, 0, 46 }, // Ý
{ 223, 0, 45, 0, 0 }, // ß
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 0, 46 }, // á
{ 226, 0, 4, 0, 53 }, // â
{ 228, 0, 52, 0, 0 }, // ä
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 0, 46 }, // é
{ 234, 0, 8, 0, 53 }, // ?
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 0, 46 }, // í
{ 238, 0, 12, 0, 53 }, // î
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 0, 46 }, // ó
{ 244, 0, 18, 0, 53 }, // ô
{ 246, 0, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 0, 46 }, // ú
{ 251, 0, 24, 0, 53 }, // ?
{ 252, 0, 47, 0, 0 }, // ü
{ 253, 0, 29, 0, 46 }, // ý
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -167,14 +317,19 @@ public class GermanLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,153 @@ public class GermanMacLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "de-DE-mac";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//de-DE-mac
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 0, 49, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 2, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 48, 0, 0 }, // *
{ 43, 0, 48, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 15, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 29, 0, 0 }, // Y
{ 90, 2, 28, 0, 0 }, // Z
{ 91, 64, 34, 0, 0 }, // [
{ 93, 64, 35, 0, 0 }, // ]
{ 94, 0, 44, 0, 53 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 29, 0, 0 }, // y
{ 122, 0, 28, 0, 0 }, // z
{ 123, 64, 37, 0, 0 }, // {
{ 124, 64, 36, 0, 0 }, // |
{ 125, 64, 38, 0, 0 }, // }
{ 126, 64, 17, 0, 0 }, // ~
{ 167, 2, 32, 0, 0 }, // §
{ 176, 2, 53, 0, 0 }, // °
{ 180, 0, 44, 0, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 0, 46 }, // Á
{ 194, 2, 4, 0, 53 }, // Â
{ 196, 2, 52, 0, 0 }, // Ä
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 0, 46 }, // É
{ 202, 2, 8, 0, 53 }, // ?
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 0, 46 }, // Í
{ 206, 2, 12, 0, 53 }, // Î
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 0, 46 }, // Ó
{ 212, 2, 18, 0, 53 }, // Ô
{ 214, 2, 51, 0, 0 }, // Ö
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 0, 46 }, // Ú
{ 219, 2, 24, 0, 53 }, // ?
{ 220, 2, 47, 0, 0 }, // Ü
{ 221, 2, 29, 0, 46 }, // Ý
{ 223, 0, 45, 0, 0 }, // ß
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 0, 46 }, // á
{ 226, 0, 4, 0, 53 }, // â
{ 228, 0, 52, 0, 0 }, // ä
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 0, 46 }, // é
{ 234, 0, 8, 0, 53 }, // ?
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 0, 46 }, // í
{ 238, 0, 12, 0, 53 }, // î
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 0, 46 }, // ó
{ 244, 0, 18, 0, 53 }, // ô
{ 246, 0, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 0, 46 }, // ú
{ 251, 0, 24, 0, 53 }, // ?
{ 252, 0, 47, 0, 0 }, // ü
{ 253, 0, 29, 0, 46 }, // ý
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
// CAPSLOCK, NORMAL , SHIFT , CTRL , ALTGR , SHIFT + ALTGR
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -168,14 +315,19 @@ public class GermanMacLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,117 @@ public class HebrewLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "he-IL";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//he-IL
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 28, 1, 49, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 52, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 26, 0, 0 }, // '
{ 40, 2, 39, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 52, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 56, 0, 0 }, // .
{ 47, 0, 20, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 51, 0, 0 }, // :
{ 59, 0, 53, 0, 0 }, // ;
{ 60, 2, 55, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 54, 0, 0 }, // >
{ 63, 2, 56, 0, 0 }, // ?
{ 64, 2, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 0, 48, 0, 0 }, // [
{ 92, 0, 49, 0, 0 }, // \
{ 93, 0, 47, 0, 0 }, // ]
{ 94, 2, 35, 0, 0 }, // ^
{ 95, 2, 45, 0, 0 }, // _
{ 123, 2, 48, 0, 0 }, // {
{ 124, 2, 49, 0, 0 }, // |
{ 125, 2, 47, 0, 0 }, // }
{ 126, 2, 53, 0, 0 }, // ~
{ 1471, 66, 45, 0, 0 }, // ?
{ 1488, 0, 23, 0, 0 }, // ?
{ 1489, 0, 6, 0, 0 }, // ?
{ 1490, 0, 7, 0, 0 }, // ?
{ 1491, 0, 22, 0, 0 }, // ?
{ 1492, 0, 25, 0, 0 }, // ?
{ 1493, 0, 24, 0, 0 }, // ?
{ 1494, 0, 29, 0, 0 }, // ?
{ 1495, 0, 13, 0, 0 }, // ?
{ 1496, 0, 28, 0, 0 }, // ?
{ 1497, 0, 11, 0, 0 }, // ?
{ 1498, 0, 15, 0, 0 }, // ?
{ 1499, 0, 9, 0, 0 }, // ?
{ 1500, 0, 14, 0, 0 }, // ?
{ 1501, 0, 18, 0, 0 }, // ?
{ 1502, 0, 17, 0, 0 }, // ?
{ 1503, 0, 12, 0, 0 }, // ?
{ 1504, 0, 5, 0, 0 }, // ?
{ 1505, 0, 27, 0, 0 }, // ?
{ 1506, 0, 10, 0, 0 }, // ?
{ 1507, 0, 51, 0, 0 }, // ?
{ 1508, 0, 19, 0, 0 }, // ?
{ 1509, 0, 55, 0, 0 }, // ?
{ 1510, 0, 16, 0, 0 }, // ?
{ 1511, 0, 8, 0, 0 }, // ?
{ 1512, 0, 21, 0, 0 }, // ?
{ 1513, 0, 4, 0, 0 }, // ?
{ 1514, 0, 54, 0, 0 }, // ?
{ 1520, 66, 24, 0, 0 }, // ?
{ 1521, 66, 13, 0, 0 }, // ?
{ 1522, 66, 11, 0, 0 }, // ?
{ 8206, 64, 32, 0, 0 }, // ?
{ 8207, 64, 33, 0, 0 }, // ?
{ 8362, 66, 33, 0, 0 }, // ?
{ 8364, 66, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -126,14 +237,19 @@ public class HebrewLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,120 @@ public class ItalianLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "it-IT";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//it-IT
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 64, 52, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 45, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 48, 0, 0 }, // *
{ 43, 0, 48, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 51, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 47, 0, 0 }, // [
{ 92, 0, 53, 0, 0 }, // \
{ 93, 64, 48, 0, 0 }, // ]
{ 94, 2, 46, 0, 0 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 66, 47, 0, 0 }, // {
{ 124, 2, 53, 0, 0 }, // |
{ 125, 66, 48, 0, 0 }, // }
{ 163, 2, 32, 0, 0 }, // ?
{ 167, 2, 49, 0, 0 }, // §
{ 176, 2, 52, 0, 0 }, // °
{ 224, 0, 52, 0, 0 }, // ?
{ 231, 2, 51, 0, 0 }, // ç
{ 232, 0, 47, 0, 0 }, // ?
{ 233, 2, 47, 0, 0 }, // é
{ 236, 0, 46, 0, 0 }, // ?
{ 242, 0, 51, 0, 0 }, // ?
{ 249, 0, 49, 0, 0 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -127,14 +241,19 @@ public class ItalianLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -120,16 +120,50 @@ public abstract class KeyboardLayout {
public static final int LAYOUT_CODE = 0;
public abstract int[][] getLUT();
public abstract int[][] getFastLUT();
public abstract int[][] getDeadkeyLUT();
public abstract int[] getDeadkeys();
public abstract String getLocaleName();
//types text assuming that USB host uses the same keyboard layout
/*
* Type text using InputStick. Assumes that USB host uses matching keyboard layout.
*
* @param text text to type
*/
public abstract void type(String text);
/*
* Type text using InputStick. Assumes that USB host uses matching keyboard layout.
* Note: use only if you are certain that specified modifier keys will not cause any side effects during typing.
*
* @param text text to type
* @param modifiers state of keyboard modifier keys (CTRL_LEFT .. GUI_RIGHT, see HIDKeycodes)
*/
public abstract void type(String text, byte modifiers);
public abstract char getChar(int scanCode, boolean capsLock, boolean shift, boolean altGr);
public void type(int[][] lut, int[][] deadkeyLUT, int[] deadkeys, String text, byte modifiers) {
public void type(int[][] fastLUT, String text, byte modifiers) {
if (InputStickHID.getState() == ConnectionManager.STATE_READY) {
char[] chars = text.toCharArray();
HIDTransaction t;
for (char c : chars) {
if (c == '\n') {
InputStickKeyboard.pressAndRelease(HIDKeycodes.NONE, HIDKeycodes.KEY_ENTER);
} else if (c == '\t') {
InputStickKeyboard.pressAndRelease(HIDKeycodes.NONE, HIDKeycodes.KEY_TAB);
} else {
t = getHIDTransaction(fastLUT, c, modifiers);
if (t != null) {
InputStickHID.addKeyboardTransaction(t);
}
}
}
}
}
/*public void type(int[][] lut, int[][] deadkeyLUT, int[] deadkeys, String text, byte modifiers) {
if (InputStickHID.getState() == ConnectionManager.STATE_READY) {
char[] chars = text.toCharArray();
HIDTransaction t;
@ -146,7 +180,7 @@ public abstract class KeyboardLayout {
}
}
}
}
} */
public static int hidToScanCode(byte key) {
for (int scanCode = 0; scanCode < MAX_SCANCODE; scanCode++) {
@ -277,6 +311,30 @@ public abstract class KeyboardLayout {
return searchLUT(deadkeyLUT, c, 1);
}
public static HIDTransaction getHIDTransaction(int[][] fastLUT, char c, byte additionalModifierKeys) {
byte modifiers, key, deadKey, deadKeyModifiers;
HIDTransaction t = new HIDTransaction();
for (int i = 0; i < fastLUT.length; i++) {
if (fastLUT[i][0] == c) {
modifiers = (byte)fastLUT[i][1];
key = (byte)fastLUT[i][2];
deadKeyModifiers = (byte)fastLUT[i][3];
deadKey = (byte)fastLUT[i][4];
if (deadKey > 0) {
t.addReport(new KeyboardReport(deadKeyModifiers, (byte)0));
t.addReport(new KeyboardReport(deadKeyModifiers, deadKey));
t.addReport(new KeyboardReport());
}
t.addReport(new KeyboardReport(modifiers, (byte)0));
t.addReport(new KeyboardReport(modifiers, key));
t.addReport(new KeyboardReport());
}
}
return t;
}
public static HIDTransaction getHIDTransaction(int[][] lut, int[][] deadkeyLUT, int[] deadkeys, char c, byte additionalModifierKeys) {
byte modifiers, key;
int scanCode;
@ -327,46 +385,45 @@ public abstract class KeyboardLayout {
//returns layout sepcified by locale (example: "de-DE"). If specified layout is not available, en=US will be returned.
public static KeyboardLayout getLayout(String locale) {
if (locale != null) {
if (locale.equals(UnitedStatesLayout.getInstance().getLocaleName())) {
if (locale.equalsIgnoreCase(UnitedStatesLayout.LOCALE_NAME)) {
return UnitedStatesLayout.getInstance();
} else if (locale.equals(PolishLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(PolishLayout.LOCALE_NAME)) {
return PolishLayout.getInstance();
} else if (locale.equals(RussianLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(RussianLayout.LOCALE_NAME)) {
return RussianLayout.getInstance();
} else if (locale.equals(GermanLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(GermanLayout.LOCALE_NAME)) {
return GermanLayout.getInstance();
} else if (locale.equals(SlovakLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(SlovakLayout.LOCALE_NAME)) {
return SlovakLayout.getInstance();
} else if (locale.equals(PortugueseBrazilianLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(PortugueseBrazilianLayout.LOCALE_NAME)) {
return PortugueseBrazilianLayout.getInstance();
} else if (locale.equals(DvorakLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(DvorakLayout.LOCALE_NAME)) {
return DvorakLayout.getInstance();
} else if (locale.equals(NorwegianLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(NorwegianLayout.LOCALE_NAME)) {
return NorwegianLayout.getInstance();
} else if (locale.equals(SwedishLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(SwedishLayout.LOCALE_NAME)) {
return SwedishLayout.getInstance();
} else if (locale.equals(FrenchLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(FrenchLayout.LOCALE_NAME)) {
return FrenchLayout.getInstance();
} else if (locale.equals(SpanishLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(SpanishLayout.LOCALE_NAME)) {
return SpanishLayout.getInstance();
} else if (locale.equals(UnitedKingdomLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(UnitedKingdomLayout.LOCALE_NAME)) {
return UnitedKingdomLayout.getInstance();
} else if (locale.equals(GermanMacLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(GermanMacLayout.LOCALE_NAME)) {
return GermanMacLayout.getInstance(); // TODO
} else if (locale.equals(ItalianLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(ItalianLayout.LOCALE_NAME)) {
return ItalianLayout.getInstance();
} else if (locale.equals(FinnishLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(FinnishLayout.LOCALE_NAME)) {
return FinnishLayout.getInstance();
} else if (locale.equals(SwissFrenchLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(SwissFrenchLayout.LOCALE_NAME)) {
return SwissFrenchLayout.getInstance();
} else if (locale.equals(SwissGermanLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(SwissGermanLayout.LOCALE_NAME)) {
return SwissGermanLayout.getInstance();
} else if (locale.equals(HebrewLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(HebrewLayout.LOCALE_NAME)) {
return HebrewLayout.getInstance();
} else if (locale.equals(DanishLayout.getInstance().getLocaleName())) {
} else if (locale.equalsIgnoreCase(DanishLayout.LOCALE_NAME)) {
return DanishLayout.getInstance();
}
}
return UnitedStatesLayout.getInstance();

View File

@ -4,6 +4,172 @@ public class NorwegianLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "nb-NO";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//nb-NO
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 53, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 64, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 49, 0, 0 }, // *
{ 43, 0, 45, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 37, 0, 0 }, // [
{ 92, 0, 46, 0, 0 }, // \
{ 93, 64, 38, 0, 0 }, // ]
{ 94, 0, 44, 2, 48 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 36, 0, 0 }, // {
{ 124, 0, 53, 0, 0 }, // |
{ 125, 64, 39, 0, 0 }, // }
{ 126, 0, 44, 64, 48 }, // ~
{ 163, 64, 32, 0, 0 }, // ?
{ 164, 2, 33, 0, 0 }, // ¤
{ 167, 2, 53, 0, 0 }, // §
{ 168, 0, 44, 0, 48 }, // ¨
{ 180, 0, 44, 64, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 64, 46 }, // Á
{ 194, 2, 4, 2, 48 }, // Â
{ 195, 2, 4, 64, 48 }, // ?
{ 196, 2, 4, 0, 48 }, // Ä
{ 197, 2, 47, 0, 0 }, // ?
{ 198, 2, 52, 0, 0 }, // ?
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 64, 46 }, // É
{ 202, 2, 8, 2, 48 }, // ?
{ 203, 2, 8, 0, 48 }, // Ë
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 64, 46 }, // Í
{ 206, 2, 12, 2, 48 }, // Î
{ 207, 2, 12, 0, 48 }, // ?
{ 209, 2, 17, 64, 48 }, // ?
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 64, 46 }, // Ó
{ 212, 2, 18, 2, 48 }, // Ô
{ 213, 2, 18, 64, 48 }, // ?
{ 214, 2, 18, 0, 48 }, // Ö
{ 216, 2, 51, 0, 0 }, // ?
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 64, 46 }, // Ú
{ 219, 2, 24, 2, 48 }, // ?
{ 220, 2, 24, 0, 48 }, // Ü
{ 221, 2, 28, 64, 46 }, // Ý
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 64, 46 }, // á
{ 226, 0, 4, 2, 48 }, // â
{ 227, 0, 4, 64, 48 }, // ?
{ 228, 0, 4, 0, 48 }, // ä
{ 229, 0, 47, 0, 0 }, // ?
{ 230, 0, 52, 0, 0 }, // ?
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 64, 46 }, // é
{ 234, 0, 8, 2, 48 }, // ?
{ 235, 0, 8, 0, 48 }, // ë
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 64, 46 }, // í
{ 238, 0, 12, 2, 48 }, // î
{ 239, 0, 12, 0, 48 }, // ?
{ 241, 0, 17, 64, 48 }, // ?
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 64, 46 }, // ó
{ 244, 0, 18, 2, 48 }, // ô
{ 245, 0, 18, 64, 48 }, // ?
{ 246, 0, 18, 0, 48 }, // ö
{ 248, 0, 51, 0, 0 }, // ?
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 64, 46 }, // ú
{ 251, 0, 24, 2, 48 }, // ?
{ 252, 0, 24, 0, 48 }, // ü
{ 253, 0, 28, 64, 46 }, // ý
{ 255, 0, 28, 0, 48 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -187,14 +353,19 @@ public class NorwegianLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -5,6 +5,129 @@ public class PolishLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "pl-PL";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//pl-PL
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 52, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 52, 0, 0 }, // '
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 0, 56, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 51, 0, 0 }, // :
{ 59, 0, 51, 0, 0 }, // ;
{ 60, 2, 54, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 55, 0, 0 }, // >
{ 63, 2, 56, 0, 0 }, // ?
{ 64, 2, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 0, 47, 0, 0 }, // [
{ 92, 0, 49, 0, 0 }, // \
{ 93, 0, 48, 0, 0 }, // ]
{ 94, 2, 35, 0, 0 }, // ^
{ 95, 2, 45, 0, 0 }, // _
{ 96, 0, 53, 0, 0 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 2, 47, 0, 0 }, // {
{ 124, 2, 49, 0, 0 }, // |
{ 125, 2, 48, 0, 0 }, // }
{ 126, 0, 44, 2, 53 }, // ~
{ 211, 66, 18, 0, 0 }, // Ó
{ 243, 64, 18, 0, 0 }, // ó
{ 260, 66, 4, 0, 0 }, // ¥
{ 261, 64, 4, 0, 0 }, // ¹
{ 262, 66, 6, 0, 0 }, // Æ
{ 263, 64, 6, 0, 0 }, // æ
{ 280, 66, 8, 0, 0 }, // Ê
{ 281, 64, 8, 0, 0 }, // ê
{ 321, 66, 15, 0, 0 }, // £
{ 322, 64, 15, 0, 0 }, // ³
{ 323, 66, 17, 0, 0 }, // Ñ
{ 324, 64, 17, 0, 0 }, // ñ
{ 346, 66, 22, 0, 0 }, // Œ
{ 347, 64, 22, 0, 0 }, // œ
{ 377, 66, 27, 0, 0 }, // <EFBFBD>
{ 378, 64, 27, 0, 0 }, // Ÿ
{ 379, 66, 29, 0, 0 }, // ¯
{ 380, 64, 29, 0, 0 }, // ¿
{ 8364, 64, 24, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -151,14 +274,19 @@ public class PolishLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -2,7 +2,175 @@ package com.inputstick.api.layout;
public class PortugueseBrazilianLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "pt-BR";
public static final String LOCALE_NAME = "pt-BR";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//pt-BR
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 48, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 51, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 53, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 53, 0, 0 }, // '
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 64, 20, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 56, 0, 0 }, // :
{ 59, 0, 56, 0, 0 }, // ;
{ 60, 2, 54, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 55, 0, 0 }, // >
{ 63, 64, 26, 0, 0 }, // ?
{ 64, 2, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 0, 48, 0, 0 }, // [
{ 92, 0, 100, 0, 0 }, // \
{ 93, 0, 49, 0, 0 }, // ]
{ 94, 0, 44, 2, 52 }, // ^
{ 95, 2, 45, 0, 0 }, // _
{ 96, 0, 44, 2, 47 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 2, 48, 0, 0 }, // {
{ 124, 2, 100, 0, 0 }, // |
{ 125, 2, 49, 0, 0 }, // }
{ 126, 0, 44, 0, 52 }, // ~
{ 162, 64, 34, 0, 0 }, // ?
{ 163, 64, 33, 0, 0 }, // ?
{ 167, 64, 46, 0, 0 }, // §
{ 168, 0, 44, 2, 35 }, // ¨
{ 170, 64, 48, 0, 0 }, // ?
{ 172, 64, 35, 0, 0 }, // ¬
{ 176, 64, 8, 0, 0 }, // °
{ 178, 64, 31, 0, 0 }, // ?
{ 179, 64, 32, 0, 0 }, // ?
{ 180, 0, 44, 0, 47 }, // ´
{ 185, 64, 30, 0, 0 }, // ?
{ 186, 64, 49, 0, 0 }, // ?
{ 192, 2, 4, 2, 47 }, // ?
{ 193, 2, 4, 0, 47 }, // Á
{ 194, 2, 4, 2, 52 }, // Â
{ 195, 2, 4, 0, 52 }, // ?
{ 196, 2, 4, 2, 35 }, // Ä
{ 199, 2, 51, 0, 0 }, // Ç
{ 200, 2, 8, 2, 47 }, // ?
{ 201, 2, 8, 0, 47 }, // É
{ 202, 2, 8, 2, 52 }, // ?
{ 203, 2, 8, 2, 35 }, // Ë
{ 204, 2, 12, 2, 47 }, // ?
{ 205, 2, 12, 0, 47 }, // Í
{ 206, 2, 12, 2, 52 }, // Î
{ 207, 2, 12, 2, 35 }, // ?
{ 209, 2, 17, 0, 52 }, // ?
{ 210, 2, 18, 2, 47 }, // ?
{ 211, 2, 18, 0, 47 }, // Ó
{ 212, 2, 18, 2, 52 }, // Ô
{ 213, 2, 18, 0, 52 }, // ?
{ 214, 2, 18, 2, 35 }, // Ö
{ 217, 2, 24, 2, 47 }, // ?
{ 218, 2, 24, 0, 47 }, // Ú
{ 219, 2, 24, 2, 52 }, // ?
{ 220, 2, 24, 2, 35 }, // Ü
{ 221, 2, 28, 0, 47 }, // Ý
{ 224, 0, 4, 2, 47 }, // ?
{ 225, 0, 4, 0, 47 }, // á
{ 226, 0, 4, 2, 52 }, // â
{ 227, 0, 4, 0, 52 }, // ?
{ 228, 0, 4, 2, 35 }, // ä
{ 231, 0, 51, 0, 0 }, // ç
{ 232, 0, 8, 2, 47 }, // ?
{ 233, 0, 8, 0, 47 }, // é
{ 234, 0, 8, 2, 52 }, // ?
{ 235, 0, 8, 2, 35 }, // ë
{ 236, 0, 12, 2, 47 }, // ?
{ 237, 0, 12, 0, 47 }, // í
{ 238, 0, 12, 2, 52 }, // î
{ 239, 0, 12, 2, 35 }, // ?
{ 241, 0, 17, 0, 52 }, // ?
{ 242, 0, 18, 2, 47 }, // ?
{ 243, 0, 18, 0, 47 }, // ó
{ 244, 0, 18, 2, 52 }, // ô
{ 245, 0, 18, 0, 52 }, // ?
{ 246, 0, 18, 2, 35 }, // ö
{ 249, 0, 24, 2, 47 }, // ?
{ 250, 0, 24, 0, 47 }, // ú
{ 251, 0, 24, 2, 52 }, // ?
{ 252, 0, 24, 2, 35 }, // ü
{ 253, 0, 28, 0, 47 }, // ý
{ 255, 0, 28, 2, 35 }, // ?
{ 8354, 64, 6, 0, 0 }, // ?
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -192,14 +360,19 @@ public static final String LOCALE_NAME = "pt-BR";
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,108 @@ public class RussianLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "ru-RU";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//ru-RU
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 28, 1, 49, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 37, 2, 34, 0, 0 }, // %
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 2, 56, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 56, 0, 0 }, // .
{ 47, 2, 49, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 35, 0, 0 }, // :
{ 59, 2, 33, 0, 0 }, // ;
{ 61, 0, 46, 0, 0 }, // =
{ 63, 2, 36, 0, 0 }, // ?
{ 92, 0, 49, 0, 0 }, // \
{ 95, 2, 45, 0, 0 }, // _
{ 1025, 2, 53, 0, 0 }, // ?
{ 1040, 2, 9, 0, 0 }, // ?
{ 1041, 2, 54, 0, 0 }, // ?
{ 1042, 2, 7, 0, 0 }, // ?
{ 1043, 2, 24, 0, 0 }, // ?
{ 1044, 2, 15, 0, 0 }, // ?
{ 1045, 2, 23, 0, 0 }, // ?
{ 1046, 2, 51, 0, 0 }, // ?
{ 1047, 2, 19, 0, 0 }, // ?
{ 1048, 2, 5, 0, 0 }, // ?
{ 1049, 2, 20, 0, 0 }, // ?
{ 1050, 2, 21, 0, 0 }, // ?
{ 1051, 2, 14, 0, 0 }, // ?
{ 1052, 2, 25, 0, 0 }, // ?
{ 1053, 2, 28, 0, 0 }, // ?
{ 1054, 2, 13, 0, 0 }, // ?
{ 1055, 2, 10, 0, 0 }, // ?
{ 1056, 2, 11, 0, 0 }, // ?
{ 1057, 2, 6, 0, 0 }, // ?
{ 1058, 2, 17, 0, 0 }, // ?
{ 1059, 2, 8, 0, 0 }, // ?
{ 1060, 2, 4, 0, 0 }, // ?
{ 1061, 2, 47, 0, 0 }, // ?
{ 1062, 2, 26, 0, 0 }, // ?
{ 1063, 2, 27, 0, 0 }, // ?
{ 1064, 2, 12, 0, 0 }, // ?
{ 1065, 2, 18, 0, 0 }, // ?
{ 1066, 2, 48, 0, 0 }, // ?
{ 1067, 2, 22, 0, 0 }, // ?
{ 1068, 2, 16, 0, 0 }, // ?
{ 1069, 2, 52, 0, 0 }, // ?
{ 1070, 2, 55, 0, 0 }, // ?
{ 1071, 2, 29, 0, 0 }, // ?
{ 1072, 0, 9, 0, 0 }, // ?
{ 1073, 0, 54, 0, 0 }, // ?
{ 1074, 0, 7, 0, 0 }, // ?
{ 1075, 0, 24, 0, 0 }, // ?
{ 1076, 0, 15, 0, 0 }, // ?
{ 1077, 0, 23, 0, 0 }, // ?
{ 1078, 0, 51, 0, 0 }, // ?
{ 1079, 0, 19, 0, 0 }, // ?
{ 1080, 0, 5, 0, 0 }, // ?
{ 1081, 0, 20, 0, 0 }, // ?
{ 1082, 0, 21, 0, 0 }, // ?
{ 1083, 0, 14, 0, 0 }, // ?
{ 1084, 0, 25, 0, 0 }, // ?
{ 1085, 0, 28, 0, 0 }, // ?
{ 1086, 0, 13, 0, 0 }, // ?
{ 1087, 0, 10, 0, 0 }, // ?
{ 1088, 0, 11, 0, 0 }, // ?
{ 1089, 0, 6, 0, 0 }, // ?
{ 1090, 0, 17, 0, 0 }, // ?
{ 1091, 0, 8, 0, 0 }, // ?
{ 1092, 0, 4, 0, 0 }, // ?
{ 1093, 0, 47, 0, 0 }, // ?
{ 1094, 0, 26, 0, 0 }, // ?
{ 1095, 0, 27, 0, 0 }, // ?
{ 1096, 0, 12, 0, 0 }, // ?
{ 1097, 0, 18, 0, 0 }, // ?
{ 1098, 0, 48, 0, 0 }, // ?
{ 1099, 0, 22, 0, 0 }, // ?
{ 1100, 0, 16, 0, 0 }, // ?
{ 1101, 0, 52, 0, 0 }, // ?
{ 1102, 0, 55, 0, 0 }, // ?
{ 1103, 0, 29, 0, 0 }, // ?
{ 1105, 0, 53, 0, 0 }, // ?
{ 8470, 2, 32, 0, 0 }, // ?
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -129,14 +231,19 @@ public class RussianLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,207 @@ public class SlovakLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "sk-SK";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//sk-SK
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 0, 66, 30, 0, 0 }, //
{ 7, 64, 30, 0, 0 }, // 
{ 27, 1, 48, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 51, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 52, 0, 0 }, // !
{ 34, 2, 51, 0, 0 }, // "
{ 35, 64, 27, 0, 0 }, // #
{ 36, 64, 51, 0, 0 }, // $
{ 37, 2, 45, 0, 0 }, // %
{ 38, 64, 6, 0, 0 }, // &
{ 39, 64, 19, 0, 0 }, // '
{ 40, 2, 48, 0, 0 }, // (
{ 41, 2, 49, 0, 0 }, // )
{ 42, 64, 56, 0, 0 }, // *
{ 43, 0, 30, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 47, 0, 0 }, // /
{ 48, 2, 39, 0, 0 }, // 0
{ 49, 2, 30, 0, 0 }, // 1
{ 50, 2, 31, 0, 0 }, // 2
{ 51, 2, 32, 0, 0 }, // 3
{ 52, 2, 33, 0, 0 }, // 4
{ 53, 2, 34, 0, 0 }, // 5
{ 54, 2, 35, 0, 0 }, // 6
{ 55, 2, 36, 0, 0 }, // 7
{ 56, 2, 37, 0, 0 }, // 8
{ 57, 2, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 0, 53, 0, 0 }, // ;
{ 60, 64, 54, 0, 0 }, // <
{ 61, 0, 45, 0, 0 }, // =
{ 62, 64, 29, 0, 0 }, // >
{ 63, 2, 54, 0, 0 }, // ?
{ 64, 64, 25, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 9, 0, 0 }, // [
{ 92, 64, 20, 0, 0 }, // \
{ 93, 64, 10, 0, 0 }, // ]
{ 94, 0, 44, 64, 32 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 64, 36, 0, 0 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 5, 0, 0 }, // {
{ 124, 64, 26, 0, 0 }, // |
{ 125, 64, 17, 0, 0 }, // }
{ 164, 64, 49, 0, 0 }, // ¤
{ 167, 0, 52, 0, 0 }, // §
{ 168, 0, 44, 64, 45 }, // ¨
{ 176, 0, 44, 64, 34 }, // °
{ 180, 0, 44, 64, 38 }, // ´
{ 184, 0, 44, 64, 46 }, // ¸
{ 193, 2, 4, 64, 38 }, // Á
{ 194, 2, 4, 64, 32 }, // Â
{ 196, 2, 4, 64, 45 }, // Ä
{ 199, 2, 6, 64, 46 }, // Ç
{ 201, 2, 8, 64, 38 }, // É
{ 203, 2, 8, 64, 45 }, // Ë
{ 205, 2, 12, 64, 38 }, // Í
{ 206, 2, 12, 64, 32 }, // Î
{ 211, 2, 18, 64, 38 }, // Ó
{ 212, 2, 18, 64, 32 }, // Ô
{ 214, 2, 18, 64, 45 }, // Ö
{ 215, 64, 48, 0, 0 }, // ×
{ 218, 2, 24, 64, 38 }, // Ú
{ 220, 2, 24, 64, 45 }, // Ü
{ 221, 2, 28, 64, 38 }, // Ý
{ 223, 64, 52, 0, 0 }, // ß
{ 225, 0, 37, 0, 0 }, // á
{ 226, 0, 4, 64, 32 }, // â
{ 228, 0, 48, 0, 0 }, // ä
{ 231, 0, 6, 64, 46 }, // ç
{ 233, 0, 39, 0, 0 }, // é
{ 235, 0, 8, 64, 45 }, // ë
{ 237, 0, 38, 0, 0 }, // í
{ 238, 0, 12, 64, 32 }, // î
{ 243, 0, 18, 64, 38 }, // ó
{ 244, 0, 51, 0, 0 }, // ô
{ 246, 0, 18, 64, 45 }, // ö
{ 247, 64, 47, 0, 0 }, // ÷
{ 250, 0, 47, 0, 0 }, // ú
{ 252, 0, 24, 64, 45 }, // ü
{ 253, 0, 36, 0, 0 }, // ý
{ 258, 2, 4, 64, 32 }, // Ã
{ 259, 0, 4, 64, 32 }, // ã
{ 260, 2, 4, 64, 35 }, // ¥
{ 261, 0, 4, 64, 35 }, // ¹
{ 262, 2, 6, 64, 38 }, // Æ
{ 263, 0, 6, 64, 38 }, // æ
{ 268, 2, 6, 64, 31 }, // È
{ 269, 0, 33, 0, 0 }, // è
{ 270, 2, 7, 64, 31 }, // Ï
{ 271, 0, 7, 64, 31 }, // ï
{ 272, 64, 7, 0, 0 }, // Ð
{ 273, 64, 22, 0, 0 }, // ð
{ 280, 2, 8, 64, 35 }, // Ê
{ 281, 0, 8, 64, 35 }, // ê
{ 282, 2, 8, 64, 31 }, // Ì
{ 283, 0, 8, 64, 31 }, // ì
{ 313, 2, 15, 64, 38 }, // Å
{ 314, 0, 15, 64, 38 }, // å
{ 317, 2, 15, 64, 31 }, // ¼
{ 318, 0, 31, 0, 0 }, // ¾
{ 321, 64, 15, 0, 0 }, // £
{ 322, 64, 14, 0, 0 }, // ³
{ 323, 2, 17, 64, 38 }, // Ñ
{ 324, 0, 17, 64, 38 }, // ñ
{ 327, 2, 17, 64, 31 }, // Ò
{ 328, 0, 49, 0, 0 }, // ò
{ 336, 2, 18, 64, 39 }, // Õ
{ 337, 0, 18, 64, 39 }, // õ
{ 340, 2, 21, 64, 38 }, // À
{ 341, 0, 21, 64, 38 }, // à
{ 344, 2, 21, 64, 31 }, // Ø
{ 345, 0, 21, 64, 31 }, // ø
{ 346, 2, 22, 64, 38 }, // Œ
{ 347, 0, 22, 64, 38 }, // œ
{ 350, 2, 22, 64, 46 }, // ª
{ 351, 0, 22, 64, 46 }, // º
{ 352, 2, 22, 64, 31 }, // Š
{ 353, 0, 32, 0, 0 }, // š
{ 354, 2, 23, 64, 46 }, // Þ
{ 355, 0, 23, 64, 46 }, // þ
{ 356, 2, 23, 64, 31 }, // <EFBFBD>
{ 357, 0, 34, 0, 0 }, // <EFBFBD>
{ 366, 2, 24, 64, 34 }, // Ù
{ 367, 0, 24, 64, 34 }, // ù
{ 368, 2, 24, 64, 39 }, // Û
{ 369, 0, 24, 64, 39 }, // û
{ 377, 2, 29, 64, 38 }, // <EFBFBD>
{ 378, 0, 29, 64, 38 }, // Ÿ
{ 379, 2, 29, 64, 37 }, // ¯
{ 380, 0, 29, 64, 37 }, // ¿
{ 381, 2, 29, 64, 31 }, // Ž
{ 382, 0, 35, 0, 0 }, // ž
{ 711, 0, 44, 64, 31 }, // ¡
{ 728, 0, 44, 64, 33 }, // ¢
{ 729, 0, 44, 64, 37 }, // ÿ
{ 731, 0, 44, 64, 35 }, // ²
{ 733, 0, 44, 64, 39 }, // ½
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -266,14 +467,19 @@ public class SlovakLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,171 @@ public class SpanishLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "es-ES";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//es-ES
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 20, 1, 44, 0, 0 }, // 
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 64, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 45, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 48, 0, 0 }, // *
{ 43, 0, 48, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 47, 0, 0 }, // [
{ 92, 64, 53, 0, 0 }, // \
{ 93, 64, 48, 0, 0 }, // ]
{ 94, 0, 44, 2, 47 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 0, 47 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 52, 0, 0 }, // {
{ 124, 64, 30, 0, 0 }, // |
{ 125, 64, 49, 0, 0 }, // }
{ 126, 0, 44, 64, 33 }, // ~
{ 161, 0, 46, 0, 0 }, // ?
{ 168, 0, 44, 2, 52 }, // ¨
{ 170, 2, 53, 0, 0 }, // ?
{ 172, 64, 35, 0, 0 }, // ¬
{ 180, 0, 44, 0, 52 }, // ´
{ 183, 2, 32, 0, 0 }, // ·
{ 186, 0, 53, 0, 0 }, // ?
{ 191, 2, 46, 0, 0 }, // ?
{ 192, 2, 4, 0, 47 }, // ?
{ 193, 2, 4, 0, 52 }, // Á
{ 194, 2, 4, 2, 47 }, // Â
{ 195, 2, 4, 64, 33 }, // ?
{ 196, 2, 4, 2, 52 }, // Ä
{ 199, 2, 49, 0, 0 }, // Ç
{ 200, 2, 8, 0, 47 }, // ?
{ 201, 2, 8, 0, 52 }, // É
{ 202, 2, 8, 2, 47 }, // ?
{ 203, 2, 8, 2, 52 }, // Ë
{ 204, 2, 12, 0, 47 }, // ?
{ 205, 2, 12, 0, 52 }, // Í
{ 206, 2, 12, 2, 47 }, // Î
{ 207, 2, 12, 2, 52 }, // ?
{ 209, 2, 51, 0, 0 }, // ?
{ 210, 2, 18, 0, 47 }, // ?
{ 211, 2, 18, 0, 52 }, // Ó
{ 212, 2, 18, 2, 47 }, // Ô
{ 213, 2, 18, 64, 33 }, // ?
{ 214, 2, 18, 2, 52 }, // Ö
{ 217, 2, 24, 0, 47 }, // ?
{ 218, 2, 24, 0, 52 }, // Ú
{ 219, 2, 24, 2, 47 }, // ?
{ 220, 2, 24, 2, 52 }, // Ü
{ 221, 2, 28, 0, 52 }, // Ý
{ 224, 0, 4, 0, 47 }, // ?
{ 225, 0, 4, 0, 52 }, // á
{ 226, 0, 4, 2, 47 }, // â
{ 227, 0, 4, 64, 33 }, // ?
{ 228, 0, 4, 2, 52 }, // ä
{ 231, 0, 49, 0, 0 }, // ç
{ 232, 0, 8, 0, 47 }, // ?
{ 233, 0, 8, 0, 52 }, // é
{ 234, 0, 8, 2, 47 }, // ?
{ 235, 0, 8, 2, 52 }, // ë
{ 236, 0, 12, 0, 47 }, // ?
{ 237, 0, 12, 0, 52 }, // í
{ 238, 0, 12, 2, 47 }, // î
{ 239, 0, 12, 2, 52 }, // ?
{ 241, 0, 51, 0, 0 }, // ?
{ 242, 0, 18, 0, 47 }, // ?
{ 243, 0, 18, 0, 52 }, // ó
{ 244, 0, 18, 2, 47 }, // ô
{ 245, 0, 18, 64, 33 }, // ?
{ 246, 0, 18, 2, 52 }, // ö
{ 249, 0, 24, 0, 47 }, // ?
{ 250, 0, 24, 0, 52 }, // ú
{ 251, 0, 24, 2, 47 }, // ?
{ 252, 0, 24, 2, 52 }, // ü
{ 253, 0, 28, 0, 52 }, // ý
{ 255, 0, 28, 2, 52 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -188,14 +353,19 @@ public class SpanishLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,169 @@ public class SwedishLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "sv-SE";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//sv-SE
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 53, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 64, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 49, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 49, 0, 0 }, // *
{ 43, 0, 45, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 64, 37, 0, 0 }, // [
{ 92, 64, 45, 0, 0 }, // \
{ 93, 64, 38, 0, 0 }, // ]
{ 94, 0, 44, 2, 48 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 64, 36, 0, 0 }, // {
{ 124, 64, 100, 0, 0 }, // |
{ 125, 64, 39, 0, 0 }, // }
{ 126, 0, 44, 64, 48 }, // ~
{ 163, 64, 32, 0, 0 }, // ?
{ 164, 2, 33, 0, 0 }, // ¤
{ 167, 0, 53, 0, 0 }, // §
{ 168, 0, 44, 0, 48 }, // ¨
{ 180, 0, 44, 0, 46 }, // ´
{ 181, 64, 16, 0, 0 }, // µ
{ 189, 2, 53, 0, 0 }, // ?
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 0, 46 }, // Á
{ 194, 2, 4, 2, 48 }, // Â
{ 195, 2, 4, 64, 48 }, // ?
{ 196, 2, 52, 0, 0 }, // Ä
{ 197, 2, 47, 0, 0 }, // ?
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 0, 46 }, // É
{ 202, 2, 8, 2, 48 }, // ?
{ 203, 2, 8, 0, 48 }, // Ë
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 0, 46 }, // Í
{ 206, 2, 12, 2, 48 }, // Î
{ 207, 2, 12, 0, 48 }, // ?
{ 209, 2, 17, 64, 48 }, // ?
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 0, 46 }, // Ó
{ 212, 2, 18, 2, 48 }, // Ô
{ 213, 2, 18, 64, 48 }, // ?
{ 214, 2, 51, 0, 0 }, // Ö
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 0, 46 }, // Ú
{ 219, 2, 24, 2, 48 }, // ?
{ 220, 2, 24, 0, 48 }, // Ü
{ 221, 2, 28, 0, 46 }, // Ý
{ 224, 0, 4, 2, 46 }, // ?
{ 225, 0, 4, 0, 46 }, // á
{ 226, 0, 4, 2, 48 }, // â
{ 227, 0, 4, 64, 48 }, // ?
{ 228, 0, 52, 0, 0 }, // ä
{ 229, 0, 47, 0, 0 }, // ?
{ 232, 0, 8, 2, 46 }, // ?
{ 233, 0, 8, 0, 46 }, // é
{ 234, 0, 8, 2, 48 }, // ?
{ 235, 0, 8, 0, 48 }, // ë
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 0, 46 }, // í
{ 238, 0, 12, 2, 48 }, // î
{ 239, 0, 12, 0, 48 }, // ?
{ 241, 0, 17, 64, 48 }, // ?
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 0, 46 }, // ó
{ 244, 0, 18, 2, 48 }, // ô
{ 245, 0, 18, 64, 48 }, // ?
{ 246, 0, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 0, 46 }, // ú
{ 251, 0, 24, 2, 48 }, // ?
{ 252, 0, 24, 0, 48 }, // ü
{ 253, 0, 28, 0, 46 }, // ý
{ 255, 0, 28, 0, 48 }, // ?
{ 8364, 64, 34, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -53,7 +216,7 @@ public class SwedishLayout extends KeyboardLayout {
/* 2b */ { 0 , 0x27 , 0x002a , -1 , -1 , -1 } ,
/* 2c */ { 1 , (int)'z' , (int)'Z' , -1 , -1 , -1 } ,
/* 2d */ { 1 , (int)'x' , (int)'X' , -1 , -1 , -1 } ,
/* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 -1 } ,
/* 2e */ { 1 , (int)'c' , (int)'C' , -1 , -1 , -1 } ,
/* 2f */ { 1 , (int)'v' , (int)'V' , -1 , -1 , -1 } ,
/* 30 */ { 1 , (int)'b' , (int)'B' , -1 , -1 , -1 } ,
@ -184,14 +347,19 @@ public class SwedishLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,155 @@ public class SwissFrenchLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "fr-CH";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//fr-CH
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 8, 2, 37, 0, 0 }, // 
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 48, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 64, 32, 0, 0 }, // #
{ 36, 0, 49, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 45, 0, 0 }, // '
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 32, 0, 0 }, // *
{ 43, 2, 30, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 29, 0, 0 }, // Y
{ 90, 2, 28, 0, 0 }, // Z
{ 91, 64, 47, 0, 0 }, // [
{ 92, 64, 100, 0, 0 }, // \
{ 93, 64, 48, 0, 0 }, // ]
{ 94, 0, 44, 0, 46 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 29, 0, 0 }, // y
{ 122, 0, 28, 0, 0 }, // z
{ 123, 64, 52, 0, 0 }, // {
{ 124, 64, 36, 0, 0 }, // |
{ 125, 64, 49, 0, 0 }, // }
{ 126, 64, 46, 0, 0 }, // ~
{ 162, 64, 37, 0, 0 }, // ?
{ 163, 2, 49, 0, 0 }, // ?
{ 166, 64, 30, 0, 0 }, // ¦
{ 167, 64, 34, 0, 0 }, // §
{ 168, 0, 48, 0, 0 }, // ¨
{ 172, 64, 35, 0, 0 }, // ¬
{ 176, 64, 33, 0, 0 }, // °
{ 180, 0, 44, 64, 45 }, // ´
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 64, 45 }, // Á
{ 194, 2, 4, 0, 46 }, // Â
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 64, 45 }, // É
{ 202, 2, 8, 0, 46 }, // ?
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 64, 45 }, // Í
{ 206, 2, 12, 0, 46 }, // Î
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 64, 45 }, // Ó
{ 212, 2, 18, 0, 46 }, // Ô
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 64, 45 }, // Ú
{ 219, 2, 24, 0, 46 }, // ?
{ 221, 2, 29, 64, 45 }, // Ý
{ 224, 0, 52, 0, 0 }, // ?
{ 225, 0, 4, 64, 45 }, // á
{ 226, 0, 4, 0, 46 }, // â
{ 228, 2, 52, 0, 0 }, // ä
{ 231, 2, 33, 0, 0 }, // ç
{ 232, 0, 47, 0, 0 }, // ?
{ 233, 0, 51, 0, 0 }, // é
{ 234, 0, 8, 0, 46 }, // ?
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 64, 45 }, // í
{ 238, 0, 12, 0, 46 }, // î
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 64, 45 }, // ó
{ 244, 0, 18, 0, 46 }, // ô
{ 246, 2, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 64, 45 }, // ú
{ 251, 0, 24, 0, 46 }, // ?
{ 252, 2, 47, 0, 0 }, // ü
{ 253, 0, 29, 64, 45 }, // ý
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -166,14 +315,19 @@ public class SwissFrenchLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,169 @@ public class SwissGermanLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "de-CH";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//de-CH
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 48, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 64, 32, 0, 0 }, // #
{ 36, 0, 49, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 35, 0, 0 }, // &
{ 39, 0, 45, 0, 0 }, // '
{ 40, 2, 37, 0, 0 }, // (
{ 41, 2, 38, 0, 0 }, // )
{ 42, 2, 32, 0, 0 }, // *
{ 43, 2, 30, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 56, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 2, 36, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 55, 0, 0 }, // :
{ 59, 2, 54, 0, 0 }, // ;
{ 60, 0, 100, 0, 0 }, // <
{ 61, 2, 39, 0, 0 }, // =
{ 62, 2, 100, 0, 0 }, // >
{ 63, 2, 45, 0, 0 }, // ?
{ 64, 64, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 29, 0, 0 }, // Y
{ 90, 2, 28, 0, 0 }, // Z
{ 91, 64, 47, 0, 0 }, // [
{ 92, 64, 100, 0, 0 }, // \
{ 93, 64, 48, 0, 0 }, // ]
{ 94, 0, 44, 0, 46 }, // ^
{ 95, 2, 56, 0, 0 }, // _
{ 96, 0, 44, 2, 46 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 29, 0, 0 }, // y
{ 122, 0, 28, 0, 0 }, // z
{ 123, 64, 52, 0, 0 }, // {
{ 124, 64, 36, 0, 0 }, // |
{ 125, 64, 49, 0, 0 }, // }
{ 126, 0, 44, 64, 46 }, // ~
{ 162, 64, 37, 0, 0 }, // ?
{ 163, 2, 49, 0, 0 }, // ?
{ 166, 64, 30, 0, 0 }, // ¦
{ 167, 64, 34, 0, 0 }, // §
{ 168, 0, 44, 0, 48 }, // ¨
{ 172, 64, 35, 0, 0 }, // ¬
{ 176, 64, 33, 0, 0 }, // °
{ 180, 0, 44, 64, 45 }, // ´
{ 192, 2, 4, 2, 46 }, // ?
{ 193, 2, 4, 64, 45 }, // Á
{ 194, 2, 4, 0, 46 }, // Â
{ 195, 2, 4, 64, 46 }, // ?
{ 196, 2, 4, 0, 48 }, // Ä
{ 200, 2, 8, 2, 46 }, // ?
{ 201, 2, 8, 64, 45 }, // É
{ 202, 2, 8, 0, 46 }, // ?
{ 203, 2, 8, 0, 48 }, // Ë
{ 204, 2, 12, 2, 46 }, // ?
{ 205, 2, 12, 64, 45 }, // Í
{ 206, 2, 12, 0, 46 }, // Î
{ 207, 2, 12, 0, 48 }, // ?
{ 209, 2, 17, 64, 46 }, // ?
{ 210, 2, 18, 2, 46 }, // ?
{ 211, 2, 18, 64, 45 }, // Ó
{ 212, 2, 18, 0, 46 }, // Ô
{ 213, 2, 18, 64, 46 }, // ?
{ 214, 2, 18, 0, 48 }, // Ö
{ 217, 2, 24, 2, 46 }, // ?
{ 218, 2, 24, 64, 45 }, // Ú
{ 219, 2, 24, 0, 46 }, // ?
{ 220, 2, 24, 0, 48 }, // Ü
{ 221, 2, 29, 64, 45 }, // Ý
{ 224, 2, 52, 0, 0 }, // ?
{ 225, 0, 4, 64, 45 }, // á
{ 226, 0, 4, 0, 46 }, // â
{ 227, 0, 4, 64, 46 }, // ?
{ 228, 0, 52, 0, 0 }, // ä
{ 231, 2, 33, 0, 0 }, // ç
{ 232, 2, 47, 0, 0 }, // ?
{ 233, 2, 51, 0, 0 }, // é
{ 234, 0, 8, 0, 46 }, // ?
{ 235, 0, 8, 0, 48 }, // ë
{ 236, 0, 12, 2, 46 }, // ?
{ 237, 0, 12, 64, 45 }, // í
{ 238, 0, 12, 0, 46 }, // î
{ 239, 0, 12, 0, 48 }, // ?
{ 241, 0, 17, 64, 46 }, // ?
{ 242, 0, 18, 2, 46 }, // ?
{ 243, 0, 18, 64, 45 }, // ó
{ 244, 0, 18, 0, 46 }, // ô
{ 245, 0, 18, 64, 46 }, // ?
{ 246, 0, 51, 0, 0 }, // ö
{ 249, 0, 24, 2, 46 }, // ?
{ 250, 0, 24, 64, 45 }, // ú
{ 251, 0, 24, 0, 46 }, // ?
{ 252, 0, 47, 0, 0 }, // ü
{ 253, 0, 29, 64, 45 }, // ý
{ 255, 0, 29, 0, 48 }, // ?
{ 8364, 64, 8, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -186,14 +349,19 @@ public class SwissGermanLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,124 @@ public class UnitedKingdomLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "en-GB";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//en-GB
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 31, 0, 0 }, // "
{ 35, 0, 49, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 52, 0, 0 }, // '
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 0, 56, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 51, 0, 0 }, // :
{ 59, 0, 51, 0, 0 }, // ;
{ 60, 2, 54, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 55, 0, 0 }, // >
{ 63, 2, 56, 0, 0 }, // ?
{ 64, 2, 52, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 0, 47, 0, 0 }, // [
{ 92, 0, 100, 0, 0 }, // \
{ 93, 0, 48, 0, 0 }, // ]
{ 94, 2, 35, 0, 0 }, // ^
{ 95, 2, 45, 0, 0 }, // _
{ 96, 0, 53, 0, 0 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 2, 47, 0, 0 }, // {
{ 124, 2, 100, 0, 0 }, // |
{ 125, 2, 48, 0, 0 }, // }
{ 126, 2, 49, 0, 0 }, // ~
{ 163, 2, 32, 0, 0 }, // ?
{ 166, 64, 53, 0, 0 }, // ¦
{ 172, 2, 53, 0, 0 }, // ¬
{ 193, 66, 4, 0, 0 }, // Á
{ 201, 66, 8, 0, 0 }, // É
{ 205, 66, 12, 0, 0 }, // Í
{ 211, 66, 18, 0, 0 }, // Ó
{ 218, 66, 24, 0, 0 }, // Ú
{ 225, 64, 4, 0, 0 }, // á
{ 233, 64, 8, 0, 0 }, // é
{ 237, 64, 12, 0, 0 }, // í
{ 243, 64, 18, 0, 0 }, // ó
{ 250, 64, 24, 0, 0 }, // ú
{ 8364, 64, 33, 0, 0 }, //
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -127,14 +245,19 @@ public class UnitedKingdomLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override

View File

@ -4,6 +4,110 @@ public class UnitedStatesLayout extends KeyboardLayout {
public static final String LOCALE_NAME = "en-US";
//{char (16b unicode), modifier, key, deadkey_modifier, deadkey}
//en-US
private static final int[][] FAST_LUT = {
{ 0, 0, 0, 0, 0 }, // empty
{ 27, 1, 47, 0, 0 }, // 
{ 28, 1, 49, 0, 0 }, // 
{ 29, 1, 48, 0, 0 }, // 
{ 32, 0, 44, 0, 0 }, //
{ 33, 2, 30, 0, 0 }, // !
{ 34, 2, 52, 0, 0 }, // "
{ 35, 2, 32, 0, 0 }, // #
{ 36, 2, 33, 0, 0 }, // $
{ 37, 2, 34, 0, 0 }, // %
{ 38, 2, 36, 0, 0 }, // &
{ 39, 0, 52, 0, 0 }, // '
{ 40, 2, 38, 0, 0 }, // (
{ 41, 2, 39, 0, 0 }, // )
{ 42, 2, 37, 0, 0 }, // *
{ 43, 2, 46, 0, 0 }, // +
{ 44, 0, 54, 0, 0 }, // ,
{ 45, 0, 45, 0, 0 }, // -
{ 46, 0, 55, 0, 0 }, // .
{ 47, 0, 56, 0, 0 }, // /
{ 48, 0, 39, 0, 0 }, // 0
{ 49, 0, 30, 0, 0 }, // 1
{ 50, 0, 31, 0, 0 }, // 2
{ 51, 0, 32, 0, 0 }, // 3
{ 52, 0, 33, 0, 0 }, // 4
{ 53, 0, 34, 0, 0 }, // 5
{ 54, 0, 35, 0, 0 }, // 6
{ 55, 0, 36, 0, 0 }, // 7
{ 56, 0, 37, 0, 0 }, // 8
{ 57, 0, 38, 0, 0 }, // 9
{ 58, 2, 51, 0, 0 }, // :
{ 59, 0, 51, 0, 0 }, // ;
{ 60, 2, 54, 0, 0 }, // <
{ 61, 0, 46, 0, 0 }, // =
{ 62, 2, 55, 0, 0 }, // >
{ 63, 2, 56, 0, 0 }, // ?
{ 64, 2, 31, 0, 0 }, // @
{ 65, 2, 4, 0, 0 }, // A
{ 66, 2, 5, 0, 0 }, // B
{ 67, 2, 6, 0, 0 }, // C
{ 68, 2, 7, 0, 0 }, // D
{ 69, 2, 8, 0, 0 }, // E
{ 70, 2, 9, 0, 0 }, // F
{ 71, 2, 10, 0, 0 }, // G
{ 72, 2, 11, 0, 0 }, // H
{ 73, 2, 12, 0, 0 }, // I
{ 74, 2, 13, 0, 0 }, // J
{ 75, 2, 14, 0, 0 }, // K
{ 76, 2, 15, 0, 0 }, // L
{ 77, 2, 16, 0, 0 }, // M
{ 78, 2, 17, 0, 0 }, // N
{ 79, 2, 18, 0, 0 }, // O
{ 80, 2, 19, 0, 0 }, // P
{ 81, 2, 20, 0, 0 }, // Q
{ 82, 2, 21, 0, 0 }, // R
{ 83, 2, 22, 0, 0 }, // S
{ 84, 2, 23, 0, 0 }, // T
{ 85, 2, 24, 0, 0 }, // U
{ 86, 2, 25, 0, 0 }, // V
{ 87, 2, 26, 0, 0 }, // W
{ 88, 2, 27, 0, 0 }, // X
{ 89, 2, 28, 0, 0 }, // Y
{ 90, 2, 29, 0, 0 }, // Z
{ 91, 0, 47, 0, 0 }, // [
{ 92, 0, 49, 0, 0 }, // \
{ 93, 0, 48, 0, 0 }, // ]
{ 94, 2, 35, 0, 0 }, // ^
{ 95, 2, 45, 0, 0 }, // _
{ 96, 0, 53, 0, 0 }, // `
{ 97, 0, 4, 0, 0 }, // a
{ 98, 0, 5, 0, 0 }, // b
{ 99, 0, 6, 0, 0 }, // c
{ 100, 0, 7, 0, 0 }, // d
{ 101, 0, 8, 0, 0 }, // e
{ 102, 0, 9, 0, 0 }, // f
{ 103, 0, 10, 0, 0 }, // g
{ 104, 0, 11, 0, 0 }, // h
{ 105, 0, 12, 0, 0 }, // i
{ 106, 0, 13, 0, 0 }, // j
{ 107, 0, 14, 0, 0 }, // k
{ 108, 0, 15, 0, 0 }, // l
{ 109, 0, 16, 0, 0 }, // m
{ 110, 0, 17, 0, 0 }, // n
{ 111, 0, 18, 0, 0 }, // o
{ 112, 0, 19, 0, 0 }, // p
{ 113, 0, 20, 0, 0 }, // q
{ 114, 0, 21, 0, 0 }, // r
{ 115, 0, 22, 0, 0 }, // s
{ 116, 0, 23, 0, 0 }, // t
{ 117, 0, 24, 0, 0 }, // u
{ 118, 0, 25, 0, 0 }, // v
{ 119, 0, 26, 0, 0 }, // w
{ 120, 0, 27, 0, 0 }, // x
{ 121, 0, 28, 0, 0 }, // y
{ 122, 0, 29, 0, 0 }, // z
{ 123, 2, 47, 0, 0 }, // {
{ 124, 2, 49, 0, 0 }, // |
{ 125, 2, 48, 0, 0 }, // }
{ 126, 2, 53, 0, 0 }, // ~
};
public static final int LUT[][] = {
/* 0 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
/* 1 */ { -1 , 0 , 0 , 0 , 0 , 0 } ,
@ -126,14 +230,19 @@ public class UnitedStatesLayout extends KeyboardLayout {
return LUT;
}
@Override
public int[][] getFastLUT() {
return FAST_LUT;
}
@Override
public void type(String text) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, (byte)0);
super.type(FAST_LUT, text, (byte)0);
}
@Override
public void type(String text, byte modifiers) {
super.type(LUT, DEADKEY_LUT, DEADKEYS, text, modifiers);
super.type(FAST_LUT, text, modifiers);
}
@Override