aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/move.c
Commit message (Collapse)AuthorAge
* 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.
* Prevent duplicate workspace::focus eventsLibravatar Ryan Dwyer2018-10-16
| | | | | | | | | | | | Previously we would compare the last focus's workspace with the new focus's workspace to determine if we need to emit an IPC workspace::focus event. This doesn't work when moving the focused container to a new workspace. This adds a workspace property to the seat which stores the last emitted workspace::focus workspace. Using this method, after moving the container, refocusing it will trigger exactly one workspace::focus event: from the old workspace to the new workspace.
* Introduce seat_set_raw_focus and remove notify argument from seat_set_focus_warpLibravatar Ryan Dwyer2018-10-15
| | | | | | | | | | | | | | | | | | | | | | This introduces seat_set_raw_focus: a function that manipulates the focus stack without doing any other behaviour whatsoever. There are a few places where this is useful, such as where we set focus_inactive followed by another call to set the real focus again. With this change, the notify argument to seat_set_focus_warp is also removed as these cases now use the raw function instead. A bonus of this is we are no longer emitting window::focus IPC events when setting focus_inactive, nor are we sending focus/unfocus events to the surface. This also fixes the following: * When running `move workspace to output <name>` and moving the last workspace from the source output, the workspace::focus IPC event is no longer emitted for the newly created workspace. * When splitting the currently focused container, unfocus/focus events will not be sent to the surface when giving focus_inactive to the newly created parent, and window::focus events will not be emitted.
* Flatten container in workspace_rejiggerLibravatar Ryan Dwyer2018-09-23
|
* Fix some bugs as a result of removing move_out_of_tabs_stacksLibravatar Ryan Dwyer2018-09-23
|
* Remove move_out_of_tabs_stacksLibravatar Ryan Dwyer2018-09-23
| | | | | | | | | | | | | | | | | This fixes the following. Create these layouts and run move right: (Initial layout -> expected result -> actual result) * `H[S[unfocused focused] unfocused]` -> `H[S[unfocused] focused unfocused]` -> `H[H[S[unfocused] focused] unfocused]` * `H[S[unfocused focused] V[unfocused]]` -> `H[S[unfocused] V[unfocused focused]]` -> `H[H[S[unfocused] focused] V[unfocused]]` move_out_of_tabs_stacks was originally made to allow views to move out of the tabbed/stacked container in the parallel direction, but at some point this has started working using the regular logic.
* Fix crash moving out of tab containerLibravatar William Wold2018-09-17
|
* Rename seat_get_active_child to seat_get_active_tiling_childLibravatar Ryan Dwyer2018-09-16
| | | | | Also renames container to con in one function to prevent ugly line wrapping.
* Remove bad assertion in workspace_rejiggerLibravatar Ryan Dwyer2018-09-13
| | | | | | | | The assertion can be (rightfully) triggered by creating layout V[H[view view] view] and moving the top right view to the right. After removing the assertion I found the container being moved needs its size reset to prevent it from being sized wrongly after arranging.
* Merge pull request #2620 from ianyfan/commandsLibravatar emersion2018-09-12
|\ | | | | commands: when moving a container, restore focus properly
| * commands: when moving container, remove its gapsLibravatar Ian Fan2018-09-11
| |
| * commands: when moving container, restore focus properlyLibravatar Ian Fan2018-09-11
| |
* | Implement tiling dragLibravatar Ryan Dwyer2018-09-11
|/ | | | Hold floating_modifier and drag a tiling view to a new location.
* Introduce seat_set_focus_container and seat_set_focus_workspaceLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | | These are the same as seat_set_focus, but accept a specific type rather than using nodes. Doing this adds more typesafety and lets us avoid using &con->node which looks a little ugly. This fixes a crash that pretty much nobody would ever come across. If you have a bindsym for "focus" with no arguments and run it from an empty workspace, sway would crash because it assumes `container` is not NULL.
* Fix crash when moving view across outputsLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | It was incorrectly determining that the container being moved and the destination had the same parent, which resulted in tree corruption. Both parents can be NULL but the containers may belong to different workspaces. To reproduce, create layout H[V[view] view] in one workspace then move a view left or right from another output into that workspace.
* Allow marked containers to be moved out of the scratchpad via move commandLibravatar Ryan Dwyer2018-09-05
|