diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-22 11:18:55 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-22 11:18:55 -0400 |
commit | b7f4607544d51811e986b98c8c3eda7ed7c68b1a (patch) | |
tree | 0e2cf9f02e1d2cde3bf7d0b7424ff5ac3ee6c1e3 /sway/container.c | |
parent | Merge pull request #118 from Luminarys/master (diff) | |
download | sway-b7f4607544d51811e986b98c8c3eda7ed7c68b1a.tar.gz sway-b7f4607544d51811e986b98c8c3eda7ed7c68b1a.tar.zst sway-b7f4607544d51811e986b98c8c3eda7ed7c68b1a.zip |
Implement output configuration through config
Do not use `output res WIDTHxHEIGHT` yet, wlc has issues with it (cc
@Cloudef)
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sway/container.c b/sway/container.c index 62ff1c4a..7f6fcbc6 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -55,13 +55,31 @@ static void free_swayc(swayc_t *cont) { | |||
55 | // New containers | 55 | // New containers |
56 | 56 | ||
57 | swayc_t *new_output(wlc_handle handle) { | 57 | swayc_t *new_output(wlc_handle handle) { |
58 | const struct wlc_size* size = wlc_output_get_resolution(handle); | 58 | const struct wlc_size *size = wlc_output_get_resolution(handle); |
59 | const char *name = wlc_output_get_name(handle); | 59 | const char *name = wlc_output_get_name(handle); |
60 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); | 60 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); |
61 | 61 | ||
62 | struct output_config *oc ; | ||
63 | int i; | ||
64 | for (i = 0; i < config->output_configs->length; ++i) { | ||
65 | oc = config->output_configs->items[i]; | ||
66 | if (strcasecmp(name, oc->name) == 0) { | ||
67 | sway_log(L_DEBUG, "Matched output config for %s", name); | ||
68 | break; | ||
69 | } | ||
70 | oc = NULL; | ||
71 | } | ||
72 | |||
62 | swayc_t *output = new_swayc(C_OUTPUT); | 73 | swayc_t *output = new_swayc(C_OUTPUT); |
63 | output->width = size->w; | 74 | if (oc && oc->width != -1 && oc->height != -1) { |
64 | output->height = size->h; | 75 | output->width = oc->width; |
76 | output->height = oc->height; | ||
77 | struct wlc_size new_size = { .w = oc->width, .h = oc->width }; | ||
78 | wlc_output_set_resolution(handle, &new_size); | ||
79 | } else { | ||
80 | output->width = size->w; | ||
81 | output->height = size->h; | ||
82 | } | ||
65 | output->handle = handle; | 83 | output->handle = handle; |
66 | output->name = name ? strdup(name) : NULL; | 84 | output->name = name ? strdup(name) : NULL; |
67 | output->gaps = config->gaps_outer + config->gaps_inner / 2; | 85 | output->gaps = config->gaps_outer + config->gaps_inner / 2; |
@@ -71,7 +89,6 @@ swayc_t *new_output(wlc_handle handle) { | |||
71 | // Create workspace | 89 | // Create workspace |
72 | char *ws_name = NULL; | 90 | char *ws_name = NULL; |
73 | if (name) { | 91 | if (name) { |
74 | int i; | ||
75 | for (i = 0; i < config->workspace_outputs->length; ++i) { | 92 | for (i = 0; i < config->workspace_outputs->length; ++i) { |
76 | struct workspace_output *wso = config->workspace_outputs->items[i]; | 93 | struct workspace_output *wso = config->workspace_outputs->items[i]; |
77 | if (strcasecmp(wso->output, name) == 0) { | 94 | if (strcasecmp(wso->output, name) == 0) { |