summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-04-07 19:36:32 +0300
committerMarius Vlad <marius.vlad@collabora.com>2023-04-12 17:40:40 +0300
commitacbc5bbd1c4f903d3a94cf36cbfb8e3476ae413f (patch)
tree1d6327a4122a2164dd79f68f32a7b3696cb3494e
parent8b057267c4180e5648b6636f4b5b1de07f627977 (diff)
AglShellGrpcClient: Add set_app_outputsandbox/mvlad/set_app_output
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--src/AglShellGrpcClient.cpp15
-rw-r--r--src/AglShellGrpcClient.h1
-rw-r--r--src/agl_shell.proto9
-rw-r--r--src/main.cpp23
4 files changed, 42 insertions, 6 deletions
diff --git a/src/AglShellGrpcClient.cpp b/src/AglShellGrpcClient.cpp
index 73aad71..ee2fe48 100644
--- a/src/AglShellGrpcClient.cpp
+++ b/src/AglShellGrpcClient.cpp
@@ -89,6 +89,21 @@ GrpcClient::SetAppFullscreen(const std::string& app_id)
return status.ok();
}
+bool
+GrpcClient::SetAppOnOutput(const std::string& app_id, const std::string& output_name)
+{
+ agl_shell_ipc::AppOnOutputRequest request;
+
+ request.set_app_id(app_id);
+ request.set_output(output_name);
+
+ 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 a50369a..7c30fe6 100644
--- a/src/AglShellGrpcClient.h
+++ b/src/AglShellGrpcClient.h
@@ -93,6 +93,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);
std::vector<std::string> GetOutputs();
void GetAppState();
void AppStatusState(Callback callback);
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 b2a5b4d..727bd27 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -45,7 +45,7 @@ enum mode {
FLOAT = 1,
FULLSCREEN = 2,
FULLSCREEN_QT = 3, // rather than use rpc, use Qt API
- REMOTE = 4,
+ ON_OTHER_OUTPUTS = 4,
};
static QWindow *
@@ -72,22 +72,26 @@ int main(int argc, char *argv[])
QQmlComponent main_comp(&engine, QUrl("qrc:/Main.qml"));
if (argc >= 2) {
+ const char *output_name = nullptr;
if (strcmp(argv[1], "float") == 0)
mmode = FLOAT;
else if (strcmp(argv[1], "full") == 0)
mmode = FULLSCREEN;
- else if (strcmp(argv[1], "remote") == 0)
- mmode = REMOTE;
+ else if (strcmp(argv[1], "on_output") == 0)
+ mmode = ON_OTHER_OUTPUTS;
else if (strcmp(argv[1], "full_qt") == 0)
mmode = FULLSCREEN_QT;
else
assert(!"Invalid mode");
- if (mmode != FLOAT && mmode != FULLSCREEN && mmode != REMOTE) {
+ if (mmode != FLOAT && mmode != FULLSCREEN && mmode != ON_OTHER_OUTPUTS) {
fprintf(stderr, "Will not use rpc\n");
goto skip;
}
+ if (mmode == ON_OTHER_OUTPUTS)
+ output_name = argv[2];
+
// start grpc connection
GrpcClient *client = new GrpcClient();
@@ -104,8 +108,15 @@ int main(int argc, char *argv[])
fprintf(stderr, "Setting the application as fullscreen\n");
client->SetAppFullscreen(myname.toStdString());
break;
- case REMOTE:
- fprintf(stderr, "Setting the application as remote\n");
+ case ON_OTHER_OUTPUTS:
+ fprintf(stderr, "Setting application '%s' on output '%s'\n",
+ myname.toStdString().c_str(), output_name);
+ if (!output_name) {
+ fprintf(stderr, "Output name is not set!\n");
+ exit(EXIT_FAILURE);
+ }
+ client->SetAppOnOutput(myname.toStdString(),
+ std::string(output_name));
break;
default:
break;