From f4032e3be98b7e70fcd384537c3191cf7542c735 Mon Sep 17 00:00:00 2001
From: Jules Aguillon
Date: Sun, 22 Jan 2023 23:13:30 +0100
Subject: Remove the modulated repeat
It allowed to modulate the repeat speed of some keys (arrow, backspace,
delete) by move the finger farther or closer to the key.
In practice, this wasn't pratical and doesn't seem popular. It is
removed in favor of a better mechanism for moving the cursor.
---
res/values-cs/strings.xml | 2 --
res/values-de/strings.xml | 2 --
res/values-es/strings.xml | 2 --
res/values-fr/strings.xml | 2 --
res/values-it/strings.xml | 2 --
res/values-ko/strings.xml | 2 --
res/values-lv/strings.xml | 2 --
res/values-pl/strings.xml | 2 --
res/values-pt/strings.xml | 2 --
res/values-ru/strings.xml | 2 --
res/values-tr/strings.xml | 2 --
res/values-zh-rCN/strings.xml | 2 --
res/values/strings.xml | 2 --
res/xml/settings.xml | 1 -
srcs/juloo.keyboard2/Config.java | 2 --
srcs/juloo.keyboard2/KeyValue.java | 10 +++----
srcs/juloo.keyboard2/Pointers.java | 59 ++------------------------------------
17 files changed, 8 insertions(+), 90 deletions(-)
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 4af7efb..fc084f6 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -36,8 +36,6 @@
Interval opakování znaků
Vibrace
Zapnout/Vypnout vibrace při stisku klávesy
- Precizní posun kurzoru
- Zda-li posun prstem ovlivňuje rychlost kurzoru
Dvojklik pro aktivaci caps lock(u)
Dvojklik namísto držení modifikačních kláves po nějakou dobu
Styl
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index c51e52f..e810baa 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -36,8 +36,6 @@
Intervall der Tastenwiederholung
Vibration
Vibration bei Tastendruck ein-/ausschalten
- Präzise Cursorsteuerung
- Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen
Umschalttaste mit Doppeltippen einrasten
Anstatt Taste längere Zeit gedrückt zu halten
Design
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 6d35522..e029a3c 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -36,8 +36,6 @@
Intervalo de repetición de tecla
Vibración
Habilitar/deshabilitar vibración al presionar una tecla
- Movimientos de cursor preciso
- Modular la velocidad de repetición de teclas según si se desliza más o menos
Estilo
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 6f6e221..773398b 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -36,8 +36,6 @@
Écart entre les répétitions
Vibreur
Vibration a chaque touche
- Mouvement précis du curseur
- Modifier la vitesse de répétition en bougeant le doigt
Appuyer deux fois pour bloquer la majuscule
Un appui long bloque la majuscule
Style
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index a0374ce..ef467bf 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -36,8 +36,6 @@
Intervallo ripetizione tasto
Vibrazione
Abilita/Disabilita Vibrazione alla pressione dei tasti
- Movimento puntatore preciso
- Modula la veocità della ripetizione con lo swipe
Doppio tocco su Shift per attivare CapsLock
Invece di premere i modificatori a lungo
Stile
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 22184c2..d11c6f7 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -36,8 +36,6 @@
키 반복 간격
진동
키 누를 때 진동 키거/끄기
- 정확한 커서 움직임
- 더 많거나 적은 스와이프로 키 반복 조절
스타일
diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml
index 1eaddf1..6854892 100644
--- a/res/values-lv/strings.xml
+++ b/res/values-lv/strings.xml
@@ -36,8 +36,6 @@
Taustiņa atkārtošanās aizture
Trīcēšana
Iespējot/atspējot taustiņa piespiešanas trīcēšanu
- Pielāgojama kursora kustība
- Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu
Divkāršs piesitiens burtslēgam
Tā vietā, lai ilstoši piespiestu pārveidotāju
Izskata pielāgojumi
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index f4482e6..2313c63 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -36,8 +36,6 @@
Czas pomiędzy powtórzeniami
Wibracja
Wł./wył. wibrację przy naciśnięciu klawisza
- Dokładne poruszanie kursorem
- Reguluj prędkość powtarzania naciśnięć klawisza poprzez przesunięcie dalej lub bliżej
Naciśnij Shift podwójnie, aby włączyć caps lock
Możesz zablokować modyfikator poprzez jego długie naciśnięcie
Styl
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index a52ccc5..5c3f4ed 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -36,8 +36,6 @@
Intervalo de repetição de tecla
Vibração
Ativar/desativar vibração ao digitar
- Precisão nos movimentos do cursor
- Varia a velocidade de repetição a depender do quanto deslizar
Tecle duas vezes no shift para caixa alta
Ao invés de apertar e segurar por um tempo
Estilo
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index c89d436..a845ccf 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -36,8 +36,6 @@
Интервал повтора клавиш
Вибрация
Включение/выключение вибрации при нажатии клавиши
- Точные перемещения курсора
- Изменяйте скорость повтора клавиш, проводя пальцем больше или меньше
Двойное нажатие на Shift активирует Caps lock
Вы можете активировать модификатор, удерживая клавишу
Стиль
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index dc0a8d3..1e9aba4 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -36,8 +36,6 @@
Tuş tekrarlama aralığı
Titreşim
Tuşa basıldığında titreşimi etkinleştir
- İmleç hareketini ayarla
- Tuş tekrar hızını az ya da çok kaydırarak ayarla
Stil
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index fa6c4a5..c3c1412 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -36,8 +36,6 @@
长按后每次重复输入的时间间隔
振动
启用或者禁用按下按键时振动
- 精确控制光标移速
- 按键重复按下速度由手指滑动的距离决定
双击Shift键锁定大写
任何时候都可以长按修改键以锁定
样式
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 802ee14..8a717a4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -36,8 +36,6 @@
Key repeat interval
Vibration
Enable/disable vibration on keypress
- Precise cursor movements
- Modulate key repeat speed by swiping more or less
Double tap on shift for caps lock
You can lock any modifier by holding it
Style
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index dac5df2..8633ae0 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -47,7 +47,6 @@
-
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index fbb542a..b8580e6 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -41,7 +41,6 @@ final class Config
public int keyboardOpacity; // 0 - 255
public int keyOpacity; // 0 - 255
public int keyActivatedOpacity; // 0 - 255
- public boolean preciseRepeat;
public boolean double_tap_lock_shift;
public float characterSize; // Ratio
public int accents; // Values are R.values.pref_accents_v_*
@@ -142,7 +141,6 @@ final class Config
horizontal_margin =
get_dip_pref(dm, oriented_pref("horizontal_margin"),
res.getDimension(R.dimen.horizontal_margin));
- preciseRepeat = _prefs.getBoolean("precise_repeat", true);
double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false);
characterSize =
_prefs.getFloat("character_size", 1.f)
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index b7a0593..8d12518 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -78,7 +78,7 @@ final class KeyValue
public static final int FLAG_LOCK = (1 << 21);
// Special keys are not repeated and don't clear latched modifiers.
public static final int FLAG_SPECIAL = (1 << 22);
- public static final int FLAG_PRECISE_REPEAT = (1 << 23);
+ // Free flag: (1 << 23);
// Rendering flags.
public static final int FLAG_KEY_FONT = (1 << 24); // special font file
public static final int FLAG_SMALLER_FONT = (1 << 25); // 25% smaller symbols
@@ -328,10 +328,10 @@ final class KeyValue
addKeyeventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT);
addKeyeventKey("enter", 0x0E, KeyEvent.KEYCODE_ENTER, 0);
- addKeyeventKey("up", 0x05, KeyEvent.KEYCODE_DPAD_UP, FLAG_PRECISE_REPEAT);
- addKeyeventKey("right", 0x06, KeyEvent.KEYCODE_DPAD_RIGHT, FLAG_PRECISE_REPEAT);
- addKeyeventKey("down", 0x07, KeyEvent.KEYCODE_DPAD_DOWN, FLAG_PRECISE_REPEAT);
- addKeyeventKey("left", 0x08, KeyEvent.KEYCODE_DPAD_LEFT, FLAG_PRECISE_REPEAT);
+ addKeyeventKey("up", 0x05, KeyEvent.KEYCODE_DPAD_UP, 0);
+ addKeyeventKey("right", 0x06, KeyEvent.KEYCODE_DPAD_RIGHT, 0);
+ addKeyeventKey("down", 0x07, KeyEvent.KEYCODE_DPAD_DOWN, 0);
+ addKeyeventKey("left", 0x08, KeyEvent.KEYCODE_DPAD_LEFT, 0);
addKeyeventKey("page_up", 0x02, KeyEvent.KEYCODE_PAGE_UP, 0);
addKeyeventKey("page_down", 0x03, KeyEvent.KEYCODE_PAGE_DOWN, 0);
addKeyeventKey("home", 0x0B, KeyEvent.KEYCODE_MOVE_HOME, 0);
diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java
index 46b76fc..448fd4c 100644
--- a/srcs/juloo.keyboard2/Pointers.java
+++ b/srcs/juloo.keyboard2/Pointers.java
@@ -147,11 +147,6 @@ public final class Pointers implements Handler.Callback
public void onTouchDown(float x, float y, int pointerId, KeyboardData.Key key)
{
- // Ignore new presses while a modulated key is active. On some devices,
- // ghost touch events can happen while the pointer travels on top of other
- // keys.
- if (isModulatedKeyPressed())
- return;
// Don't take latched modifiers into account if an other key is pressed.
// The other key already "own" the latched modifiers and will clear them.
Modifiers mods = getModifiers(isOtherPointerDown());
@@ -207,7 +202,6 @@ public final class Pointers implements Handler.Callback
float dx = x - ptr.downX;
float dy = y - ptr.downY;
float dist = Math.abs(dx) + Math.abs(dy);
- ptr.ptrDist = dist;
int direction;
if (dist < _config.swipe_dist_px)
@@ -237,12 +231,6 @@ public final class Pointers implements Handler.Callback
int old_flags = ptr.flags;
ptr.value = newValue;
ptr.flags = newValue.getFlags();
- // Keep the keyrepeat going between modulated keys.
- if ((old_flags & ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) == 0)
- {
- stopKeyRepeat(ptr);
- startKeyRepeat(ptr);
- }
_handler.onPointerDown(true);
}
}
@@ -299,16 +287,6 @@ public final class Pointers implements Handler.Callback
_handler.onPointerFlagsChanged(shouldVibrate);
}
- private boolean isModulatedKeyPressed()
- {
- for (Pointer ptr : _ptrs)
- {
- if ((ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
- return true;
- }
- return false;
- }
-
// Key repeat
/** Message from [_keyrepeat_handler]. */
@@ -320,7 +298,8 @@ public final class Pointers implements Handler.Callback
if (ptr.timeoutWhat == msg.what)
{
if (handleKeyRepeat(ptr))
- _keyrepeat_handler.sendEmptyMessageDelayed(msg.what, nextRepeatInterval(ptr));
+ _keyrepeat_handler.sendEmptyMessageDelayed(msg.what,
+ _config.longPressInterval);
else
ptr.timeoutWhat = -1;
return true;
@@ -329,17 +308,6 @@ public final class Pointers implements Handler.Callback
return false;
}
- private long nextRepeatInterval(Pointer ptr)
- {
- long t = _config.longPressInterval;
- if (_config.preciseRepeat && (ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
- {
- // Modulate repeat interval depending on the distance of the pointer
- t = (long)((float)t * 2.f / modulatePreciseRepeat(ptr));
- }
- return t;
- }
-
private static int uniqueTimeoutWhat = 0;
private void startKeyRepeat(Pointer ptr)
@@ -348,11 +316,7 @@ public final class Pointers implements Handler.Callback
return;
int what = (uniqueTimeoutWhat++);
ptr.timeoutWhat = what;
- long timeout = _config.longPressTimeout;
- // Faster repeat timeout for modulated keys
- if ((ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
- timeout /= 2;
- _keyrepeat_handler.sendEmptyMessageDelayed(what, timeout);
+ _keyrepeat_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
}
private void stopKeyRepeat(Pointer ptr)
@@ -361,7 +325,6 @@ public final class Pointers implements Handler.Callback
{
_keyrepeat_handler.removeMessages(ptr.timeoutWhat);
ptr.timeoutWhat = -1;
- ptr.repeatingPtrDist = -1.f;
}
}
@@ -381,16 +344,6 @@ public final class Pointers implements Handler.Callback
return true;
}
- private float modulatePreciseRepeat(Pointer ptr)
- {
- if (ptr.repeatingPtrDist < 0.f)
- ptr.repeatingPtrDist = ptr.ptrDist; // First repeat
- if (ptr.ptrDist > ptr.repeatingPtrDist * 2.f)
- ptr.repeatingPtrDist = ptr.ptrDist / 2.f; // Large swipe, move the middle point
- float left = ptr.repeatingPtrDist / 2.f;
- float accel = (ptr.ptrDist - left) / (ptr.repeatingPtrDist - left);
- return Math.min(8.f, Math.max(0.1f, accel));
- }
private static final class Pointer
{
@@ -404,16 +357,12 @@ public final class Pointers implements Handler.Callback
public KeyValue value;
public float downX;
public float downY;
- /** Distance of the pointer to the initial press. */
- public float ptrDist;
/** Modifier flags at the time the key was pressed. */
public Modifiers modifiers;
/** Flags of the value. Latch, lock and locked flags are updated. */
public int flags;
/** Identify timeout messages. */
public int timeoutWhat;
- /** ptrDist at the first repeat, -1 otherwise. */
- public float repeatingPtrDist;
public Pointer(int p, KeyboardData.Key k, KeyValue v, float x, float y, Modifiers m)
{
@@ -423,11 +372,9 @@ public final class Pointers implements Handler.Callback
value = v;
downX = x;
downY = y;
- ptrDist = 0.f;
modifiers = m;
flags = (v == null) ? 0 : v.getFlags();
timeoutWhat = -1;
- repeatingPtrDist = -1.f;
}
}
--
cgit v1.2.3