mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
output/config: Handle id_on_name in apply_output_config_to_outputs
apply_output_config_to_outputs required the output config to be a wildcard, or to math name or identifier, but had no handling for the id_or_name format. This will be required in a latter commit.
This commit is contained in:
parent
23389ebd1f
commit
0e69bec782
1 changed files with 28 additions and 15 deletions
|
|
@ -705,14 +705,7 @@ struct output_config *find_output_config(struct sway_output *output) {
|
||||||
return get_output_config(id, output);
|
return get_output_config(id, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc) {
|
static void apply_output_config_to_output(struct output_config *oc, struct sway_output *sway_output) {
|
||||||
// Try to find the output container and apply configuration now. If
|
|
||||||
// this is during startup then there will be no container and config
|
|
||||||
// will be applied during normal "new output" event from wlroots.
|
|
||||||
bool wildcard = strcmp(oc->name, "*") == 0;
|
|
||||||
struct sway_output *sway_output, *tmp;
|
|
||||||
wl_list_for_each_safe(sway_output, tmp, &root->all_outputs, link) {
|
|
||||||
if (output_match_name_or_id(sway_output, oc->name)) {
|
|
||||||
char id[128];
|
char id[128];
|
||||||
output_get_identifier(id, sizeof(id), sway_output);
|
output_get_identifier(id, sizeof(id), sway_output);
|
||||||
struct output_config *current = get_output_config(id, sway_output);
|
struct output_config *current = get_output_config(id, sway_output);
|
||||||
|
|
@ -724,14 +717,34 @@ void apply_output_config_to_outputs(struct output_config *oc) {
|
||||||
}
|
}
|
||||||
apply_output_config(current, sway_output);
|
apply_output_config(current, sway_output);
|
||||||
free_output_config(current);
|
free_output_config(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apply_output_config_to_outputs(struct output_config *oc) {
|
||||||
|
// Try to find the output container and apply configuration now. If
|
||||||
|
// this is during startup then there will be no container and config
|
||||||
|
// will be applied during normal "new output" event from wlroots.
|
||||||
|
char id[128];
|
||||||
|
bool wildcard = strcmp(oc->name, "*") == 0;
|
||||||
|
struct sway_output *sway_output, *tmp;
|
||||||
|
wl_list_for_each_safe(sway_output, tmp, &root->all_outputs, link) {
|
||||||
|
if (!wildcard && !output_match_name_or_id(sway_output, oc->name)) {
|
||||||
|
const char *name = sway_output->wlr_output->name;
|
||||||
|
output_get_identifier(id, sizeof(id), sway_output);
|
||||||
|
char *id_on_name = format_str("%s on %s", id, name);
|
||||||
|
bool skip = !id_on_name || strcmp(oc->name, id_on_name) != 0;
|
||||||
|
free(id_on_name);
|
||||||
|
if (skip) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_output_config_to_output(oc, sway_output);
|
||||||
if (!wildcard) {
|
if (!wildcard) {
|
||||||
// Stop looking if the output config isn't applicable to all
|
// Stop looking if the output config isn't applicable to all
|
||||||
// outputs
|
// outputs
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
struct sway_seat *seat;
|
struct sway_seat *seat;
|
||||||
wl_list_for_each(seat, &server.input->seats, link) {
|
wl_list_for_each(seat, &server.input->seats, link) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue