2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-09-02 07:15:30 +00:00

Merge commands with other control events

Several commands were grouped under the same event type "command", with
a separate field to indicate the actual command.

Move these commands at the same level as other control events. It will
allow to implement commands with arguments.
This commit is contained in:
Romain Vimont
2019-05-30 16:07:24 +02:00
parent 3b4366e5bf
commit 63909fd10d
6 changed files with 29 additions and 60 deletions

View File

@@ -99,9 +99,7 @@ action_menu(struct controller *controller, int actions) {
static void
press_back_or_turn_screen_on(struct controller *controller) {
struct control_event control_event;
control_event.type = CONTROL_EVENT_TYPE_COMMAND;
control_event.command_event.action =
CONTROL_EVENT_COMMAND_BACK_OR_SCREEN_ON;
control_event.type = CONTROL_EVENT_TYPE_BACK_OR_SCREEN_ON;
if (!controller_push_event(controller, &control_event)) {
LOGW("Cannot turn screen on");
@@ -111,9 +109,7 @@ press_back_or_turn_screen_on(struct controller *controller) {
static void
expand_notification_panel(struct controller *controller) {
struct control_event control_event;
control_event.type = CONTROL_EVENT_TYPE_COMMAND;
control_event.command_event.action =
CONTROL_EVENT_COMMAND_EXPAND_NOTIFICATION_PANEL;
control_event.type = CONTROL_EVENT_TYPE_EXPAND_NOTIFICATION_PANEL;
if (!controller_push_event(controller, &control_event)) {
LOGW("Cannot expand notification panel");
@@ -123,9 +119,7 @@ expand_notification_panel(struct controller *controller) {
static void
collapse_notification_panel(struct controller *controller) {
struct control_event control_event;
control_event.type = CONTROL_EVENT_TYPE_COMMAND;
control_event.command_event.action =
CONTROL_EVENT_COMMAND_COLLAPSE_NOTIFICATION_PANEL;
control_event.type = CONTROL_EVENT_TYPE_COLLAPSE_NOTIFICATION_PANEL;
if (!controller_push_event(controller, &control_event)) {
LOGW("Cannot collapse notification panel");