Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linuxinput] Handle all kinds of buttons #10730

Merged
merged 1 commit into from
May 23, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void enable(EvdevLibrary.Type type, int code) {

public Collection<Key> enumerateKeys() {
int minKey = 0;
int maxKey = 255 - 1;
int maxKey = lib.event_type_get_max(EvdevLibrary.Type.KEY.intValue());
List<Key> result = new ArrayList<>();
for (int i = minKey; i <= maxKey; i++) {
if (has(EvdevLibrary.Type.KEY, i)) {
Expand All @@ -215,6 +215,11 @@ public int getCode() {
public String getName() {
return lib.event_code_get_name(EvdevLibrary.Type.KEY.intValue(), code);
}

@Override
public String toString() {
return String.valueOf(code);
}
}

public static class InputEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public InputEvent(Runtime runtime) {

int enable_event_type(@In Handle handle, int type);

int event_type_get_max(int type);

int disable_event_type(@In Handle handle, int type);

boolean has_event_code(@In Handle handle, int type, int code);
Expand Down