summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/AglShellGrpcClient.cpp16
-rw-r--r--src/AglShellGrpcClient.h1
-rw-r--r--src/agl_shell.proto11
-rw-r--r--src/main.cpp12
4 files changed, 39 insertions, 1 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp
index ee2fe48..058c051 100644
--- a/src/AglShellGrpcClient.cpp
+++ b/src/AglShellGrpcClient.cpp
@@ -104,6 +104,22 @@ GrpcClient::SetAppOnOutput(const std::string& app_id, const std::string& output_
return status.ok();
}
+bool
+GrpcClient::SetAppPosition(const std::string& app_id, int32_t x, int32_t y)
+{
+ agl_shell_ipc::AppPositionRequest request;
+
+ request.set_app_id(app_id);
+ request.set_x(x);
+ request.set_y(y);
+
+ grpc::ClientContext context;
+ ::agl_shell_ipc::AppPositionResponse reply;
+
+ grpc::Status status = m_stub->SetAppPosition(&context, request, &reply);
+ return status.ok();
+}
+
grpc::Status
GrpcClient::Wait(void)
{
diff --git a/src/AglShellGrpcClient.h b/src/AglShellGrpcClient.h
index 7c30fe6..bc246d9 100644
--- a/src/AglShellGrpcClient.h
+++ b/src/AglShellGrpcClient.h
@@ -94,6 +94,7 @@ 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 SetAppPosition(const std::string& app_id, int32_t x, int32_t y);
std::vector<std::string> GetOutputs();
void GetAppState();
void AppStatusState(Callback callback);
diff --git a/src/agl_shell.proto b/src/agl_shell.proto
index aac35f4..74ea958 100644
--- a/src/agl_shell.proto
+++ b/src/agl_shell.proto
@@ -13,6 +13,7 @@ service AglShellManagerService {
rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {}
rpc SetAppNormal(NormalRequest) returns (NormalResponse) {}
rpc SetAppOnOutput(AppOnOutputRequest) returns (AppOnOutputResponse) {}
+ rpc SetAppPosition(AppPositionRequest) returns (AppPositionResponse) {}
}
message ActivateRequest {
@@ -23,6 +24,7 @@ message ActivateRequest {
message ActivateResponse {
};
+
message DeactivateRequest {
string app_id = 1;
}
@@ -87,3 +89,12 @@ message AppOnOutputRequest {
message AppOnOutputResponse {
};
+
+message AppPositionRequest {
+ string app_id = 1;
+ int32 x = 2;
+ int32 y = 3;
+};
+
+message AppPositionResponse {
+};
diff --git a/src/main.cpp b/src/main.cpp
index 727bd27..ed809fe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -46,6 +46,7 @@ enum mode {
FULLSCREEN = 2,
FULLSCREEN_QT = 3, // rather than use rpc, use Qt API
ON_OTHER_OUTPUTS = 4,
+ SET_FLOAT_POS = 5,
};
static QWindow *
@@ -81,10 +82,12 @@ int main(int argc, char *argv[])
mmode = ON_OTHER_OUTPUTS;
else if (strcmp(argv[1], "full_qt") == 0)
mmode = FULLSCREEN_QT;
+ else if (strcmp(argv[1], "position") == 0)
+ mmode = SET_FLOAT_POS;
else
assert(!"Invalid mode");
- if (mmode != FLOAT && mmode != FULLSCREEN && mmode != ON_OTHER_OUTPUTS) {
+ if (mmode != FLOAT && mmode != FULLSCREEN && mmode != ON_OTHER_OUTPUTS && mmode != SET_FLOAT_POS) {
fprintf(stderr, "Will not use rpc\n");
goto skip;
}
@@ -118,6 +121,13 @@ int main(int argc, char *argv[])
client->SetAppOnOutput(myname.toStdString(),
std::string(output_name));
break;
+ case SET_FLOAT_POS:
+ // this assumes the window is already running and
+ // floating; uses the same application so this needs
+ // to be first started as float.
+ client->SetAppPosition(myname.toStdString(), 550, 550);
+ exit(EXIT_SUCCESS);
+ break;
default:
break;
}