diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-04-07 16:31:53 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2023-04-07 16:31:53 +0300 |
commit | ff24e58926270e781c3fa3be7da873f72878a891 (patch) | |
tree | 6ebf9611474507cf59b58000460f784071985d6d | |
parent | d2dcfd079aa110a5658b904edde1684fe684fd25 (diff) |
AglShellGrpcClient: Add support for set_app_on_outputsandbox/mvlad/set_app_normal
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r-- | src/AglShellGrpcClient.cpp | 15 | ||||
-rw-r--r-- | src/AglShellGrpcClient.h | 1 | ||||
-rw-r--r-- | src/agl_shell.proto | 9 | ||||
-rw-r--r-- | src/main.cpp | 16 |
4 files changed, 40 insertions, 1 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp index e196e1f..e1dad57 100644 --- a/src/AglShellGrpcClient.cpp +++ b/src/AglShellGrpcClient.cpp @@ -104,6 +104,21 @@ GrpcClient::SetAppFullscreen(const std::string& app_id) return status.ok(); } +bool +GrpcClient::SetAppOnOutput(const std::string& app_id, const std::string &output) +{ + agl_shell_ipc::AppOnOutputRequest request; + + request.set_app_id(app_id); + request.set_output(output); + + grpc::ClientContext context; + ::agl_shell_ipc::AppOnOutputResponse reply; + + grpc::Status status = m_stub->SetAppOnOutput(&context, request, &reply); + return status.ok(); +} + grpc::Status GrpcClient::Wait(void) { diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h index d59ba9a..4b33469 100644 --- a/src/AglShellGrpcClient.h +++ b/src/AglShellGrpcClient.h @@ -94,6 +94,7 @@ public: bool DeactivateApp(const std::string& app_id); bool SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos); bool SetAppFullscreen(const std::string& app_id); + bool SetAppOnOutput(const std::string& app_id, const std::string& output); bool SetAppNormal(const std::string& app_id); std::vector<std::string> GetOutputs(); void GetAppState(); diff --git a/src/agl_shell.proto b/src/agl_shell.proto index 200d43e..aac35f4 100644 --- a/src/agl_shell.proto +++ b/src/agl_shell.proto @@ -12,6 +12,7 @@ service AglShellManagerService { rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} + rpc SetAppOnOutput(AppOnOutputRequest) returns (AppOnOutputResponse) {} } message ActivateRequest { @@ -78,3 +79,11 @@ message FullscreenRequest { message FullscreenResponse { }; + +message AppOnOutputRequest { + string app_id = 1; + string output = 2; +}; + +message AppOnOutputResponse { +}; diff --git a/src/main.cpp b/src/main.cpp index 15c88b6..77eacf5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,7 @@ enum action_state { SET_NORMAL, GETOUTPUTS, SET_FULLSCREEN, + SET_APP_ON_OUTPUT, }; static struct action { @@ -61,6 +62,7 @@ static struct action { { SET_FLOAT, "FLOAT" }, { SET_NORMAL, "NORMAL" }, { SET_FULLSCREEN, "FULLSCREEN" }, + { SET_APP_ON_OUTPUT, "APP_ON_OUTPUT" }, }; static int @@ -87,7 +89,7 @@ help(char **argv) { fprintf(stderr, "Usage: %s [-a action] [-p app_id] [-o output_name] [-l]\n", argv[0]); - fprintf(stderr, "\t-a -- action activate|deactivate|float|normal|getoutputs|fullscreen\n"); + fprintf(stderr, "\t-a -- action activate|deactivate|float|normal|getoutputs|fullscreen|on_output\n"); fprintf(stderr, "\t-p -- app_id application_id\n"); fprintf(stderr, "\t-o -- output_name one of the outputs from getoutputs action\n"); fprintf(stderr, "\t-l -- continuously listen for window state events\n"); @@ -194,6 +196,18 @@ int main(int argc, char *argv[]) fprintf(stderr, "Fullscreened application '%s'\n", app_id); client->SetAppFullscreen(std::string(app_id)); break; + case SET_APP_ON_OUTPUT: + if (!app_id) { + fprintf(stderr, "AppOnOutput require an app_id\n"); + help(argv); + } + if (!output) { + fprintf(stderr, "AppOnOutput require an output\n"); + help(argv); + } + fprintf(stderr, "Putting application '%s' on output '%s'\n", app_id, output); + client->SetAppOnOutput(std::string(app_id), std::string(output)); + break; case SET_NORMAL: if (!app_id) { fprintf(stderr, "Normal/maximized require an app_id\n"); |