summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--sway/handlers.c4
-rw-r--r--sway/layout.c39
3 files changed, 26 insertions, 18 deletions
diff --git a/.travis.yml b/.travis.yml
index 5d1f8faa..26e236d4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,7 @@ arch:
13 - libinput 13 - libinput
14 - libx11 14 - libx11
15 - libxcb 15 - libxcb
16 - xcb-util-image
16 - libgl 17 - libgl
17 - mesa 18 - mesa
18 script: 19 script:
diff --git a/sway/handlers.c b/sway/handlers.c
index 15fa6521..cf07bc8b 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -253,8 +253,8 @@ static void handle_view_focus(wlc_handle view, bool focus) {
253} 253}
254 254
255static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geometry *geometry) { 255static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geometry *geometry) {
256 sway_log(L_DEBUG, "geometry request %d x %d : %d x %d", 256 sway_log(L_DEBUG, "geometry request for %ld %dx%d : %dx%d",
257 geometry->origin.x, geometry->origin.y, geometry->size.w, geometry->size.h); 257 handle, geometry->origin.x, geometry->origin.y, geometry->size.w, geometry->size.h);
258 // If the view is floating, then apply the geometry. 258 // If the view is floating, then apply the geometry.
259 // Otherwise save the desired width/height for the view. 259 // Otherwise save the desired width/height for the view.
260 // This will not do anything for the time being as WLC improperly sends geometry requests 260 // This will not do anything for the time being as WLC improperly sends geometry requests
diff --git a/sway/layout.c b/sway/layout.c
index 66f0be29..3cd873d6 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -281,7 +281,6 @@ void move_container(swayc_t *container, enum movement_direction dir) {
281 // Dirty hack to fix a certain case 281 // Dirty hack to fix a certain case
282 arrange_windows(parent, -1, -1); 282 arrange_windows(parent, -1, -1);
283 arrange_windows(parent->parent, -1, -1); 283 arrange_windows(parent->parent, -1, -1);
284 update_visibility(parent->parent);
285 set_focused_container_for(parent->parent, container); 284 set_focused_container_for(parent->parent, container);
286} 285}
287 286
@@ -320,31 +319,34 @@ void update_geometry(swayc_t *container) {
320 if (container->type != C_VIEW) { 319 if (container->type != C_VIEW) {
321 return; 320 return;
322 } 321 }
323 int gap = swayc_gap(container); 322 swayc_t *ws = swayc_parent_by_type(container, C_WORKSPACE);
323 swayc_t *op = ws->parent;
324 int gap = container->is_floating ? 0 : swayc_gap(container);
325
324 struct wlc_geometry geometry = { 326 struct wlc_geometry geometry = {
325 .origin = { 327 .origin = {
326 .x = container->x + (container->is_floating ? 0 : gap / 2), 328 .x = container->x + gap/2 < op->width ? container->x + gap/2 : op->width-1,
327 .y = container->y + (container->is_floating ? 0 : gap / 2) 329 .y = container->y + gap/2 < op->height ? container->y + gap/2 : op->height-1
328 }, 330 },
329 .size = { 331 .size = {
330 .w = container->width > (container->is_floating ? 0 : gap) ? 332 .w = container->width > gap ? container->width - gap : 1,
331 container->width - (container->is_floating ? 0 : gap) : 0, 333 .h = container->height > gap ? container->height - gap : 1,
332 .h = container->height > (container->is_floating ? 0 : gap) ?
333 container->height - (container->is_floating ? 0 : gap) : 0,
334 } 334 }
335 }; 335 };
336 if (swayc_is_fullscreen(container)) { 336 if (swayc_is_fullscreen(container)) {
337 swayc_t *parent = swayc_parent_by_type(container, C_OUTPUT);
338 geometry.origin.x = 0; 337 geometry.origin.x = 0;
339 geometry.origin.y = 0; 338 geometry.origin.y = 0;
340 geometry.size.w = parent->width; 339 geometry.size.w = op->width;
341 geometry.size.h = parent->height; 340 geometry.size.h = op->height;
341 if (op->focused == ws) {
342 wlc_view_bring_to_front(container->handle);
343 }
342 } 344 }
343 wlc_view_set_geometry(container->handle, 0, &geometry); 345 wlc_view_set_geometry(container->handle, 0, &geometry);
344 return; 346 return;
345} 347}
346 348
347void arrange_windows(swayc_t *container, double width, double height) { 349static void arrange_windows_r(swayc_t *container, double width, double height) {
348 int i; 350 int i;
349 if (width == -1 || height == -1) { 351 if (width == -1 || height == -1) {
350 sway_log(L_DEBUG, "Arranging layout for %p", container); 352 sway_log(L_DEBUG, "Arranging layout for %p", container);
@@ -358,7 +360,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
358 for (i = 0; i < container->children->length; ++i) { 360 for (i = 0; i < container->children->length; ++i) {
359 swayc_t *child = container->children->items[i]; 361 swayc_t *child = container->children->items[i];
360 sway_log(L_DEBUG, "Arranging output at %d", x); 362 sway_log(L_DEBUG, "Arranging output at %d", x);
361 arrange_windows(child, -1, -1); 363 arrange_windows_r(child, -1, -1);
362 x += child->width; 364 x += child->width;
363 } 365 }
364 return; 366 return;
@@ -374,7 +376,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
374 child->width = width - gap * 2; 376 child->width = width - gap * 2;
375 child->height = height - gap * 2; 377 child->height = height - gap * 2;
376 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); 378 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
377 arrange_windows(child, -1, -1); 379 arrange_windows_r(child, -1, -1);
378 } 380 }
379 return; 381 return;
380 case C_VIEW: 382 case C_VIEW:
@@ -418,7 +420,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
418 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, width, scale); 420 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, width, scale);
419 child->x = x + container->x; 421 child->x = x + container->x;
420 child->y = y + container->y; 422 child->y = y + container->y;
421 arrange_windows(child, child->width * scale, height); 423 arrange_windows_r(child, child->width * scale, height);
422 x += child->width; 424 x += child->width;
423 } 425 }
424 } 426 }
@@ -445,7 +447,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
445 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, height, scale); 447 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, height, scale);
446 child->x = x + container->x; 448 child->x = x + container->x;
447 child->y = y + container->y; 449 child->y = y + container->y;
448 arrange_windows(child, width, child->height * scale); 450 arrange_windows_r(child, width, child->height * scale);
449 y += child->height; 451 y += child->height;
450 } 452 }
451 } 453 }
@@ -467,6 +469,11 @@ void arrange_windows(swayc_t *container, double width, double height) {
467 } 469 }
468 } 470 }
469 } 471 }
472}
473
474void arrange_windows(swayc_t *container, double width, double height) {
475 update_visibility(container);
476 arrange_windows_r(container, width, height);
470 layout_log(&root_container, 0); 477 layout_log(&root_container, 0);
471} 478}
472 479