aboutsummaryrefslogtreecommitdiff
path: root/sway/container.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-06-02 11:46:25 -0400
committerDrew DeVault <sir@cmpwn.com>2016-06-02 11:46:25 -0400
commit09670fc1a7485d75774c184fcbf8e907b9481aaa (patch)
treefad070df6be2bef62346c4a8232d869e3cf41fdc /sway/container.c
parent5e395d696259283953e5b3944cfe5ab92963c189 (diff)
parent2256a9b784d6885822a428a2760838693bd75d94 (diff)
Merge pull request #691 from thuck/floating_size_conf
floating_maximum_size initial implementation
Diffstat (limited to 'sway/container.c')
-rw-r--r--sway/container.c25
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) {
}
void floating_view_sane_size(swayc_t *view) {
+ // floating_minimum is used as sane value.
+ // floating_maximum has priority in case of conflict
+ // TODO: implement total_outputs_dimensions()
if (config->floating_minimum_height != -1 &&
view->desired_height < config->floating_minimum_height) {
view->desired_height = config->floating_minimum_height;
@@ -338,14 +341,26 @@ void floating_view_sane_size(swayc_t *view) {
view->desired_width = config->floating_minimum_width;
}
- if (config->floating_maximum_height != -1 &&
- view->desired_height > config->floating_maximum_height) {
- view->desired_height = config->floating_maximum_height;
- }
- if (config->floating_maximum_width != -1 &&
+ // if 0 do not resize, only enforce max value
+ if (config->floating_maximum_height == 0) {
+ // Missing total_outputs_dimensions() using swayc_active_workspace()
+ config->floating_maximum_height = swayc_active_workspace()->height;
+
+ } else if (config->floating_maximum_height != -1 &&
+ view->desired_height > config->floating_maximum_height) {
+ view->desired_height = config->floating_maximum_height;
+ }
+
+ // if 0 do not resize, only enforce max value
+ if (config->floating_maximum_width == 0) {
+ // Missing total_outputs_dimensions() using swayc_active_workspace()
+ config->floating_maximum_width = swayc_active_workspace()->width;
+
+ } else if (config->floating_maximum_width != -1 &&
view->desired_width > config->floating_maximum_width) {
view->desired_width = config->floating_maximum_width;
}
+
sway_log(L_DEBUG, "Sane values for view to %d x %d @ %.f, %.f",
view->desired_width, view->desired_height, view->x, view->y);