mirror of
https://github.com/swaywm/sway.git
synced 2024-11-21 23:41:27 +00:00
config: Force modeset before running deferred configs
Some commands require outputs to be enabled. These commands are deferred to allow outputs to be discovered, but the delayed modeset might only run some time later. Force a modeset to occur before running deferred commands. Fixes: https://github.com/swaywm/sway/issues/8433
This commit is contained in:
parent
96db66abf0
commit
6111297d91
|
@ -705,6 +705,7 @@ struct output_config *find_output_config(struct sway_output *output);
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
||||||
void request_modeset(void);
|
void request_modeset(void);
|
||||||
|
void force_modeset(void);
|
||||||
|
|
||||||
bool spawn_swaybg(void);
|
bool spawn_swaybg(void);
|
||||||
|
|
||||||
|
|
|
@ -408,6 +408,14 @@ void request_modeset(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void force_modeset(void) {
|
||||||
|
if (server.delayed_modeset != NULL) {
|
||||||
|
wl_event_source_remove(server.delayed_modeset);
|
||||||
|
server.delayed_modeset = NULL;
|
||||||
|
}
|
||||||
|
apply_stored_output_configs();
|
||||||
|
}
|
||||||
|
|
||||||
static void begin_destroy(struct sway_output *output) {
|
static void begin_destroy(struct sway_output *output) {
|
||||||
if (output->enabled) {
|
if (output->enabled) {
|
||||||
output_disable(output);
|
output_disable(output);
|
||||||
|
@ -493,12 +501,8 @@ static void handle_request_state(struct wl_listener *listener, void *data) {
|
||||||
// We do not expect or support any other changes here
|
// We do not expect or support any other changes here
|
||||||
assert(committed == 0);
|
assert(committed == 0);
|
||||||
store_output_config(oc);
|
store_output_config(oc);
|
||||||
apply_stored_output_configs();
|
|
||||||
|
|
||||||
if (server.delayed_modeset != NULL) {
|
force_modeset();
|
||||||
wl_event_source_remove(server.delayed_modeset);
|
|
||||||
server.delayed_modeset = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int last_headless_num = 0;
|
static unsigned int last_headless_num = 0;
|
||||||
|
|
|
@ -361,6 +361,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
config->active = true;
|
config->active = true;
|
||||||
|
force_modeset();
|
||||||
load_swaybars();
|
load_swaybars();
|
||||||
run_deferred_commands();
|
run_deferred_commands();
|
||||||
run_deferred_bindings();
|
run_deferred_bindings();
|
||||||
|
|
Loading…
Reference in a new issue