diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-03-27 20:14:49 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-03-27 20:14:49 +0000 |
| commit | 758fd9fd58b25ab285868db7f36afdf9378df733 (patch) | |
| tree | 6cf37e07209b972f42485a99d968f31721282d79 /server.c | |
| parent | foot: add --maximized and --fullscreen command line options (diff) | |
client: add --maximized and --fullscreen
We now create a copy of the config for each client, and updates it
with the values passed from the client.
Since we're not actually cloning it (and e.g. strdup() all strings
etc) we can't call conf_destroy() to free it, but need to free just
the strings we've replaced.
Diffstat (limited to 'server.c')
| -rw-r--r-- | server.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -42,6 +42,7 @@ struct client { size_t idx; } buffer; + struct config conf; struct terminal *term; }; @@ -69,6 +70,11 @@ client_destroy(struct client *client) } free(client->buffer.data); + + /* TODO: clone server conf completely, so that we can just call + * conf_destroy() here */ + free(client->conf.term); + free(client); } @@ -219,6 +225,12 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data) } CHECK_BUF(sizeof(uint8_t)); + const uint8_t maximized = *(const uint8_t *)p; p += sizeof(maximized); + + CHECK_BUF(sizeof(uint8_t)); + const uint8_t fullscreen = *(const uint8_t *)p; p += sizeof(fullscreen); + + CHECK_BUF(sizeof(uint8_t)); const uint8_t login_shell = *(const uint8_t *)p; p += sizeof(login_shell); CHECK_BUF(sizeof(argc)); @@ -244,9 +256,18 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data) #undef CHECK_BUF + client->conf = *server->conf; + client->conf.term = strlen(term_env) > 0 + ? strdup(term_env) : strdup(server->conf->term); + client->conf.login_shell = login_shell; + + if (maximized) + client->conf.startup_mode = STARTUP_MAXIMIZED; + else if (fullscreen) + client->conf.startup_mode = STARTUP_FULLSCREEN; + client->term = term_init( - server->conf, server->fdm, server->wayl, - strlen(term_env) > 0 ? term_env : server->conf->term, login_shell, + &client->conf, server->fdm, server->wayl, "footclient", cwd, argc, argv, &term_shutdown_handler, client); if (client->term == NULL) { |
