aboutsummaryrefslogtreecommitdiff
path: root/examples/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/config.c')
-rw-r--r--examples/config.c49
1 files changed, 7 insertions, 42 deletions
diff --git a/examples/config.c b/examples/config.c
index 954edb06..6796ea66 100644
--- a/examples/config.c
+++ b/examples/config.c
@@ -255,49 +255,14 @@ void example_config_destroy(struct example_config *config) {
free(config);
}
-struct wlr_output_layout *configure_layout(struct example_config *config,
- struct wl_list *outputs) {
- struct wlr_output_layout *layout = wlr_output_layout_init();
- int max_x = INT_MIN;
- int max_x_y = INT_MIN; // y value for the max_x output
-
- // first add all the configured outputs
- struct output_state *output;
- wl_list_for_each(output, outputs, link) {
- struct output_config *conf;
- wl_list_for_each(conf, &config->outputs, link) {
- if (strcmp(conf->name, output->output->name) == 0) {
- wlr_output_layout_add(layout, output->output,
- conf->x, conf->y);
- wlr_output_transform(output->output, conf->transform);
- int width, height;
- wlr_output_effective_resolution(output->output, &width,
- &height);
- if (conf->x + width > max_x) {
- max_x = conf->x + width;
- max_x_y = conf->y;
- }
- break;
- }
- }
- }
-
- if (max_x == INT_MIN) {
- // couldn't find a configured output
- max_x = 0;
- max_x_y = 0;
- }
-
- // now add all the other configured outputs in a sensible position
- wl_list_for_each(output, outputs, link) {
- if (wlr_output_layout_get(layout, output->output)) {
- continue;
+struct output_config *example_config_get_output(struct example_config *config,
+ struct wlr_output *output) {
+ struct output_config *o_config;
+ wl_list_for_each(o_config, &config->outputs, link) {
+ if (strcmp(o_config->name, output->name) == 0) {
+ return o_config;
}
- wlr_output_layout_add(layout, output->output, max_x, max_x_y);
- int width, height;
- wlr_output_effective_resolution(output->output, &width, &height);
- max_x += width;
}
- return layout;
+ return NULL;
}