aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-02-02 23:44:05 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-02-11 01:05:13 +0200
commit5695439dc3b1a4378e3b8dee4ce9749ee15b8146 (patch)
treec9927339f3f8b21d457707f03c4c47cf38cf60bd
parent7d66c4700490508768cae3cd474a63db2fb9f142 (diff)
src: Add set_app_float request support
Bug-AGL: SPEC-4673 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I7beaead3c5c87e1e60f66ad1b20f2bf625414c8e
-rw-r--r--src/AglShellGrpcClient.cpp18
-rw-r--r--src/AglShellGrpcClient.h1
-rw-r--r--src/agl_shell.proto2
-rw-r--r--src/main.cpp11
4 files changed, 31 insertions, 1 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp
index 7f1ce20..db27190 100644
--- a/src/AglShellGrpcClient.cpp
+++ b/src/AglShellGrpcClient.cpp
@@ -59,6 +59,24 @@ GrpcClient::DeactivateApp(const std::string& app_id)
return status.ok();
}
+bool
+GrpcClient::SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos)
+{
+ agl_shell_ipc::FloatRequest request;
+
+ request.set_app_id(app_id);
+
+ request.set_x_pos(x_pos);
+ request.set_y_pos(y_pos);
+
+ grpc::ClientContext context;
+ ::agl_shell_ipc::FloatResponse reply;
+
+ grpc::Status status = m_stub->SetAppFloat(&context, request, &reply);
+ return status.ok();
+}
+
+
grpc::Status
GrpcClient::Wait(void)
{
diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h
index aedde07..82ae6eb 100644
--- a/src/AglShellGrpcClient.h
+++ b/src/AglShellGrpcClient.h
@@ -92,6 +92,7 @@ public:
GrpcClient();
bool ActivateApp(const std::string& app_id, const std::string& output_name);
bool DeactivateApp(const std::string& app_id);
+ bool SetAppFloat(const std::string& app_id, int32_t x_pos, int32_t y_pos);
std::vector<std::string> GetOutputs();
void GetAppState();
void AppStatusState(Callback callback);
diff --git a/src/agl_shell.proto b/src/agl_shell.proto
index 22fad1c..8e81750 100644
--- a/src/agl_shell.proto
+++ b/src/agl_shell.proto
@@ -37,6 +37,8 @@ message SplitResponse {
message FloatRequest {
string app_id = 1;
+ int32 x_pos = 2;
+ int32 y_pos = 3;
}
message FloatResponse {
diff --git a/src/main.cpp b/src/main.cpp
index dc3dd82..593de6b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,6 +56,7 @@ static struct action {
{ ACTIVATE, "ACTIVATE" },
{ DEACTIVATE, "DEACTIVATE" },
{ GETOUTPUTS, "GETOUTPUTS" },
+ { SET_FLOAT, "FLOAT" },
};
static int
@@ -82,7 +83,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|getoutputs\n");
+ fprintf(stderr, "\t-a -- action activate|deactivate|float|max|getoutputs\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");
@@ -173,6 +174,14 @@ int main(int argc, char *argv[])
fprintf(stderr, "Deactivating application '%s'\n", app_id);
client->DeactivateApp(std::string(app_id));
break;
+ case SET_FLOAT:
+ if (!app_id) {
+ fprintf(stderr, "Float require an app_id\n");
+ help(argv);
+ }
+ fprintf(stderr, "Floating application '%s'\n", app_id);
+ client->SetAppFloat(std::string(app_id), 40, 300);
+ break;
case GETOUTPUTS:
read_outputs(client);
break;