X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain.cpp;h=3db6372f67f5202589de44fc47d435eeeccad5b0;hb=cb7aa009ef9873967152e716fb01fecc30d401f7;hp=b2a5b4d328d889ba9c16b514035d54382f3a8dd0;hpb=8b057267c4180e5648b6636f4b5b1de07f627977;p=src%2Fwindow-management-client-grpc.git diff --git a/src/main.cpp b/src/main.cpp index b2a5b4d..3db6372 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,7 +45,10 @@ enum mode { FLOAT = 1, FULLSCREEN = 2, FULLSCREEN_QT = 3, // rather than use rpc, use Qt API - REMOTE = 4, + ON_OTHER_OUTPUTS = 4, + SET_FLOAT_POS = 5, + SCALE = 6, + SPLIT = 7, }; static QWindow * @@ -72,22 +75,37 @@ 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 if (strcmp(argv[1], "position") == 0) + mmode = SET_FLOAT_POS; + else if (strcmp(argv[1], "scale") == 0) + mmode = SCALE; + else if (strcmp(argv[1], "split") == 0) + mmode = SPLIT; else assert(!"Invalid mode"); - if (mmode != FLOAT && mmode != FULLSCREEN && mmode != REMOTE) { + if (mmode != FLOAT && mmode != FULLSCREEN && + mmode != ON_OTHER_OUTPUTS && mmode != SET_FLOAT_POS && + mmode != SCALE && mmode != SPLIT) { fprintf(stderr, "Will not use rpc\n"); goto skip; } + if (mmode == ON_OTHER_OUTPUTS) + output_name = argv[2]; + + if (mmode == SPLIT) + output_name = argv[2]; + // start grpc connection GrpcClient *client = new GrpcClient(); @@ -104,8 +122,34 @@ 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; + case SET_FLOAT_POS: + // this assumes the window is already running and + // floating; uses the same application so this needs + // to be first started as float. + client->SetAppPosition(myname.toStdString(), 550, 550); + exit(EXIT_SUCCESS); + break; + case SCALE: + // this assumes the window is already running and + // floating; uses the same application so this needs + // to be first started as float. + client->SetAppScale(myname.toStdString(), 200, 200); + exit(EXIT_SUCCESS); + break; + case SPLIT: + // put it on the bottom + client->SetAppSplit(myname.toStdString(), 4, 0, 0, + std::string(output_name)); break; default: break;