diff options
Diffstat (limited to 'grpc-proxy')
-rw-r--r-- | grpc-proxy/agl_shell.proto | 9 | ||||
-rw-r--r-- | grpc-proxy/grpc-async-cb.cpp | 12 | ||||
-rw-r--r-- | grpc-proxy/grpc-async-cb.h | 4 | ||||
-rw-r--r-- | grpc-proxy/main-grpc.cpp | 31 | ||||
-rw-r--r-- | grpc-proxy/shell.cpp | 26 | ||||
-rw-r--r-- | grpc-proxy/shell.h | 1 |
6 files changed, 75 insertions, 8 deletions
diff --git a/grpc-proxy/agl_shell.proto b/grpc-proxy/agl_shell.proto index 200d43e..aac35f4 100644 --- a/grpc-proxy/agl_shell.proto +++ b/grpc-proxy/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/grpc-proxy/grpc-async-cb.cpp b/grpc-proxy/grpc-async-cb.cpp index 08bd1f6..1bb367a 100644 --- a/grpc-proxy/grpc-async-cb.cpp +++ b/grpc-proxy/grpc-async-cb.cpp @@ -147,6 +147,18 @@ GrpcServiceImpl::SetAppFullscreen(grpc::CallbackServerContext *context, } grpc::ServerUnaryReactor * +GrpcServiceImpl::SetAppOnOutput(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::AppOnOutputRequest* request, + ::agl_shell_ipc::AppOnOutputResponse* /* response */) +{ + m_aglShell->SetAppOnOutput(request->app_id(), request->output()); + + 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 5542d80..4987cf7 100644 --- a/grpc-proxy/grpc-async-cb.h +++ b/grpc-proxy/grpc-async-cb.h @@ -92,6 +92,10 @@ public: const ::agl_shell_ipc::FullscreenRequest* request, ::agl_shell_ipc::FullscreenResponse* /*response*/) override; + grpc::ServerUnaryReactor *SetAppOnOutput(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::AppOnOutputRequest* request, + ::agl_shell_ipc::AppOnOutputResponse* /*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 dfe899a..1e297c5 100644 --- a/grpc-proxy/main-grpc.cpp +++ b/grpc-proxy/main-grpc.cpp @@ -120,16 +120,31 @@ agl_shell_app_state(void *data, struct agl_shell *agl_shell, } } +static void +agl_shell_app_on_output(void *data, struct agl_shell *agl_shell, + const char *app_id, const char *output_name) +{ + (void) agl_shell; + (void) output_name; + (void) data; + (void) app_id; + + LOG("got app_on_output event app_id %s on output\n", app_id, output_name); +} + + static const struct agl_shell_listener shell_listener = { - agl_shell_bound_ok, - agl_shell_bound_fail, - agl_shell_app_state, + agl_shell_bound_ok, + agl_shell_bound_fail, + agl_shell_app_state, + agl_shell_app_on_output, }; static const struct agl_shell_listener shell_listener_init = { - agl_shell_bound_ok_init, - agl_shell_bound_fail_init, - nullptr, + agl_shell_bound_ok_init, + agl_shell_bound_fail_init, + nullptr, + nullptr, }; static void @@ -260,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>(7), version))); + std::min(static_cast<uint32_t>(8), version))); agl_shell_add_listener(sh->shell, &shell_listener, data); sh->version = version; } else if (strcmp(interface, "wl_output") == 0) { @@ -284,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>(7), version))); + std::min(static_cast<uint32_t>(8), 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 ef5c22f..34f6d37 100644 --- a/grpc-proxy/shell.cpp +++ b/grpc-proxy/shell.cpp @@ -31,6 +31,7 @@ #include <queue> #include "main-grpc.h" +#include "log.h" #include "shell.h" void @@ -95,6 +96,31 @@ Shell::SetAppFullscreen(const std::string &app_id) } void +Shell::SetAppOnOutput(const std::string &app_id, const std::string &output) +{ + struct window_output *woutput, *w_output; + struct agl_shell *shell = this->m_shell.get(); + + woutput = nullptr; + w_output = nullptr; + + wl_list_for_each(woutput, &m_shell_data->output_list, link) { + if (woutput->name && !strcmp(woutput->name, output.c_str())) { + w_output = woutput; + break; + } + } + + if (!w_output) { + LOG("Could not found output '%s' to set the application\n"); + return; + } + + agl_shell_set_app_output(shell, app_id.c_str(), w_output->output); + 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 a99111a..b047eef 100644 --- a/grpc-proxy/shell.h +++ b/grpc-proxy/shell.h @@ -45,4 +45,5 @@ public: int32_t x_pos, int32_t y_pos); 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); }; |