aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-02-28 12:51:59 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2023-04-14 18:34:54 +0200
commitfcec5817483ba279b714acf6d81f5d7a3688b092 (patch)
treec0ebb0ab0b6c2f3797fa1e34dcb344fe12028dc1
parentUse all_output_by_name_or_id() in merge_id_on_name() (diff)
downloadsway-fcec5817483ba279b714acf6d81f5d7a3688b092.tar.gz
sway-fcec5817483ba279b714acf6d81f5d7a3688b092.tar.zst
sway-fcec5817483ba279b714acf6d81f5d7a3688b092.zip
Use output_match_name_or_id() in apply_output_config_to_outputs()
-rw-r--r--include/sway/output.h3
-rw-r--r--sway/config/output.c7
-rw-r--r--sway/desktop/output.c6
3 files changed, 11 insertions, 5 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index 2aa1b278..04202976 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -96,6 +96,9 @@ void output_damage_box(struct sway_output *output, struct wlr_box *box);
96void output_damage_whole_container(struct sway_output *output, 96void output_damage_whole_container(struct sway_output *output,
97 struct sway_container *con); 97 struct sway_container *con);
98 98
99bool output_match_name_or_id(struct sway_output *output,
100 const char *name_or_id);
101
99// this ONLY includes the enabled outputs 102// this ONLY includes the enabled outputs
100struct sway_output *output_by_name_or_id(const char *name_or_id); 103struct sway_output *output_by_name_or_id(const char *name_or_id);
101 104
diff --git a/sway/config/output.c b/sway/config/output.c
index 352d7f7c..45d2441b 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -722,12 +722,11 @@ void apply_output_config_to_outputs(struct output_config *oc) {
722 // this is during startup then there will be no container and config 722 // this is during startup then there will be no container and config
723 // will be applied during normal "new output" event from wlroots. 723 // will be applied during normal "new output" event from wlroots.
724 bool wildcard = strcmp(oc->name, "*") == 0; 724 bool wildcard = strcmp(oc->name, "*") == 0;
725 char id[128];
726 struct sway_output *sway_output, *tmp; 725 struct sway_output *sway_output, *tmp;
727 wl_list_for_each_safe(sway_output, tmp, &root->all_outputs, link) { 726 wl_list_for_each_safe(sway_output, tmp, &root->all_outputs, link) {
728 char *name = sway_output->wlr_output->name; 727 if (output_match_name_or_id(sway_output, oc->name)) {
729 output_get_identifier(id, sizeof(id), sway_output); 728 char id[128];
730 if (wildcard || !strcmp(name, oc->name) || !strcmp(id, oc->name)) { 729 output_get_identifier(id, sizeof(id), sway_output);
731 struct output_config *current = get_output_config(id, sway_output); 730 struct output_config *current = get_output_config(id, sway_output);
732 if (!current) { 731 if (!current) {
733 // No stored output config matched, apply oc directly 732 // No stored output config matched, apply oc directly
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index fe3cdaf1..2255b551 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -36,8 +36,12 @@
36#include <wlr/types/wlr_drm_lease_v1.h> 36#include <wlr/types/wlr_drm_lease_v1.h>
37#endif 37#endif
38 38
39static bool output_match_name_or_id(struct sway_output *output, 39bool output_match_name_or_id(struct sway_output *output,
40 const char *name_or_id) { 40 const char *name_or_id) {
41 if (strcmp(name_or_id, "*") == 0) {
42 return true;
43 }
44
41 char identifier[128]; 45 char identifier[128];
42 output_get_identifier(identifier, sizeof(identifier), output); 46 output_get_identifier(identifier, sizeof(identifier), output);
43 return strcasecmp(identifier, name_or_id) == 0 47 return strcasecmp(identifier, name_or_id) == 0