mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
Fix reload freeze when not modsetting current mode
This fixes the issue of the display freezing on reload with wlroots#1545. On master, all output configs are applied on reload. This may cause an output to have its config applied up to three times, instead of just once. The three cases are: output name, output identifier, and wildcard. Not only is this inefficient, but it can cause swaybg to be spawned and immediately killed. However, swaybg requires two roundtrips of wl_display (to obtain needed globals) before it enters its normal event loop. Modesetting will roundtrip the wl_display. Without modesetting, waitpid for killing swaybg could block infinitely due to swaybg being blocked by wl_display_roundtrip. This only configured an output once. It either uses the wildcard config or creates an empty wildcard config and applies that. This also fixes a bug where an output would not be reset when there is no output config to apply to it.
This commit is contained in:
parent
9ff59b7c6b
commit
19586ab768
|
@ -586,6 +586,8 @@ struct output_config *store_output_config(struct output_config *oc);
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc);
|
void apply_output_config_to_outputs(struct output_config *oc);
|
||||||
|
|
||||||
|
void reset_outputs(void);
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
||||||
int workspace_output_cmp_workspace(const void *a, const void *b);
|
int workspace_output_cmp_workspace(const void *a, const void *b);
|
||||||
|
|
|
@ -471,9 +471,8 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_active) {
|
if (is_active) {
|
||||||
for (int i = 0; i < config->output_configs->length; i++) {
|
reset_outputs();
|
||||||
apply_output_config_to_outputs(config->output_configs->items[i]);
|
|
||||||
}
|
|
||||||
config->reloading = false;
|
config->reloading = false;
|
||||||
if (config->swaynag_config_errors.pid > 0) {
|
if (config->swaynag_config_errors.pid > 0) {
|
||||||
swaynag_show(&config->swaynag_config_errors);
|
swaynag_show(&config->swaynag_config_errors);
|
||||||
|
|
|
@ -391,6 +391,17 @@ void apply_output_config_to_outputs(struct output_config *oc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_outputs(void) {
|
||||||
|
struct output_config *oc = NULL;
|
||||||
|
int i = list_seq_find(config->output_configs, output_name_cmp, "*");
|
||||||
|
if (i >= 0) {
|
||||||
|
oc = config->output_configs->items[i];
|
||||||
|
} else {
|
||||||
|
oc = store_output_config(new_output_config("*"));
|
||||||
|
}
|
||||||
|
apply_output_config_to_outputs(oc);
|
||||||
|
}
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc) {
|
void free_output_config(struct output_config *oc) {
|
||||||
if (!oc) {
|
if (!oc) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue