Change the current focus to the next or the previous view */
| 507 | |
| 508 | /* Change the current focus to the next or the previous view */ |
| 509 | void focus_next(int dir) |
| 510 | { |
| 511 | auto ws_views = get_workspace_views(); |
| 512 | /* Change the focused view and rearrange views so that focused is on top */ |
| 513 | int size = ws_views.size(); |
| 514 | |
| 515 | // calculate focus index & focus it |
| 516 | int focused_view_index = (size + dir) % size; |
| 517 | auto focused_view = ws_views[focused_view_index]; |
| 518 | wf::view_bring_to_front(focused_view); |
| 519 | } |
| 520 | |
| 521 | /* Create the initial arrangement on the screen |
| 522 | * Also changes the focus to the next or the last view, depending on dir */ |