diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2024-02-01 15:01:29 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2024-02-23 15:18:17 +0000 |
commit | cb7aa009ef9873967152e716fb01fecc30d401f7 (patch) | |
tree | 179e737071c9cbb1eafe49c45f0b165e49b0a8dc | |
parent | 5a1dc65ef626bbf487c5ed33a7ffe62cbe45c72a (diff) |
AglShellGrpcClient: Add support for split windowssalmon_18.90.0salmon/18.90.018.90.0
And with it, add missing SetAppNormal.
Bug-AGL: SPEC-4890
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic362ea671674c4ffac3e8efe15977b2bec3ad316
-rw-r--r-- | src/AglShellGrpcClient.cpp | 38 | ||||
-rw-r--r-- | src/AglShellGrpcClient.h | 3 | ||||
-rw-r--r-- | src/agl_shell.proto | 25 | ||||
-rw-r--r-- | src/main.cpp | 13 |
4 files changed, 65 insertions, 14 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp index 804ab79..5f1b447 100644 --- a/src/AglShellGrpcClient.cpp +++ b/src/AglShellGrpcClient.cpp @@ -76,6 +76,20 @@ GrpcClient::SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos) } bool +GrpcClient::SetAppNormal(const std::string& app_id) +{ + agl_shell_ipc::NormalRequest request; + + request.set_app_id(app_id); + + grpc::ClientContext context; + ::agl_shell_ipc::NormalResponse reply; + + grpc::Status status = m_stub->SetAppNormal(&context, request, &reply); + return status.ok(); +} + +bool GrpcClient::SetAppFullscreen(const std::string& app_id) { agl_shell_ipc::FullscreenRequest request; @@ -90,12 +104,12 @@ GrpcClient::SetAppFullscreen(const std::string& app_id) } bool -GrpcClient::SetAppOnOutput(const std::string& app_id, const std::string& output_name) +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_name); + request.set_output(output); grpc::ClientContext context; ::agl_shell_ipc::AppOnOutputResponse reply; @@ -136,6 +150,26 @@ GrpcClient::SetAppScale(const std::string& app_id, int32_t width, int32_t height return status.ok(); } + +bool +GrpcClient::SetAppSplit(const std::string& app_id, uint32_t orientation, + int32_t width, int32_t sticky, const std::string& output_name) +{ + agl_shell_ipc::SplitRequest request; + + request.set_app_id(app_id); + request.set_output_name(output_name); + request.set_tile_orientation(orientation); + request.set_width(width); + request.set_sticky(sticky); + + grpc::ClientContext context; + ::agl_shell_ipc::SplitResponse reply; + + grpc::Status status = m_stub->SetAppSplit(&context, request, &reply); + return status.ok(); +} + grpc::Status GrpcClient::Wait(void) { diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h index 844ece5..f66b44c 100644 --- a/src/AglShellGrpcClient.h +++ b/src/AglShellGrpcClient.h @@ -94,8 +94,11 @@ public: 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); bool SetAppPosition(const std::string& app_id, int32_t x, int32_t y); bool SetAppScale(const std::string& app_id, int32_t width, int32_t height); + bool SetAppSplit(const std::string& app_id, uint32_t orientation, + int32_t width, int32_t sticky, const std::string& output_name); std::vector<std::string> GetOutputs(); void GetAppState(); void AppStatusState(Callback callback); diff --git a/src/agl_shell.proto b/src/agl_shell.proto index 1aa3dd4..d38d896 100644 --- a/src/agl_shell.proto +++ b/src/agl_shell.proto @@ -4,17 +4,17 @@ syntax = "proto3"; package agl_shell_ipc; service AglShellManagerService { - rpc ActivateApp(ActivateRequest) returns (ActivateResponse) {} - rpc DeactivateApp(DeactivateRequest) returns (DeactivateResponse) {} - rpc SetAppSplit(SplitRequest) returns (SplitResponse) {} - rpc SetAppFloat(FloatRequest) returns (FloatResponse) {} - rpc SetAppFullscreen(FullscreenRequest) returns (FullscreenResponse) {} - rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} - rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} - rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} - rpc SetAppOnOutput(AppOnOutputRequest) returns (AppOnOutputResponse) {} - rpc SetAppPosition(AppPositionRequest) returns (AppPositionResponse) {} - rpc SetAppScale(AppScaleRequest) returns (AppScaleResponse) {} + rpc ActivateApp(ActivateRequest) returns (ActivateResponse) {} + rpc DeactivateApp(DeactivateRequest) returns (DeactivateResponse) {} + rpc SetAppSplit(SplitRequest) returns (SplitResponse) {} + rpc SetAppFloat(FloatRequest) returns (FloatResponse) {} + rpc SetAppFullscreen(FullscreenRequest) returns (FullscreenResponse) {} + rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} + rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} + rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} + rpc SetAppOnOutput(AppOnOutputRequest) returns (AppOnOutputResponse) {} + rpc SetAppPosition(AppPositionRequest) returns (AppPositionResponse) {} + rpc SetAppScale(AppScaleRequest) returns (AppScaleResponse) {} } message ActivateRequest { @@ -36,6 +36,9 @@ message DeactivateResponse { message SplitRequest { string app_id = 1; int32 tile_orientation = 2; + int32 width = 3; + int32 sticky = 4; + string output_name = 5; } message SplitResponse { diff --git a/src/main.cpp b/src/main.cpp index 6ab9530..3db6372 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,6 +48,7 @@ enum mode { ON_OTHER_OUTPUTS = 4, SET_FLOAT_POS = 5, SCALE = 6, + SPLIT = 7, }; static QWindow * @@ -87,12 +88,14 @@ int main(int argc, char *argv[]) mmode = SET_FLOAT_POS; else if (strcmp(argv[1], "scale") == 0) mmode = SCALE; + else if (strcmp(argv[1], "split") == 0) + mmode = SPLIT; else assert(!"Invalid mode"); if (mmode != FLOAT && mmode != FULLSCREEN && mmode != ON_OTHER_OUTPUTS && mmode != SET_FLOAT_POS && - mmode != SCALE) { + mmode != SCALE && mmode != SPLIT) { fprintf(stderr, "Will not use rpc\n"); goto skip; } @@ -100,6 +103,9 @@ int main(int argc, char *argv[]) if (mmode == ON_OTHER_OUTPUTS) output_name = argv[2]; + if (mmode == SPLIT) + output_name = argv[2]; + // start grpc connection GrpcClient *client = new GrpcClient(); @@ -140,6 +146,11 @@ int main(int argc, char *argv[]) client->SetAppScale(myname.toStdString(), 200, 200); exit(EXIT_SUCCESS); break; + case SPLIT: + // put it on the bottom + client->SetAppSplit(myname.toStdString(), 4, 0, 0, + std::string(output_name)); + break; default: break; } |