forked from extern/Unexpected-Keyboard
Fix caps lock stopped by auto-capitalisation
Auto-capitalisation triggers when the backspace key is used. Make sure to not remove a locked shift pointer.
This commit is contained in:
parent
0da02d60c4
commit
1f9e92ed60
@ -105,10 +105,19 @@ public class Keyboard2View extends View
|
||||
{
|
||||
if (_keyboard == null || _shift_key == null)
|
||||
return;
|
||||
int flags = _pointers.getKeyFlags(_shift_key, _shift_kv);
|
||||
if (state)
|
||||
{
|
||||
if (flags != -1 && !lock)
|
||||
return; // Don't replace an existing pointer
|
||||
_pointers.add_fake_pointer(_shift_kv, _shift_key, lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((flags & KeyValue.FLAG_FAKE_PTR) != 0)
|
||||
return; // Don't remove locked pointers
|
||||
_pointers.remove_fake_pointer(_shift_kv, _shift_key);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,20 @@ public final class Pointers implements Handler.Callback
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getKeyFlags(KeyboardData.Key key, KeyValue kv)
|
||||
{
|
||||
Pointer ptr = getLatched(key, kv);
|
||||
if (ptr == null) return -1;
|
||||
return ptr.flags;
|
||||
}
|
||||
|
||||
/** Fake pointers are latched and not lockable. */
|
||||
public void add_fake_pointer(KeyValue kv, KeyboardData.Key key, boolean locked)
|
||||
{
|
||||
if (getLatched(key, kv) != null)
|
||||
return; // Already latched, don't add an other pointer.
|
||||
Pointer ptr = new Pointer(-1, key, kv, 0.f, 0.f, Modifiers.EMPTY);
|
||||
Pointer ptr = getLatched(key, kv);
|
||||
if (ptr != null)
|
||||
removePtr(ptr); // Already latched, replace pointer.
|
||||
ptr = new Pointer(-1, key, kv, 0.f, 0.f, Modifiers.EMPTY);
|
||||
ptr.flags &= ~(KeyValue.FLAG_LATCH | KeyValue.FLAG_LOCK);
|
||||
ptr.flags |= KeyValue.FLAG_FAKE_PTR;
|
||||
if (locked)
|
||||
|
Loading…
Reference in New Issue
Block a user