Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion srcs/juloo.keyboard2/Keyboard2View.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ public void onPointerUp(KeyValue k, Pointers.Modifiers mods)
invalidate();
}

public void onPointerHold(KeyValue k, Pointers.Modifiers mods)
public void onPointerHold(KeyValue k, Pointers.Modifiers mods,
boolean should_vibrate)
{
_config.handler.key_up(k, mods);
updateFlags();
if (should_vibrate)
vibrate();
}

public void onPointerFlagsChanged(boolean shouldVibrate)
Expand Down
9 changes: 6 additions & 3 deletions srcs/juloo.keyboard2/Pointers.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private void handleLongPress(Pointer ptr)
// For every other keys, key-repeat
if (_config.keyrepeat_enabled)
{
_handler.onPointerHold(kv, ptr.modifiers);
_handler.onPointerHold(kv, ptr.modifiers, false);
_longpress_handler.sendEmptyMessageDelayed(ptr.timeoutWhat,
_config.longPressInterval);
}
Expand Down Expand Up @@ -615,6 +615,8 @@ public Sliding(float x, float y, int dirx, int diry, KeyValue.Slider s)
/** Make horizontal sliders slower while ctrl is held (which typically
means movement happens by whole words instead of characters) */
static final float SPEED_WORD_MULT = 0.25f;
/** Vibration are not generated faster than this. */
static final float VIBRATION_MAX_SPEED = 1.5f;

public void onTouchMove(Pointer ptr, float x, float y)
{
Expand Down Expand Up @@ -643,8 +645,9 @@ public void onTouchMove(Pointer ptr, float x, float y)
if (d_ != 0)
{
d -= d_;
boolean should_vibrate = (speed < VIBRATION_MAX_SPEED);
_handler.onPointerHold(KeyValue.sliderKey(slider, d_),
ptr.modifiers);
ptr.modifiers, should_vibrate);
}
}

Expand Down Expand Up @@ -820,6 +823,6 @@ public interface IPointerEventHandler
public void onPointerFlagsChanged(boolean shouldVibrate);

/** Key is repeating. */
public void onPointerHold(KeyValue k, Modifiers mods);
public void onPointerHold(KeyValue k, Modifiers mods, boolean shouldVibrate);
}
}
Loading