mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-25 04:02:02 +02:00
Disable automatically Shift when pressing Ctrl
Automatic capitalisation might interferes with keyboard shortcuts.
This commit is contained in:
parent
cf76118548
commit
f4c11d99ed
@ -77,6 +77,13 @@ final class Autocapitalisation
|
|||||||
callback(true);
|
callback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
_should_enable_shift = false;
|
||||||
|
_should_update_caps_mode = false;
|
||||||
|
callback(true);
|
||||||
|
}
|
||||||
|
|
||||||
public static interface Callback
|
public static interface Callback
|
||||||
{
|
{
|
||||||
public void update_shift_state(boolean should_enable, boolean should_disable);
|
public void update_shift_state(boolean should_enable, boolean should_disable);
|
||||||
|
@ -359,6 +359,7 @@ final class Config
|
|||||||
|
|
||||||
public static interface IKeyEventHandler
|
public static interface IKeyEventHandler
|
||||||
{
|
{
|
||||||
|
public void key_down(KeyValue value, boolean is_swipe);
|
||||||
public void key_up(KeyValue value, Pointers.Modifiers flags);
|
public void key_up(KeyValue value, Pointers.Modifiers flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,29 @@ class KeyEventHandler implements Config.IKeyEventHandler
|
|||||||
_autocap.selection_updated(oldSelStart, newSelStart);
|
_autocap.selection_updated(oldSelStart, newSelStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A key is being pressed. There will not necessarily be a corresponding
|
||||||
|
[key_up] event. */
|
||||||
|
public void key_down(KeyValue key, boolean isSwipe)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
return;
|
||||||
|
switch (key.getKind())
|
||||||
|
{
|
||||||
|
case Modifier:
|
||||||
|
// Stop auto capitalisation when activating a system modifier
|
||||||
|
switch (key.getModifier())
|
||||||
|
{
|
||||||
|
case CTRL:
|
||||||
|
case ALT:
|
||||||
|
case META:
|
||||||
|
_autocap.stop();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** A key has been released. */
|
/** A key has been released. */
|
||||||
public void key_up(KeyValue key, Pointers.Modifiers mods)
|
public void key_up(KeyValue key, Pointers.Modifiers mods)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ public class Keyboard2View extends View
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((flags & KeyValue.FLAG_FAKE_PTR) != 0)
|
if ((flags & KeyValue.FLAG_FAKE_PTR) == 0)
|
||||||
return; // Don't remove locked pointers
|
return; // Don't remove locked pointers
|
||||||
_pointers.remove_fake_pointer(_shift_kv, _shift_key);
|
_pointers.remove_fake_pointer(_shift_kv, _shift_key);
|
||||||
}
|
}
|
||||||
@ -134,8 +134,9 @@ public class Keyboard2View extends View
|
|||||||
return KeyModifier.modify(k, mods);
|
return KeyModifier.modify(k, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPointerDown(boolean isSwipe)
|
public void onPointerDown(KeyValue k, boolean isSwipe)
|
||||||
{
|
{
|
||||||
|
_config.handler.key_down(k, isSwipe);
|
||||||
invalidate();
|
invalidate();
|
||||||
vibrate();
|
vibrate();
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public final class Pointers implements Handler.Callback
|
|||||||
Pointer ptr = new Pointer(pointerId, key, value, x, y, mods);
|
Pointer ptr = new Pointer(pointerId, key, value, x, y, mods);
|
||||||
_ptrs.add(ptr);
|
_ptrs.add(ptr);
|
||||||
startKeyRepeat(ptr);
|
startKeyRepeat(ptr);
|
||||||
_handler.onPointerDown(false);
|
_handler.onPointerDown(value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final int[] DIRECTION_TO_INDEX = new int[]{
|
static final int[] DIRECTION_TO_INDEX = new int[]{
|
||||||
@ -263,7 +263,7 @@ public final class Pointers implements Handler.Callback
|
|||||||
{
|
{
|
||||||
startSliding(ptr, dy);
|
startSliding(ptr, dy);
|
||||||
}
|
}
|
||||||
_handler.onPointerDown(true);
|
_handler.onPointerDown(newValue, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,7 +383,7 @@ public final class Pointers implements Handler.Callback
|
|||||||
{
|
{
|
||||||
ptr.value = kv;
|
ptr.value = kv;
|
||||||
ptr.flags = kv.getFlags();
|
ptr.flags = kv.getFlags();
|
||||||
_handler.onPointerDown(true);
|
_handler.onPointerDown(kv, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Stop repeating: Special keys
|
// Stop repeating: Special keys
|
||||||
@ -522,8 +522,9 @@ public final class Pointers implements Handler.Callback
|
|||||||
public KeyValue modifyKey(KeyValue k, Modifiers flags);
|
public KeyValue modifyKey(KeyValue k, Modifiers flags);
|
||||||
|
|
||||||
/** A key is pressed. [getModifiers()] is uptodate. Might be called after a
|
/** A key is pressed. [getModifiers()] is uptodate. Might be called after a
|
||||||
press or a swipe to a different value. */
|
press or a swipe to a different value. Down events are not paired with
|
||||||
public void onPointerDown(boolean isSwipe);
|
up events. */
|
||||||
|
public void onPointerDown(KeyValue k, boolean isSwipe);
|
||||||
|
|
||||||
/** Key is released. [k] is the key that was returned by
|
/** Key is released. [k] is the key that was returned by
|
||||||
[modifySelectedKey] or [modifySelectedKey]. */
|
[modifySelectedKey] or [modifySelectedKey]. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user