aboutsummaryrefslogtreecommitdiffstats
path: root/sway/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c25
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
57swayc_t *new_output(wlc_handle handle) { 57swayc_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) {