{
LOG("activating app %s on output %s\n", request->app_id().c_str(),
request->output_name().c_str());
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->ActivateApp(request->app_id(), request->output_name());
const ::agl_shell_ipc::DeactivateRequest* request,
::agl_shell_ipc::DeactivateResponse* /*response*/)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
+
m_aglShell->DeactivateApp(request->app_id());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
const ::agl_shell_ipc::FloatRequest* request,
::agl_shell_ipc::FloatResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppFloat(request->app_id(),
request->x_pos(), request->y_pos());
const ::agl_shell_ipc::NormalRequest* request,
::agl_shell_ipc::NormalResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppNormal(request->app_id());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
const ::agl_shell_ipc::FullscreenRequest* request,
::agl_shell_ipc::FullscreenResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppFullscreen(request->app_id());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
const ::agl_shell_ipc::AppOnOutputRequest* request,
::agl_shell_ipc::AppOnOutputResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppOnOutput(request->app_id(), request->output());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
const ::agl_shell_ipc::AppPositionRequest* request,
::agl_shell_ipc::AppPositionResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppPosition(request->app_id(), request->x(), request->y());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
const ::agl_shell_ipc::AppScaleRequest* request,
::agl_shell_ipc::AppScaleResponse* /* response */)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppScale(request->app_id(),
request->width(), request->height());
const ::agl_shell_ipc::SplitRequest* request,
::agl_shell_ipc::SplitResponse* /*response*/)
{
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
m_aglShell->SetAppSplit(request->app_id(), request->tile_orientation());
grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
{
struct window_output *output;
+ if (!m_aglShell) {
+ LOG("m_aglShell not set-up\n");
+ return nullptr;
+ }
+
struct wl_list *list = &m_aglShell->m_shell_data->output_list;
wl_list_for_each(output, list, link) {
auto m_output = response->add_outputs();
const ::agl_shell_ipc::AppStateRequest* /*request */)
{
- Lister *n = new Lister(m_aglShell);
+ if (!m_aglShell) {
+ LOG(">> m_aglShell not set-up\n");
+ return nullptr;
+ }
+
+ Lister *n = new Lister(m_aglShell);
m_aglShell->m_shell_data->server_context_list.push_back(std::pair(context, n));
LOG("added lister %p\n", static_cast<void *>(n));
}
static void
-start_grpc_server(Shell *aglShell)
+start_grpc_server(std::shared_ptr<grpc::Server> server)
{
+ LOG("gRPC server listening\n");
+ server->Wait();
+}
+
+int main(int argc, char **argv)
+{
+ (void) argc;
+ (void) argv;
+ Shell *aglShell = nullptr;
+ int ret = 0;
+
// instantiante the grpc server
std::string server_address(kDefaultGrpcServiceAddress);
GrpcServiceImpl service{aglShell};
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
- std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
- LOG("gRPC server listening on %s\n", server_address.c_str());
-
- server->Wait();
-}
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- Shell *aglShell;
- int ret = 0;
+ std::shared_ptr<grpc::Server> server(builder.BuildAndStart());
+ std::thread thread(start_grpc_server, server);
// this blocks until we detect that another shell client started
// running
std::shared_ptr<struct agl_shell> agl_shell{sh->shell, agl_shell_destroy};
aglShell = new Shell(agl_shell, sh);
- std::thread thread(start_grpc_server, aglShell);
+ // now that we have aglShell, set it to the gRPC proxy as well
+ service.setAglShell(aglShell);
// serve wayland requests
while (running && ret != -1) {