SDL: sticky modifier keys in built-in QWERTY keyboard
This commit is contained in:
@@ -91,6 +91,7 @@ import android.inputmethodservice.KeyboardView;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class MainActivity extends Activity
|
||||
{
|
||||
@@ -522,6 +523,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
public boolean shift = false;
|
||||
public boolean alt = false;
|
||||
public TreeSet<Integer> stickyKeys = new TreeSet<Integer>();
|
||||
public BuiltInKeyboardView(Context context, android.util.AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
@@ -552,12 +554,18 @@ public class MainActivity extends Activity
|
||||
setKeyboard(new Keyboard(MainActivity.this, TextInputKeyboardList[idx][keyboard]));
|
||||
setPreviewEnabled(false);
|
||||
setProximityCorrectionEnabled(false);
|
||||
for (Keyboard.Key k: getKeyboard().getKeys())
|
||||
{
|
||||
if (stickyKeys.contains(k.codes[0]))
|
||||
{
|
||||
k.on = true;
|
||||
invalidateAllKeys();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final BuiltInKeyboardView builtinKeyboard = new BuiltInKeyboardView(MainActivity.this, null);
|
||||
builtinKeyboard.setKeyboard(new Keyboard(MainActivity.this, TextInputKeyboardList[0][keyboard]));
|
||||
builtinKeyboard.setPreviewEnabled(false);
|
||||
builtinKeyboard.setProximityCorrectionEnabled(false);
|
||||
builtinKeyboard.ChangeKeyboard();
|
||||
builtinKeyboard.setOnKeyboardActionListener(new KeyboardView.OnKeyboardActionListener()
|
||||
{
|
||||
public void onPress(int key)
|
||||
@@ -566,6 +574,11 @@ public class MainActivity extends Activity
|
||||
return;
|
||||
if (key < 0)
|
||||
return;
|
||||
for (Keyboard.Key k: builtinKeyboard.getKeyboard().getKeys())
|
||||
{
|
||||
if (k.sticky && key == k.codes[0])
|
||||
return;
|
||||
}
|
||||
if (key > 100000)
|
||||
{
|
||||
key -= 100000;
|
||||
@@ -603,6 +616,23 @@ public class MainActivity extends Activity
|
||||
}
|
||||
if (key < 0)
|
||||
return;
|
||||
for (Keyboard.Key k: builtinKeyboard.getKeyboard().getKeys())
|
||||
{
|
||||
if (k.sticky && key == k.codes[0])
|
||||
{
|
||||
if (k.on)
|
||||
{
|
||||
builtinKeyboard.stickyKeys.add(key);
|
||||
MainActivity.this.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||
}
|
||||
else
|
||||
{
|
||||
builtinKeyboard.stickyKeys.remove(key);
|
||||
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean shifted = false;
|
||||
if (key > 100000)
|
||||
@@ -614,7 +644,18 @@ public class MainActivity extends Activity
|
||||
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
|
||||
if (shifted)
|
||||
{
|
||||
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
builtinKeyboard.stickyKeys.remove(KeyEvent.KEYCODE_SHIFT_LEFT);
|
||||
for (Keyboard.Key k: builtinKeyboard.getKeyboard().getKeys())
|
||||
{
|
||||
if (k.sticky && k.codes[0] == KeyEvent.KEYCODE_SHIFT_LEFT && k.on)
|
||||
{
|
||||
k.on = false;
|
||||
builtinKeyboard.invalidateAllKeys();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onText(CharSequence p1) {}
|
||||
public void swipeLeft() {}
|
||||
|
||||
Submodule project/jni/application/xserver/pulseaudio updated: f865b80665...bdb11d93b7
Submodule project/jni/application/xserver/xserver updated: 4dd75cbadc...006833ad95
@@ -30,7 +30,7 @@
|
||||
<Key android:codes="74" android:keyLabel=";" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row>
|
||||
<Key android:codes="-1" android:keyLabel="⇪" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-1" android:keyLabel="⇪" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="54" android:keyLabel="z" android:isRepeatable="true"/>
|
||||
<Key android:codes="52" android:keyLabel="x" android:isRepeatable="true"/>
|
||||
<Key android:codes="31" android:keyLabel="c" android:isRepeatable="true"/>
|
||||
@@ -38,10 +38,10 @@
|
||||
<Key android:codes="30" android:keyLabel="b" android:isRepeatable="true"/>
|
||||
<Key android:codes="42" android:keyLabel="n" android:isRepeatable="true"/>
|
||||
<Key android:codes="41" android:keyLabel="m" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="←x" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="123…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-6" android:keyLabel="123…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="71" android:keyLabel="[" android:isRepeatable="true"/>
|
||||
<Key android:codes="72" android:keyLabel="]" android:isRepeatable="true"/>
|
||||
<Key android:codes="76" android:keyLabel="/" android:isRepeatable="true"/>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<Key android:codes="123" android:keyLabel="End" android:isRepeatable="true" android:keyEdgeFlags="right" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key android:codes="-1" android:keyLabel="!@#…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-1" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="75" android:keyLabel="'" android:isRepeatable="true"/>
|
||||
<Key android:codes="100075" android:keyLabel=""" android:isRepeatable="true"/>
|
||||
<Key android:codes="61" android:keyLabel="Tab" android:isRepeatable="true"/>
|
||||
@@ -43,15 +43,15 @@
|
||||
<Key android:codes="22" android:keyLabel="→" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="59" android:keyLabel="Shift" android:isRepeatable="true"/>
|
||||
<Key android:codes="113" android:keyLabel="Ctrl" android:isRepeatable="true"/>
|
||||
<Key android:codes="117" android:keyLabel="☆" android:isRepeatable="true"/>
|
||||
<Key android:codes="57" android:keyLabel="Alt" android:isRepeatable="true"/>
|
||||
<Key android:codes="58" android:keyLabel="Alt" android:isRepeatable="true"/>
|
||||
<Key android:codes="118" android:keyLabel="☆" android:isRepeatable="true"/>
|
||||
<Key android:codes="226" android:keyLabel="•••" android:isRepeatable="true"/>
|
||||
<Key android:codes="114" android:keyLabel="Ctrl" android:isRepeatable="true"/>
|
||||
<Key android:codes="60" android:keyLabel="Shift" android:isRepeatable="true"/>
|
||||
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="59" android:keyLabel="Shift" android:isSticky="true"/>
|
||||
<Key android:codes="113" android:keyLabel="Ctrl" android:isSticky="true"/>
|
||||
<Key android:codes="117" android:keyLabel="Meta" android:isSticky="true"/>
|
||||
<Key android:codes="57" android:keyLabel="Alt" android:isSticky="true"/>
|
||||
<Key android:codes="58" android:keyLabel="Alt" android:isSticky="true"/>
|
||||
<Key android:codes="118" android:keyLabel="Meta" android:isSticky="true"/>
|
||||
<Key android:codes="226" android:keyLabel="Menu" android:isRepeatable="true"/>
|
||||
<Key android:codes="114" android:keyLabel="Ctrl" android:isSticky="true"/>
|
||||
<Key android:codes="60" android:keyLabel="Shift" android:isSticky="true"/>
|
||||
</Row>
|
||||
</Keyboard>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<Key android:codes="134" android:keyLabel="F4" android:isRepeatable="true" android:keyEdgeFlags="right" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key android:codes="-1" android:keyLabel="123…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-1" android:keyLabel="123…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="143" android:keyLabel="NumLk" android:isRepeatable="true"/>
|
||||
<Key android:codes="120" android:keyLabel="Print" android:isRepeatable="true"/>
|
||||
<Key android:codes="116" android:keyLabel="ScrollLk" android:isRepeatable="true"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
<Key android:codes="138" android:keyLabel="F8" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-6" android:keyLabel="abc…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="154" android:keyLabel="Kp /" android:isRepeatable="true"/>
|
||||
<Key android:codes="155" android:keyLabel="Kp *" android:isRepeatable="true"/>
|
||||
<Key android:codes="156" android:keyLabel="Kp -" android:isRepeatable="true"/>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<Key android:codes="74" android:keyLabel=":" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row>
|
||||
<Key android:codes="-1" android:keyLabel="⇫" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-1" android:keyLabel="⇫" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="54" android:keyLabel="Z" android:isRepeatable="true"/>
|
||||
<Key android:codes="52" android:keyLabel="X" android:isRepeatable="true"/>
|
||||
<Key android:codes="31" android:keyLabel="C" android:isRepeatable="true"/>
|
||||
@@ -38,10 +38,10 @@
|
||||
<Key android:codes="30" android:keyLabel="B" android:isRepeatable="true"/>
|
||||
<Key android:codes="42" android:keyLabel="N" android:isRepeatable="true"/>
|
||||
<Key android:codes="41" android:keyLabel="M" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="←x" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
|
||||
<Key android:codes="71" android:keyLabel="{" android:isRepeatable="true"/>
|
||||
<Key android:codes="72" android:keyLabel="}" android:isRepeatable="true"/>
|
||||
<Key android:codes="76" android:keyLabel="\?" android:isRepeatable="true"/>
|
||||
|
||||
Reference in New Issue
Block a user