From 2edba91d3eab0d7b3c490c12be1f9bc3b5255aa8 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 27 Jul 2023 16:37:15 +0300 Subject: grpc-proxy: Add dynamic floating window movement This adds basic movement for floating type of windows. The window needs to be a floating type for this request to work out. For the agl-shell protocol, this adds a set_app_float() request while for gRPC it adds a SetAppPosition() request. Bug-AGL: SPEC-4863 Signed-off-by: Marius Vlad Change-Id: I5ecc4257c3e84d15a8cabb183757753be37867f5 --- grpc-proxy/agl_shell.proto | 11 +++++++++++ grpc-proxy/grpc-async-cb.cpp | 14 +++++++++++++- grpc-proxy/grpc-async-cb.h | 4 ++++ grpc-proxy/main-grpc.cpp | 4 ++-- grpc-proxy/shell.cpp | 9 +++++++++ grpc-proxy/shell.h | 1 + 6 files changed, 40 insertions(+), 3 deletions(-) (limited to 'grpc-proxy') diff --git a/grpc-proxy/agl_shell.proto b/grpc-proxy/agl_shell.proto index aac35f4..74ea958 100644 --- a/grpc-proxy/agl_shell.proto +++ b/grpc-proxy/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/grpc-proxy/grpc-async-cb.cpp b/grpc-proxy/grpc-async-cb.cpp index 1bb367a..92aaa3c 100644 --- a/grpc-proxy/grpc-async-cb.cpp +++ b/grpc-proxy/grpc-async-cb.cpp @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Collabora, Ltd. + * Copyright © 2022, 2023 Collabora, Ltd. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -158,6 +158,18 @@ GrpcServiceImpl::SetAppOnOutput(grpc::CallbackServerContext *context, return reactor; } +grpc::ServerUnaryReactor * +GrpcServiceImpl::SetAppPosition(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::AppPositionRequest* request, + ::agl_shell_ipc::AppPositionResponse* /* response */) +{ + m_aglShell->SetAppPosition(request->app_id(), request->x(), request->y()); + + 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, diff --git a/grpc-proxy/grpc-async-cb.h b/grpc-proxy/grpc-async-cb.h index 4987cf7..21a4e4d 100644 --- a/grpc-proxy/grpc-async-cb.h +++ b/grpc-proxy/grpc-async-cb.h @@ -96,6 +96,10 @@ public: const ::agl_shell_ipc::AppOnOutputRequest* request, ::agl_shell_ipc::AppOnOutputResponse* /*response*/) override; + grpc::ServerUnaryReactor *SetAppPosition(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::AppPositionRequest* request, + ::agl_shell_ipc::AppPositionResponse* /*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 1e297c5..740594f 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(wl_registry_bind(reg, id, &agl_shell_interface, - std::min(static_cast(8), version))); + std::min(static_cast(9), 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(wl_registry_bind(reg, id, &agl_shell_interface, - std::min(static_cast(8), version))); + std::min(static_cast(9), 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 34f6d37..44f2117 100644 --- a/grpc-proxy/shell.cpp +++ b/grpc-proxy/shell.cpp @@ -120,6 +120,15 @@ Shell::SetAppOnOutput(const std::string &app_id, const std::string &output) wl_display_flush(m_shell_data->wl_display); } +void +Shell::SetAppPosition(const std::string &app_id, const int32_t x, const int32_t y) +{ + struct agl_shell *shell = this->m_shell.get(); + + agl_shell_set_app_position(shell, app_id.c_str(), x, y); + wl_display_flush(m_shell_data->wl_display); +} + void Shell::SetAppSplit(const std::string &app_id, uint32_t orientation) { diff --git a/grpc-proxy/shell.h b/grpc-proxy/shell.h index b047eef..b9a818c 100644 --- a/grpc-proxy/shell.h +++ b/grpc-proxy/shell.h @@ -46,4 +46,5 @@ public: void SetAppNormal(const std::string &app_id); 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); }; -- cgit 1.2.3-korg