mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-04 15:19:11 +00:00
Convert repeat counter to an unsigned int
This commit is contained in:
parent
11104f91ed
commit
44ad422a34
2 changed files with 5 additions and 8 deletions
|
@ -45,7 +45,7 @@ struct control_msg {
|
||||||
enum android_keyevent_action action;
|
enum android_keyevent_action action;
|
||||||
enum android_keycode keycode;
|
enum android_keycode keycode;
|
||||||
enum android_metastate metastate;
|
enum android_metastate metastate;
|
||||||
int repeat;
|
unsigned int repeat;
|
||||||
} inject_keycode;
|
} inject_keycode;
|
||||||
struct {
|
struct {
|
||||||
char *text; // owned, to be freed by SDL_free()
|
char *text; // owned, to be freed by SDL_free()
|
||||||
|
|
|
@ -232,7 +232,7 @@ input_manager_process_text_input(struct input_manager *im,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int repeatCounter[AKEYCODE_ALL_APPS];
|
unsigned int repeatCounter = 0;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
convert_input_key(const SDL_KeyboardEvent *from, struct control_msg *to,
|
convert_input_key(const SDL_KeyboardEvent *from, struct control_msg *to,
|
||||||
|
@ -251,18 +251,15 @@ convert_input_key(const SDL_KeyboardEvent *from, struct control_msg *to,
|
||||||
|
|
||||||
if (to->inject_keycode.action == AKEY_EVENT_ACTION_DOWN && repeat)
|
if (to->inject_keycode.action == AKEY_EVENT_ACTION_DOWN && repeat)
|
||||||
{
|
{
|
||||||
repeatCounter[to->inject_keycode.keycode] = repeatCounter[to->inject_keycode.keycode] + 1;
|
++repeatCounter;
|
||||||
//LOGW("Setting repeat mode to %d %d",to->inject_keycode.keycode,to->inject_keycode.repeat );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//LOGW("Clearing repeate for %d",to->inject_keycode.keycode );
|
repeatCounter = 0;
|
||||||
repeatCounter[to->inject_keycode.keycode] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
to->inject_keycode.repeat = repeatCounter[to->inject_keycode.keycode];
|
to->inject_keycode.repeat = repeatCounter;
|
||||||
//LOGW("Current code for %d ======== %d",to->inject_keycode.keycode,to->inject_keycode.repeat );
|
|
||||||
|
|
||||||
to->inject_keycode.metastate = convert_meta_state(mod);
|
to->inject_keycode.metastate = convert_meta_state(mod);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue