aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
Commit message (Collapse)AuthorAge
* Remove layout.cLibravatar Ryan Dwyer2018-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | When we have type safety we'll need to have functions for workspace_add_tiling and so on. This means the existing container functions will be just for containers, so they are being moved to container.c. At this point layout.c doesn't contain much else, so I've relocated everything and removed the file. * container_swap and its static functions have been moved to the swap command and made static. * container_recursive_resize has been moved to the resize command and made static. * The following have been moved to container.c: * container_handle_fullscreen_reparent * container_insert_child * container_add_sibling * container_add_child * container_remove_child * container_replace_child * container_split * enum movement_direction and sway_dir_to_wlr have been moved to util.c. Side note: Several commands included layout.h which then included root.h. With layout.h gone, root.h has to be included by those commands.
* Make separate gaps functions per container typeLibravatar Ryan Dwyer2018-08-26
| | | | In preparation for using type safety.
* Relocate container_move, container_move_to and container_get_in_directionLibravatar Ryan Dwyer2018-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * container_move is only called from the move command * container_move_to was called from both the move command and the sticky command, but the sticky command can easily not call it * container_get_in_direction is only called from the focus command Moving these functions to their respective commands gives better separation of code and removes bloat from layout.c. These functions will need to be refactored to take advantage of type safety, so separating them will make this easier to refactor. The following static functions have also been moved: * is_parellel * invert_movement * move_offs * container_limit * workspace_rejigger * move_out_of_tabs_stacks * get_swayc_in_output_direction They were all used by the move functions, except for the last one which is used by focus. Other changes: * index_child has been renamed to container_sibling_index, moved to container.c and made public * sway_output_from_wlr has been renamed to output_from_wlr_output, moved to output.c and made public * container_handle_fullscreen_reparent has been made public * sway_dir_to_wlr has been made public No changes have been made to any of the moved functions, other than updating calls to functions that have been renamed.
* Refactor destroy functions and save workspaces when there's no outputsLibravatar Ryan Dwyer2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the destroy functions to the following: * output_begin_destroy * output_destroy * workspace_begin_destroy * workspace_destroy * container_begin_destroy * container_destroy * view_begin_destroy * view_destroy The terminology was `destroy` and `free`, and it has been changed to `begin_destroy` and `destroy` respectively. When the last output is disconnected, its workspaces will now be stashed in the root. Upon connection of a new output they will be restored. There is a new function `workspace_consider_destroy` which decides whether the given workspace should be destroyed or not (ie. empty and not visible). Calling container_begin_destroy will no longer automatically reap the parents. In some places we want to reap the parents and in some we don't, so this is left to the caller. container_reap_empty_recursive and container_reap_empty have been combined into one function and it will recurse up the tree.
* Replace enum resize_edge with wlr_edgesLibravatar Ryan Dwyer2018-08-21
|
* Send output enter/leave events correctlyLibravatar Ryan Dwyer2018-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we used a reparent event to detect when a view changes parent, then sent an output enter/leave to the surfaces if needed. This worked for tiling views but not floating views, as floating views can intersect another output without changing parent. The solution implemented for floating views also applies cleanly to tiling views, so the previous method has been completely replaced and the reparent event has been removed. This introduces a new function container_discover_outputs. This function compares the container's `current` position to the outputs, sends enter and leave events as needed, and keeps track of which outputs it's intersecting in a new `container->outputs` list. If it has entered a new output with a different scale then the title and marks textures will also be recreated at the new scale. The function is called when a transaction applies. This is convenient as it means we don't have to call it from various places. There is imperfect rendering when a floating view overlaps two outputs with different scales. It renders correctly for the most recently entered output, but there is only one title texture so it renders incorrectly on the old output. Fixes #2482
* Replace hacky L_FLOATING container with a listLibravatar Ryan Dwyer2018-08-19
| | | | | | | | | | | | | | | | Workspaces previously had a magical `workspace->floating` container, which had a layout of L_FLOATING and whose children were actual floating views. This allowed some conveniences, but was a hacky solution because the container has to be exempt from focus, coordinate transactions with the workspace, and omit emitting IPC events (which we didn't do). This commit changes it to be a list directly in the sway_workspace. The L_FLOATING layout is no longer used so this has been removed as well. * Fixes incorrect check in the swap command (it checked if the containers had the L_FLOATING layout, but this layout applied to the magical container). * Introduces workspace_add_floating
* Rename container_sort_workspaces and container_wrap_childrenLibravatar Ryan Dwyer2018-08-18
| | | | | | | | This commit renames container_sort_workspaces to output_sort_workspaces and moves it to output.c. This also renames container_wrap_children to workspace_wrap_children and moves it to workspace.c. This function is only called with workspaces.
* Use list_find in more places and refactor/fix workspace prev_next functionsLibravatar Ryan Dwyer2018-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original purpose of this commit is to replace some for loops with list_find. But while doing this I found the workspace_prev_next_impl functions to be difficult to read and also contained a bug, so I refactored them and fixed the bug. To reproduce the bug: * Have two outputs, where the left output has workspaces 1, 2, 3 and the right output has workspaces 4, 5, 6. Make workspace 2 focused_inactive and workspace 4 focused. * Run `workspace prev`. * Previously it would visit the left output, then apply `workspace prev` to workspace 2, which focuses workspace 1. * Now it will focus the rightmost workspace on the left output (workspace 3). The refactoring I made to the workspace functions are: * Added the static keyword. * They now accept an int dir rather than bool, to avoid an unnecessary conversion. * Rather than preparing start and end variables for the purpose of iterating, just iterate everything. * Replace for loops with list_find. * Don't call workspace_output_prev_next_impl (this fixes the bug).
* Fix edge cases when moving floating container to new workspaceLibravatar Ryan Dwyer2018-08-08
| | | | | | | | | | * Removes container_floating_move_to_container, instead opting to put that logic in container_move_to * In the seat code, focusing a floating view now updates the pending state only and lets the next transaction carry it over to the current state. This is required, otherwise it would crash. * When unfullscreening a floating container, an output check is now done to see if it should center it.
* Implement move to workspace on a floating containerLibravatar Ryan Dwyer2018-08-08
| | | | | Also adjusts container_floating_translate to not change the current properties directly.
* Merge branch 'master' into workspace-move-to-outputLibravatar Brian Ashworth2018-08-06
|\
| * commands: fix layout implementation (also better name for previous split layout)Libravatar Ian Fan2018-08-06
| |
* | Move workspace moving code out of container_move_toLibravatar Ryan Dwyer2018-08-07
|/ | | | | | | | | | | | | container_move_to handled moving containers to new parents, as well as moving workspaces to new outputs. This commit removes the workspace-moving code from this function and introduces workspace_move_to_output. Moving workspaces using container_move_to only happened from the move command, so it's been implemented as a static function in that file. Simplifying container_move_to makes it easier for me to fix some issues in #2420.
* Separate root-related codeLibravatar Ryan Dwyer2018-08-04
| | | | | | | | | This creates a root.c and moves bits and pieces from elsewhere into it. * layout_init has been renamed to root_create and moved into root.c * root_destroy has been created and is called on shutdown * scratchpad code has been moved into root.c, because hidden scratchpad containers are stored in the root struct
* ipc: prevent emitting a workspace::focus event when moving a container to a ↵Libravatar Ian Fan2018-08-01
| | | | | | different workspace or output When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
* ipc: fix workspace::focus event behaviourLibravatar Ian Fan2018-08-01
|
* ipc: add window::move eventsLibravatar Ian Fan2018-08-01
|
* ipc: fix workspace::move calls argument orderLibravatar Ian Fan2018-08-01
|
* Allow containers to floatLibravatar Ryan Dwyer2018-07-28
| | | | | | | | | | | | | | | | Things worth noting: * When a fullscreen view unmaps, the check to unset fullscreen on the workspace has been moved out of view_unmap and into container_destroy, because containers can be fullscreen too * The calls to `container_reap_empty_recursive(workspace)` have been removed from `container_set_floating`. That function reaps upwards so it wouldn't do anything. I'm probably the one who originally added it... * My fix (b14bd1b0b1536039e4f46fe94515c7c44e7afc61) for the tabbed child crash has a side effect where when you close a floating container, focus is not given to the tiled container again. I've removed my fix and removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We should consider calling it from somewhere earlier in the call stack.
* Allow containers to be fullscreenLibravatar Ryan Dwyer2018-07-26
|
* reverted includes of "sway/config.h" and replaced with "config.h" from meson ↵Libravatar Pascal Pascher2018-07-25
| | | | build
* more style fixes, included "sway/config.h" where neededLibravatar Pascal Pascher2018-07-25
|
* style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: falseLibravatar Pascal Pascher2018-07-24
|
* Added meson option "enable_xwayland" (default: true) to enable/disable ↵Libravatar Pascal Pascher2018-07-24
| | | | xwayland support
* Store scratchpad list in sway_root instead of serverLibravatar Ryan Dwyer2018-07-23
|
* Implement scratchpadLibravatar Ryan Dwyer2018-07-23
| | | | | | | | | | | | | | Implements the following commands: * move scratchpad * scratchpad show * [criteria] scratchpad show Also fixes these: * Fix memory leak when executing command with criteria (use `list_free(views)` instead of `free(views)`) * Fix crash when running `move to` with no further arguments
* Implement floating_modifier and mouse operations for floating viewsLibravatar Ryan Dwyer2018-07-22
| | | | | | | | | | | | | | This implements the following: * `floating_modifier` configuration directive * Drag a floating window by its title bar * Hold mod + drag a floating window from anywhere * Resize a floating view by dragging the border * Resize a floating view by holding mod and right clicking anywhere on the view * Resize a floating view and keep aspect ratio by holding shift while resizing using either method * Mouse cursor turns into resize when hovering floating border or corner
* Fix crash when moving workspace to outputLibravatar Ryan Dwyer2018-07-19
|
* Update workspace urgent state when views close or move workspacesLibravatar Ryan Dwyer2018-07-16
|
* Simplify transactions by utilising a dirty flag on containersLibravatar Ryan Dwyer2018-07-14
| | | | | | | | | | | | | | | This PR changes the way we handle transactions to a more simple method. The new method is to mark containers as dirty from low level code (eg. arranging, or container_destroy, and eventually seat_set_focus), then call transaction_commit_dirty which picks up those containers and runs them through a transaction. The old methods of using transactions (arrange_and_commit, or creating one manually) are now no longer possible. The highest-level code (execute_command and view implementation handlers) will call transaction_commit_dirty, so most other code just needs to set containers as dirty. This is done by arranging, but can also be done by calling container_set_dirty.
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* No need to walk to workspace, recursive willLibravatar vilhalmer2018-07-09
|
* Regroup signalLibravatar vilhalmer2018-07-09
|
* Replace empty workspace with moved workspaceLibravatar vilhalmer2018-07-08
|
* Implement atomic layout updates for tree operationsLibravatar Ryan Dwyer2018-06-23
| | | | | This implements atomic layout updates for when views map, reparent or unmap.
* Merge remote-tracking branch 'upstream/master' into atomicLibravatar Ryan Dwyer2018-06-11
|\
| * Merge pull request #2124 from emersion/drag-icons1.0-alpha.3Libravatar Drew DeVault2018-06-09
| |\ | | | | | | Render drag icons
| | * Render drag iconsLibravatar emersion2018-06-09
| | |
| * | Implement gaps (PR #2047)Libravatar Nate Symer2018-06-09
| |/
* | Refactor everything that needs to arrange windowsLibravatar Ryan Dwyer2018-06-09
| | | | | | | | | | | | | | | | | | | | * The arrange_foo functions are now replaced with arrange_and_commit, or with manually created transactions and arrange_windows x2. * The arrange functions are now only called from the highest level functions rather than from both high level and low level functions. * Due to the previous point, view_set_fullscreen_raw and view_set_fullscreen are both merged into one function again. * Floating and fullscreen are now working with transactions.
* | Make main properties be the pending stateLibravatar Ryan Dwyer2018-06-09
| |
* | WIP: Atomic layout updates ground workLibravatar Ryan Dwyer2018-06-09
|/
* Switch restore workspaces to a nested for-loopLibravatar Brian Ashworth2018-06-08
|
* Restore workspaces to outputs based on priorityLibravatar Brian Ashworth2018-06-08
|
* Switch output storing from list_t to wl_listLibravatar Brian Ashworth2018-06-06
|
* Store sway_outputs so that they can be reenabledLibravatar Brian Ashworth2018-06-06
|
* Remove tab/stack check for focusing after a splitLibravatar Brian Ashworth2018-06-06
|
* Fix focusing after splitting tabs/stacksLibravatar Brian Ashworth2018-06-06
|
* Fix movement crashes/issuesLibravatar Brian Ashworth2018-06-05
|