| 271 | } |
| 272 | |
| 273 | void pin_view(wayfire_layer_shell_view *v, wf::geometry_t usable_workarea) |
| 274 | { |
| 275 | auto state = &v->lsurface->current; |
| 276 | auto bounds = v->lsurface->current.exclusive_zone < 0 ? |
| 277 | v->get_output()->get_relative_geometry() : usable_workarea; |
| 278 | |
| 279 | wf::geometry_t box; |
| 280 | box.x = box.y = 0; |
| 281 | box.width = state->desired_width; |
| 282 | box.height = state->desired_height; |
| 283 | LOGC(LSHELL, "Pin view ", v->self(), " desired=", wf::dimensions(box), " workarea=", bounds, |
| 284 | " anchor=", state->anchor); |
| 285 | if ((state->anchor & both_horiz) && (box.width == 0)) |
| 286 | { |
| 287 | box.x = bounds.x; |
| 288 | box.width = bounds.width; |
| 289 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) |
| 290 | { |
| 291 | box.x = bounds.x; |
| 292 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) |
| 293 | { |
| 294 | box.x = bounds.x + (bounds.width - box.width); |
| 295 | } else |
| 296 | { |
| 297 | box.x = bounds.x + ((bounds.width / 2) - (box.width / 2)); |
| 298 | } |
| 299 | |
| 300 | if ((state->anchor & both_vert) && (box.height == 0)) |
| 301 | { |
| 302 | box.y = bounds.y; |
| 303 | box.height = bounds.height; |
| 304 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) |
| 305 | { |
| 306 | box.y = bounds.y; |
| 307 | } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) |
| 308 | { |
| 309 | box.y = bounds.y + (bounds.height - box.height); |
| 310 | } else |
| 311 | { |
| 312 | box.y = bounds.y + ((bounds.height / 2) - (box.height / 2)); |
| 313 | } |
| 314 | |
| 315 | v->configure(box); |
| 316 | } |
| 317 | |
| 318 | void arrange_exclusive_zone(wf::output_t *output, int layer) |
| 319 | { |
nothing calls this directly
no test coverage detected