aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/move.c
Commit message (Collapse)AuthorAge
* container: Move pending state to state structLibravatar Kenny Levinsen2021-02-16
| | | | | | | | | Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
* cmd_move: update container representation in sibling swapsLibravatar Ronan Pigott2021-01-04
|
* commands/move: reset geometry of promoted containersLibravatar Ronan Pigott2020-12-20
|
* commands/move: squash workspace after directional con moveLibravatar Ronan Pigott2020-12-20
|
* commands/move: rework container_move_in_directionLibravatar Ronan Pigott2020-12-20
| | | | | | | | | | This changes the move command to better match i3 behavior after the layout changes. workspace_rejigger handled the case where containers would escape their workspace in an orthogonal move by changing the layout to accomodate them, but this case is now handled within the loop.
* Revert "commands/move: maintain workspace_layout when moving"Libravatar Ronan Pigott2020-12-20
| | | | | | | This is in preparation for changing the workspace_layout command to work like it does in i3. This reverts commit b4a75a1ab2a72842830aeea37733311f85e6f660.
* commands/move: don't flatten on move; reap empty former parent insteadLibravatar Tudor Brindus2020-12-20
| | | | | | | | | | | | | | | | | | Some comparisons of current Sway versus i3 behavior: 1) T[T[T[app]]] + move left * Sway: T[app] * i3: T[T[app]] 2) H[V[H[V[app]]]] + move left * Sway: H[app] * i3: H[V[app]] After this commit, Sway behavior matches i3. The intermediate states are now: T[T[T[app]]] -> T[T[app T[]]] -> T[T[app]] H[V[H[V[app]]]] -> H[V[app H[V[]]]] -> H[V[app]]
* tree/container: introduce `container_is_sticky[_or_child]` functionsLibravatar Tudor Brindus2020-11-11
| | | | | | | | | | To query whether a container is sticky, checking `con->is_sticky` is insufficient. `container_is_floating_or_child` must also return true; this led to a lot of repetition. This commit introduces `container_is_sticky[_or_child]` functions, and switches all stickiness checks to use them. (Including ones where the container is already known to be floating, for consistency.)
* commands/move: fix crash when moving sphsc childLibravatar Ronan Pigott2020-10-24
|
* commands/move: fix single-split escaping on moveLibravatar Tudor Brindus2020-10-04
| | | | | | | | | Prior to this commit, having a layout like T[app1 V[app2]], focusing app2, and then doing `move left` would result in T[app2 app1]. Now, the resulting layout is T[app1 app2], which matches i3 behavior. `container_flatten` updates `container->parent`, meaning that the existing check would never be true.
* Use wlr_output_layout_output_at to get output for move to cursorLibravatar Thayne McCombs2020-07-27
|
* Keep windows in bounds on move to position mouseLibravatar Thayne McCombs2020-07-27
| | | | | | | | | | | | | If the mouse/cursor/pointer is near the edge of an output when a "move position to pointer" command is run, then the floating container will be constrained to fit inside the bounds of the output as much as possible. This behavior matches what i3 does in this scenario. I also think it is a better user experience. Relates to #4906 The logic for the bounds check follows the implementation in i3: https://github.com/i3/i3/blob/733077822302d8b77eacb606a26fd002a42f534f/src/floating.c#L536
* added ppt unit to move position commandLibravatar Nils Schulte2020-07-21
|
* commands/move: maintain workspace_layout when movingLibravatar Tudor Brindus2020-07-03
| | | | Fixes #5157.
* commands/move: unwrap workspace container on move to new workspaceLibravatar Tudor Brindus2020-07-01
| | | | | | | | | If moving e.g. `T[app app]` into a new workspace with `workspace_layout tabbed`, then post-move the tree in that workspace will be `T[T[app app]]`. This still happens with horizontal or vertical workspace layout, but is less visible since those containers have no decorations. Fixes #5426.
* Check argc>0 before strcasecmp. Should shortcircuitLibravatar Jason Nader2020-01-18
|
* commands/move: Fix crash when required args not providedLibravatar Jason Nader2020-01-18
| | | | Fixes #4919.
* cmd_move: Fix crash when moving to scratchpad hidden split containersLibravatar Ronan Pigott2020-01-16
|
* cmd_move: fix move to scratchpad hidden containerLibravatar Brian Ashworth2019-08-23
| | | | | | | | | When moving to a scratchpad hidden container (using `move [window|container] [to] mark <mark>`), this moves the container to the scratchpad (equivalent to `move [window|container] [to] scratchpad`). Previously, this would crash since the destination did not have a workspace.
* Allow moving a container hidden in scratchpadLibravatar lbonn2019-08-20
| | | | | | | (as i3 allows it) Just update the container's coordinates so that they will be applied at the next show.
* Rework gaps code to be simpler and correctLibravatar Pedro Côrte-Real2019-07-15
| | | | | | | | | | | | | Instead of tracking gaps per child apply gaps in two logical places: 1. In tiled containers use the layout code to add the gaps between windows. This is much simpler and guarantees that the sizing of children is correct. 2. In the workspace itself apply all the gaps around the edge. Here we're in the correct position to size inner and outer gaps correctly and decide on smart gaps in a single location. Fixes #4296
* Layout tiled using a width/height fractionLibravatar Pedro Côrte-Real2019-07-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using container->width/height as both the input and output of the layout calculation have container->width_fraction/height_fraction as the share of the parent this container occupies and calculate the layout based on that. That way the container arrangement can always be recalculated even if width/height have been altered by things like fullscreen. To do this several parts are reworked: - The vertical and horizontal arrangement code is ajusted to work with fractions instead of directly with width/height - The resize code is then changed to manipulate the fractions when working on tiled containers. - Finally the places that manipulated width/height are adjusted to match. The adjusted parts are container split, swap, and the input seat code. It's possible that some parts of the code are now adjusting width and height only for those to be immediately recalculated. That's harmless and since non-tiled containers are still sized with width/height directly it may avoid breaking other corner cases. Fixes #3547 Fixes #4297
* Fix sway crashes for scratchpad layoutsLibravatar Rouven Czerwinski2019-06-16
| | | | | | | | | | | | | | Currently container_replace removes the container from the scratchpad and re-adds it afterwards. For the split commands this results in the container being send to the scratchpad, which results in a NULL segfault if the same container should be shown. Pass an optional workspace to root_scratchpad_add_container, if the workspace is passed the window will continue to show on the workspace. If NULL is passed it is sent to the scratchpad. This was an issue if no other window except the scratchpad container was on the workspace. Fixes #4240
* cmd_move: add support for output currentLibravatar Brian Ashworth2019-04-30
| | | | | | | | | This adds support for the following commands for i3 compatibility: - `move [window|container] [to] output current` - `move workspace to [output] current` - `move workspace [to] output current` The above commands are only useful when used with criteria.
* cmd_move: allow for all i3 syntax optionsLibravatar Brian Ashworth2019-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies cmd_move to allow for the syntax options allowed by i3. The following syntaxes are supported: - `move left|right|up|down [<amount> [px]]` - `move [--no-auto-back-and-forth] [window|container] [to] workspace <name>|next|prev|next_on_output|prev_on_output|current|number <num>` - `move [window|container] [to] output <name/id>|left|right|up|down` - `move [window|container] [to] mark <mark>` - `move workspace to [output] <name/id>|left|right|up|down` - `move [window|container] [to] [absolute] position <x> [px] <y> [px]` - `move [window|container] [to] [absolute] position center` - `move [window|container] [to] position mouse|cursor|pointer` This also allows retains the following syntax option that is not supported by i3, but is supported in sway 1.0: - `move workspace [to] output <name/id>|left|right|up|down` The changes are: - `window` and `container` are now optional - `output` is now optional for `move workspace` when `to` is given There is also stricter command checking now. If `absolute` or `--no-auto-back-and-forth` are given for commands that do not support them, it will be treated as invalid syntax instead of being silently ignored.
* Fix scratchpad fullscreen behavior and crashLibravatar Brian Ashworth2019-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When setting fullscreen on a hidden scratchpad container, there was a check to see if there was an existing fullscreen container on the workspace so it could be fullscreen disabled first. Since the workspace is NULL, it would cause a SIGSEGV. This adds a NULL check to avoid the crash. This also changes the behavior of how fullscreen is handled when adding a container to the scratchpad or changing visibility of a scratchpad container to match i3's. The behavior is as follows: - When adding a container to the scratchpad or hiding a container back into the scratchpad, there is an implicit fullscreen disable - When setting fullscreen on a container that is hidden in the scratchpad, it will be fullscreen when shown (and fullscreen disabled when hidden as stated above) - When setting fullscreen global on a container that is hidden in the scratchpad, it will be shown immediately as fullscreen global. The container is not moved to a workspace and remains in the scratchpad. The container will be visible until fullscreen disabled or killed. Since the container is in the scratchpad, running `scratchpad show` or `move container to scratchpad` will have no effect This also changes `container_replace` to transfer fullscreen and scratchpad status.
* Fix potential null accessesLibravatar Ashkan Kiani2019-04-13
|
* commands: allow tiled sticky containers to be movedLibravatar Ian Fan2019-03-11
| | | | | Namely, to a workspace on the same output. However, tiled sticky children of floating containers are still restricted.
* move scratchpad: hide visible scratchpad containerLibravatar Brian Ashworth2019-02-22
| | | | | | | This makes it so running `move [to] scratchpad` on a container already in the scratchpad does not return an error. To match i3's behavior, a visible scratchpad container will be hidden and a hidden scratchpad container will be treated as a noop.
* commands/move: reintroduce wrongly removed NULL checkLibravatar Rouven Czerwinski2019-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit d3d7956576341bbbfb60d045175b0e8a44752e0b removed this NULL check, which leads to the following backtrace: #0 0x0000557bd201df46 in node_is_view (node=0x0) at ../sway/sway/tree/node.c:41 #1 0x0000557bd1ff5d4e in seat_get_focus_inactive (seat=0x557bd3fc7580, node=0x0) at ../sway/sway/input/seat.c:968 current = 0x557bd2033485 #2 0x0000557bd2009f24 in cmd_move_container (argc=3, argv=0x557bd46b19c0) at ../sway/sway/commands/move.c:557 new_output_last_focus = 0x0 error = 0x0 node = 0x557bd469f360 workspace = 0x557bd4572ee0 container = 0x557bd469f360 no_auto_back_and_forth = false seat = 0x557bd3fc7580 old_parent = 0x0 old_ws = 0x557bd4572ee0 old_output = 0x557bd411f740 destination = 0x557bd46a0cc0 new_output = 0x557bd411f740 new_output_last_ws = 0x0 focus = 0x557bd469f360 __PRETTY_FUNCTION__ = "cmd_move_container" new_workspace = 0x557bd4572ee0 […] Reintroduce the NULL check to fix the bug. Fixes #3746
* Handle NULL from output_get_active_workspaceLibravatar Brian Ashworth2019-02-21
| | | | | | | | | | This modifies the places where output_get_active_workspace is called to handle a NULL result. Some places already handled it and did not need a change, some just have guard off code blocks, others return errors, and some have sway_asserts since the case should never happen. A lot of this is probably just safety precautions since they probably will never be called when `output_get_active_workspace` is not fully configured with a workspace.
* Don't remove from scratchpad on move to workspaceLibravatar athrungithub2019-02-12
| | | | | on move container window to another workspace, not remove from scratchpad.
* Introduce container_is_scratchpad_hiddenLibravatar Ryan Dwyer2019-01-28
| | | | | | | | | | | | Just a convenience function that improves readability of the code. Other things worth noting: * container_get_siblings and container_sibling_index no longer use the const keyword * container_handle_fullscreen_reparent is only ever called after attaching the container to a workspace, so its con->workspace check has been changed to an assertion
* Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
|
* root_scratchpad_remove_container: do not showLibravatar Brian Ashworth2019-01-22
| | | | | | | This removes the call to `root_scratchpad_show` from `root_scratchpad_remove_container` and places it in the `cmd_move_container`. This also moved the IPC `window::move` event to `cmd_scratchpad`.
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* Handle hidden scratchpad containers in commandsLibravatar Brian Ashworth2019-01-15
| | | | | | | This fixes the handling of hidden scratchpad containers for some commands. For the most part, this just prevents running the commands on hidden scratchpad containers, but there are some commands that have some special handling for them.
* Remove now-unused "input" argument of cmd_results_newLibravatar M Stoeckl2019-01-14
| | | | | | | | | Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
* Reset container dimensions when moving into workspace from directionLibravatar Ryan Dwyer2019-01-09
|
* Combine output_by_name and output_by_identifierLibravatar Brian Ashworth2018-12-20
| | | | | | | | This combines `output_by_name` and `output_by_identifier` into a single function called `output_by_name_or_id`. This allows for output identifiers to be used in all commands, simplifies the logic of the callers, and is more efficient since worst case is a single pass through the output list.
* move to workspace: fix moving floating container to non-empty workspaceLibravatar Dominique Martinet2018-11-29
| | | | | | moving a container to a non-empty workspace will find a container to move to in the destination workspace and call container_move_to_container, which must not just skip floating containers
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* Move view marks properties to container structLibravatar Ryan Dwyer2018-11-01
| | | | | Like border properties, this will be needed to implement layout saving and restoring.
* Wrap to fartherest output when running focus outputLibravatar Ryan Dwyer2018-11-01
| | | | | Also moves the `opposite_direction` function into `util.c` as it's used in two places now.
* Remove enum movement_directionLibravatar Ryan Dwyer2018-10-30
| | | | | | | | | There's no point having both movement_direction and wlr_direction. This replaces the former with the latter. As movement_direction also contained MOVE_PARENT and MOVE_CHILD items, these are now checked specifically in the focus command and handled in separate functions, just like the other focus variants.
* Deny several commands when there's no outputs connectedLibravatar Ryan Dwyer2018-10-26
|
* Fix crash when moving a container to a fullscreen workspaceLibravatar Ryan Dwyer2018-10-22
| | | | | | | | | | Setting normal focus to the fullscreen view causes the old workspace to start destroying. We then set focus to the old workspace which is no longer attached in the tree. As we are only setting focus_inactive on the fullscreen container, the fix uses seat_set_raw_focus to avoid all the additional behaviour that comes with it such as destroying the old workspace.
* Make workspace back_and_forth seat-specificLibravatar Ryan Dwyer2018-10-21
| | | | | | | | * When using multiple seats, each seat has its own prev_workspace_name for the purpose of workspace back_and_forth. * Removes prev_workspace_name global variable. * Removes unused next_name_map function in tree/workspace.c. * Fixes memory leak in seat_destroy (seat was not freed).
* Minor refactor of input managerLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | | | | | | | | | The input manager is a singleton object. Passing the sway_input_manager argument to each of its functions is unnecessary, while removing the argument makes it obvious to the caller that it's a singleton. This patch removes the argument and makes the input manager use server.input instead. On a similar note: * sway_input_manager.server is removed in favour of using the server global. * seat.input is removed because it can get it from server.input. Due to a circular dependency, creating seat0 is now done directly in server_init rather than in input_manager_create. This is because creating seats must be done after server.input is set. Lastly, it now stores the default seat name using a constant and removes a second reference to seat0 (in input_manager_get_default_seat).
* Fix moving tiled containers to workspaces which only have floating viewsLibravatar Ryan Dwyer2018-10-17
| | | | | | | | | | | | | | * Make a workspace which only contains floating views * Switch to another workspace and create a tiled view * Move the tiled view to the workspace with `move container to workspace N` The container would be added as a sibling to the floating view, which makes the container floating while having the geometry of a tiled container. This changes it so it only looks for tiled containers in the workspace with a fallback to the workspace itself.