summaryrefslogtreecommitdiffstats
path: root/grpc-proxy
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-07-31 14:41:48 +0300
committerMarius Vlad <marius.vlad@collabora.com>2023-08-29 13:31:20 +0000
commitca537df2c52990acf97fb1c42ec2d993c60eae2d (patch)
tree04dee27f2bec9969285547bb7815238264bf2bff /grpc-proxy
parent2edba91d3eab0d7b3c490c12be1f9bc3b5255aa8 (diff)
grpc-proxy: Add dynamic scale of floating windows
This adds basic scaling for floating windows, sending new dimensions to the clients to resize itself. Bug-AGL: SPEC-4862 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ic693153cd704b278dcddd2514afc8dafecf8829b
Diffstat (limited to 'grpc-proxy')
-rw-r--r--grpc-proxy/agl_shell.proto30
-rw-r--r--grpc-proxy/grpc-async-cb.cpp13
-rw-r--r--grpc-proxy/grpc-async-cb.h4
-rw-r--r--grpc-proxy/main-grpc.cpp4
-rw-r--r--grpc-proxy/shell.cpp10
-rw-r--r--grpc-proxy/shell.h1
6 files changed, 50 insertions, 12 deletions
diff --git a/grpc-proxy/agl_shell.proto b/grpc-proxy/agl_shell.proto
index 74ea958..c4f3dfe 100644
--- a/grpc-proxy/agl_shell.proto
+++ b/grpc-proxy/agl_shell.proto
@@ -4,16 +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 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 {
@@ -98,3 +99,12 @@ message AppPositionRequest {
message AppPositionResponse {
};
+
+message AppScaleRequest {
+ string app_id = 1;
+ int32 width = 2;
+ int32 height = 3;
+};
+
+message AppScaleResponse {
+};
diff --git a/grpc-proxy/grpc-async-cb.cpp b/grpc-proxy/grpc-async-cb.cpp
index 92aaa3c..9cbbb4d 100644
--- a/grpc-proxy/grpc-async-cb.cpp
+++ b/grpc-proxy/grpc-async-cb.cpp
@@ -171,6 +171,19 @@ GrpcServiceImpl::SetAppPosition(grpc::CallbackServerContext *context,
}
grpc::ServerUnaryReactor *
+GrpcServiceImpl::SetAppScale(grpc::CallbackServerContext *context,
+ const ::agl_shell_ipc::AppScaleRequest* request,
+ ::agl_shell_ipc::AppScaleResponse* /* response */)
+{
+ m_aglShell->SetAppScale(request->app_id(),
+ request->width(), request->height());
+
+ grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
+ reactor->Finish(grpc::Status::OK);
+ return reactor;
+}
+
+grpc::ServerUnaryReactor *
GrpcServiceImpl::SetAppSplit(grpc::CallbackServerContext *context,
const ::agl_shell_ipc::SplitRequest* request,
::agl_shell_ipc::SplitResponse* /*response*/)
diff --git a/grpc-proxy/grpc-async-cb.h b/grpc-proxy/grpc-async-cb.h
index 21a4e4d..cb8adcb 100644
--- a/grpc-proxy/grpc-async-cb.h
+++ b/grpc-proxy/grpc-async-cb.h
@@ -100,6 +100,10 @@ public:
const ::agl_shell_ipc::AppPositionRequest* request,
::agl_shell_ipc::AppPositionResponse* /*response*/) override;
+ grpc::ServerUnaryReactor *SetAppScale(grpc::CallbackServerContext *context,
+ const ::agl_shell_ipc::AppScaleRequest* request,
+ ::agl_shell_ipc::AppScaleResponse* /*response*/) override;
+
grpc::ServerWriteReactor< ::agl_shell_ipc::AppStateResponse>* AppStatusState(
::grpc::CallbackServerContext* /*context*/,
const ::agl_shell_ipc::AppStateRequest* /*request*/) override;
diff --git a/grpc-proxy/main-grpc.cpp b/grpc-proxy/main-grpc.cpp
index 740594f..b2eca84 100644
--- a/grpc-proxy/main-grpc.cpp
+++ b/grpc-proxy/main-grpc.cpp
@@ -275,7 +275,7 @@ global_add(void *data, struct wl_registry *reg, uint32_t id,
sh->shell =
static_cast<struct agl_shell *>(wl_registry_bind(reg, id,
&agl_shell_interface,
- std::min(static_cast<uint32_t>(9), version)));
+ std::min(static_cast<uint32_t>(10), version)));
agl_shell_add_listener(sh->shell, &shell_listener, data);
sh->version = version;
} else if (strcmp(interface, "wl_output") == 0) {
@@ -299,7 +299,7 @@ global_add_init(void *data, struct wl_registry *reg, uint32_t id,
sh->shell =
static_cast<struct agl_shell *>(wl_registry_bind(reg, id,
&agl_shell_interface,
- std::min(static_cast<uint32_t>(9), version)));
+ std::min(static_cast<uint32_t>(10), version)));
agl_shell_add_listener(sh->shell, &shell_listener_init, data);
sh->version = version;
}
diff --git a/grpc-proxy/shell.cpp b/grpc-proxy/shell.cpp
index 44f2117..bc2df23 100644
--- a/grpc-proxy/shell.cpp
+++ b/grpc-proxy/shell.cpp
@@ -130,6 +130,16 @@ Shell::SetAppPosition(const std::string &app_id, const int32_t x, const int32_t
}
void
+Shell::SetAppScale(const std::string &app_id,
+ const int32_t width, const int32_t height)
+{
+ struct agl_shell *shell = this->m_shell.get();
+
+ agl_shell_set_app_scale(shell, app_id.c_str(), width, height);
+ wl_display_flush(m_shell_data->wl_display);
+}
+
+void
Shell::SetAppSplit(const std::string &app_id, uint32_t orientation)
{
(void) app_id;
diff --git a/grpc-proxy/shell.h b/grpc-proxy/shell.h
index b9a818c..95aae79 100644
--- a/grpc-proxy/shell.h
+++ b/grpc-proxy/shell.h
@@ -47,4 +47,5 @@ public:
void SetAppFullscreen(const std::string &app_id);
void SetAppOnOutput(const std::string &app_id, const std::string &output);
void SetAppPosition(const std::string &app_id, int32_t x, int32_t y);
+ void SetAppScale(const std::string &app_id, int32_t width, int32_t height);
};