diff options
author | 2016-05-31 09:30:34 -0500 | |
---|---|---|
committer | 2016-05-31 09:30:34 -0500 | |
commit | 8a81f524502f1948f8f0ef1e98708f2662c34bc1 (patch) | |
tree | ddc3a22aa83574abaf17f7e63ecde76745dbc458 /sway | |
parent | fix swaybar problem in 08bef67 (diff) | |
parent | Merge pull request #685 from thuck/floating_size (diff) | |
download | sway-8a81f524502f1948f8f0ef1e98708f2662c34bc1.tar.gz sway-8a81f524502f1948f8f0ef1e98708f2662c34bc1.tar.zst sway-8a81f524502f1948f8f0ef1e98708f2662c34bc1.zip |
Merge branch 'master' of github.com:SirCmpwn/sway into fix-swaybar-in-08bef67
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config.c | 6 | ||||
-rw-r--r-- | sway/container.c | 25 | ||||
-rw-r--r-- | sway/handlers.c | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 14b657ef..95285eba 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -172,6 +172,12 @@ static void config_defaults(struct sway_config *config) { | |||
172 | config->font = strdup("monospace 10"); | 172 | config->font = strdup("monospace 10"); |
173 | config->font_height = get_font_text_height(config->font); | 173 | config->font_height = get_font_text_height(config->font); |
174 | 174 | ||
175 | // floating view | ||
176 | config->floating_maximum_width = -1; | ||
177 | config->floating_maximum_height = -1; | ||
178 | config->floating_minimum_width = 75; | ||
179 | config->floating_minimum_height = 50; | ||
180 | |||
175 | // Flags | 181 | // Flags |
176 | config->focus_follows_mouse = true; | 182 | config->focus_follows_mouse = true; |
177 | config->mouse_warping = true; | 183 | config->mouse_warping = true; |
diff --git a/sway/container.c b/sway/container.c index 4883a648..e00d2d7e 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -328,6 +328,31 @@ swayc_t *new_floating_view(wlc_handle handle) { | |||
328 | return view; | 328 | return view; |
329 | } | 329 | } |
330 | 330 | ||
331 | void floating_view_sane_size(swayc_t *view) { | ||
332 | if (config->floating_minimum_height != -1 && | ||
333 | view->desired_height < config->floating_minimum_height) { | ||
334 | view->desired_height = config->floating_minimum_height; | ||
335 | } | ||
336 | if (config->floating_minimum_width != -1 && | ||
337 | view->desired_width < config->floating_minimum_width) { | ||
338 | view->desired_width = config->floating_minimum_width; | ||
339 | } | ||
340 | |||
341 | if (config->floating_maximum_height != -1 && | ||
342 | view->desired_height > config->floating_maximum_height) { | ||
343 | view->desired_height = config->floating_maximum_height; | ||
344 | } | ||
345 | if (config->floating_maximum_width != -1 && | ||
346 | view->desired_width > config->floating_maximum_width) { | ||
347 | view->desired_width = config->floating_maximum_width; | ||
348 | } | ||
349 | 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); | ||
351 | |||
352 | return; | ||
353 | } | ||
354 | |||
355 | |||
331 | // Destroy container | 356 | // Destroy container |
332 | 357 | ||
333 | swayc_t *destroy_output(swayc_t *output) { | 358 | swayc_t *destroy_output(swayc_t *output) { |
diff --git a/sway/handlers.c b/sway/handlers.c index 931e1340..f8dd9f4d 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -350,6 +350,7 @@ static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geo | |||
350 | view->desired_height = geometry->size.h; | 350 | view->desired_height = geometry->size.h; |
351 | 351 | ||
352 | if (view->is_floating) { | 352 | if (view->is_floating) { |
353 | floating_view_sane_size(view); | ||
353 | view->width = view->desired_width; | 354 | view->width = view->desired_width; |
354 | view->height = view->desired_height; | 355 | view->height = view->desired_height; |
355 | view->x = geometry->origin.x; | 356 | view->x = geometry->origin.x; |