refactor: Use Pointers.Modifiers.has less

The performance characteristics of this function will change in future
plans.
This commit is contained in:
Jules Aguillon 2024-03-18 00:09:32 +01:00
parent 0549c6c8a1
commit ec8e78d5cc

View File

@ -250,12 +250,11 @@ public final class KeyEventHandler implements Config.IKeyEventHandler
if (conn == null) if (conn == null)
return; return;
ExtractedText et = get_cursor_pos(conn); ExtractedText et = get_cursor_pos(conn);
int system_mods =
KeyEvent.META_CTRL_ON | KeyEvent.META_ALT_ON | KeyEvent.META_META_ON;
// Fallback to sending key events // Fallback to sending key events
if (_move_cursor_force_fallback if (_move_cursor_force_fallback || et == null
|| et == null || (_meta_state & system_mods) != 0)
|| _mods.has(KeyValue.Modifier.CTRL)
|| _mods.has(KeyValue.Modifier.ALT)
|| _mods.has(KeyValue.Modifier.META))
{ {
move_cursor_fallback(d); move_cursor_fallback(d);
return; return;
@ -273,7 +272,7 @@ public final class KeyEventHandler implements Config.IKeyEventHandler
{ {
sel_end += d; sel_end += d;
// Leave 'sel_start' where it is if shift is pressed // Leave 'sel_start' where it is if shift is pressed
if (!_mods.has(KeyValue.Modifier.SHIFT)) if ((_meta_state & KeyEvent.META_SHIFT_ON) == 0)
sel_start = sel_end; sel_start = sel_end;
} }
if (!conn.setSelection(sel_start, sel_end)) if (!conn.setSelection(sel_start, sel_end))