mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 14:04:11 +01:00
Merge pull request #2304 from RedSoxFan/fix-2298
Fix deferred command handling
This commit is contained in:
commit
d8badceb54
@ -56,6 +56,7 @@ struct sway_server server;
|
|||||||
bool server_privileged_prepare(struct sway_server *server);
|
bool server_privileged_prepare(struct sway_server *server);
|
||||||
bool server_init(struct sway_server *server);
|
bool server_init(struct sway_server *server);
|
||||||
void server_fini(struct sway_server *server);
|
void server_fini(struct sway_server *server);
|
||||||
|
bool server_start_backend(struct sway_server *server);
|
||||||
void server_run(struct sway_server *server);
|
void server_run(struct sway_server *server);
|
||||||
|
|
||||||
void handle_new_output(struct wl_listener *listener, void *data);
|
void handle_new_output(struct wl_listener *listener, void *data);
|
||||||
|
@ -649,7 +649,6 @@ bool read_config(FILE *file, struct sway_config *config) {
|
|||||||
} else {
|
} else {
|
||||||
res = config_command(expanded);
|
res = config_command(expanded);
|
||||||
}
|
}
|
||||||
free(expanded);
|
|
||||||
switch(res->status) {
|
switch(res->status) {
|
||||||
case CMD_FAILURE:
|
case CMD_FAILURE:
|
||||||
case CMD_INVALID:
|
case CMD_INVALID:
|
||||||
@ -660,7 +659,7 @@ bool read_config(FILE *file, struct sway_config *config) {
|
|||||||
|
|
||||||
case CMD_DEFER:
|
case CMD_DEFER:
|
||||||
wlr_log(WLR_DEBUG, "Deferring command `%s'", line);
|
wlr_log(WLR_DEBUG, "Deferring command `%s'", line);
|
||||||
list_add(config->cmd_queue, strdup(line));
|
list_add(config->cmd_queue, strdup(expanded));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_BLOCK_COMMANDS:
|
case CMD_BLOCK_COMMANDS:
|
||||||
@ -693,6 +692,7 @@ bool read_config(FILE *file, struct sway_config *config) {
|
|||||||
sizeof(config->handler_context));
|
sizeof(config->handler_context));
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
free(expanded);
|
||||||
free(line);
|
free(line);
|
||||||
free_cmd_results(res);
|
free_cmd_results(res);
|
||||||
}
|
}
|
||||||
|
@ -429,9 +429,16 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
security_sanity_check();
|
security_sanity_check();
|
||||||
|
|
||||||
config->active = true;
|
|
||||||
setenv("WAYLAND_DISPLAY", server.socket, true);
|
setenv("WAYLAND_DISPLAY", server.socket, true);
|
||||||
|
if (!terminate_request) {
|
||||||
|
if (!server_start_backend(&server)) {
|
||||||
|
sway_terminate(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config->active = true;
|
||||||
// Execute commands until there are none left
|
// Execute commands until there are none left
|
||||||
|
wlr_log(WLR_DEBUG, "Running deferred commands");
|
||||||
while (config->cmd_queue->length) {
|
while (config->cmd_queue->length) {
|
||||||
char *line = config->cmd_queue->items[0];
|
char *line = config->cmd_queue->items[0];
|
||||||
struct cmd_results *res = execute_command(line, NULL);
|
struct cmd_results *res = execute_command(line, NULL);
|
||||||
|
@ -137,13 +137,19 @@ void server_fini(struct sway_server *server) {
|
|||||||
list_free(server->transactions);
|
list_free(server->transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void server_run(struct sway_server *server) {
|
bool server_start_backend(struct sway_server *server) {
|
||||||
wlr_log(WLR_INFO, "Running compositor on wayland display '%s'",
|
wlr_log(WLR_INFO, "Starting backend on wayland display '%s'",
|
||||||
server->socket);
|
server->socket);
|
||||||
if (!wlr_backend_start(server->backend)) {
|
if (!wlr_backend_start(server->backend)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to start backend");
|
wlr_log(WLR_ERROR, "Failed to start backend");
|
||||||
wlr_backend_destroy(server->backend);
|
wlr_backend_destroy(server->backend);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void server_run(struct sway_server *server) {
|
||||||
|
wlr_log(WLR_INFO, "Running compositor on wayland display '%s'",
|
||||||
|
server->socket);
|
||||||
wl_display_run(server->wl_display);
|
wl_display_run(server->wl_display);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user