diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sway/container.c b/sway/container.c index e00d2d7e..15975064 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -329,6 +329,9 @@ swayc_t *new_floating_view(wlc_handle handle) { | |||
329 | } | 329 | } |
330 | 330 | ||
331 | void floating_view_sane_size(swayc_t *view) { | 331 | void floating_view_sane_size(swayc_t *view) { |
332 | // floating_minimum is used as sane value. | ||
333 | // floating_maximum has priority in case of conflict | ||
334 | // TODO: implement total_outputs_dimensions() | ||
332 | if (config->floating_minimum_height != -1 && | 335 | if (config->floating_minimum_height != -1 && |
333 | view->desired_height < config->floating_minimum_height) { | 336 | view->desired_height < config->floating_minimum_height) { |
334 | view->desired_height = config->floating_minimum_height; | 337 | view->desired_height = config->floating_minimum_height; |
@@ -338,14 +341,26 @@ void floating_view_sane_size(swayc_t *view) { | |||
338 | view->desired_width = config->floating_minimum_width; | 341 | view->desired_width = config->floating_minimum_width; |
339 | } | 342 | } |
340 | 343 | ||
341 | if (config->floating_maximum_height != -1 && | 344 | // if 0 do not resize, only enforce max value |
342 | view->desired_height > config->floating_maximum_height) { | 345 | if (config->floating_maximum_height == 0) { |
343 | view->desired_height = config->floating_maximum_height; | 346 | // Missing total_outputs_dimensions() using swayc_active_workspace() |
344 | } | 347 | config->floating_maximum_height = swayc_active_workspace()->height; |
345 | if (config->floating_maximum_width != -1 && | 348 | |
349 | } else if (config->floating_maximum_height != -1 && | ||
350 | view->desired_height > config->floating_maximum_height) { | ||
351 | view->desired_height = config->floating_maximum_height; | ||
352 | } | ||
353 | |||
354 | // if 0 do not resize, only enforce max value | ||
355 | if (config->floating_maximum_width == 0) { | ||
356 | // Missing total_outputs_dimensions() using swayc_active_workspace() | ||
357 | config->floating_maximum_width = swayc_active_workspace()->width; | ||
358 | |||
359 | } else if (config->floating_maximum_width != -1 && | ||
346 | view->desired_width > config->floating_maximum_width) { | 360 | view->desired_width > config->floating_maximum_width) { |
347 | view->desired_width = config->floating_maximum_width; | 361 | view->desired_width = config->floating_maximum_width; |
348 | } | 362 | } |
363 | |||
349 | sway_log(L_DEBUG, "Sane values for view to %d x %d @ %.f, %.f", | 364 | sway_log(L_DEBUG, "Sane values for view to %d x %d @ %.f, %.f", |
350 | view->desired_width, view->desired_height, view->x, view->y); | 365 | view->desired_width, view->desired_height, view->x, view->y); |
351 | 366 | ||