| 600 | } |
| 601 | |
| 602 | void wayfire_layer_shell_view::configure(wf::geometry_t box) |
| 603 | { |
| 604 | auto state = &lsurface->current; |
| 605 | if ((state->anchor & both_horiz) == both_horiz) |
| 606 | { |
| 607 | box.x += state->margin.left; |
| 608 | box.width -= state->margin.left + state->margin.right; |
| 609 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) |
| 610 | { |
| 611 | box.x += state->margin.left; |
| 612 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) |
| 613 | { |
| 614 | box.x -= state->margin.right; |
| 615 | } |
| 616 | |
| 617 | if ((state->anchor & both_vert) == both_vert) |
| 618 | { |
| 619 | box.y += state->margin.top; |
| 620 | box.height -= state->margin.top + state->margin.bottom; |
| 621 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) |
| 622 | { |
| 623 | box.y += state->margin.top; |
| 624 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) |
| 625 | { |
| 626 | box.y -= state->margin.bottom; |
| 627 | } |
| 628 | |
| 629 | if ((box.width < 0) || (box.height < 0)) |
| 630 | { |
| 631 | LOGE("layer-surface has calculated width and height < 0"); |
| 632 | close(); |
| 633 | } |
| 634 | |
| 635 | // TODO: transactions here could make sense, since we want to change x,y,w,h together, but have to wait |
| 636 | // for the client to resize. |
| 637 | move(box.x, box.y); |
| 638 | wlr_layer_surface_v1_configure(lsurface, box.width, box.height); |
| 639 | } |
| 640 | |
| 641 | void wayfire_layer_shell_view::remove_anchored(bool reflow) |
| 642 | { |