Commit graph

4705 commits

Author SHA1 Message Date
Ryan Dwyer 2438f5f050 Fix crash when reaping a workspace
It wasn't returning the surviving container.
2018-08-29 10:51:54 +10:00
Drew DeVault 095ca75769
Merge pull request #2533 from RyanDwyer/fix-workspace-tabs
Fix workspace tabs
2018-08-28 20:49:14 -04:00
Ryan Dwyer 53fe7b02e9 Fix workspace tabs
When collecting focus to save into the transaction state, the workspace
needs to look in the tiling list only.

As seat_get_focus_inactive_tiling returns any descendant, the list also
needs to be traversed back up to the direct child of the workspace.

Fixes #2532
2018-08-29 10:38:46 +10:00
Ryan Dwyer b12f7be907 Don't use bitfield to test for similar transactions
When there's multiple transactions in the queue, sway can take a
shortcut by checking if they all operate on the same set of containers.
If they do, it can skip all but the last transaction. The way we tested
for transactions which used the same containers was to exclusive-or
their con IDs together, but this has proved not only to be ineffective
but also has the potential to make sway crash.

This patch replaces the exclusive-or with a loop and container
comparison.
2018-08-29 08:29:11 +10:00
Brian Ashworth 602ccca1a8
Merge pull request #2526 from ianyfan/commands
Fix moving container to inactive workspace on different output
2018-08-28 12:41:18 -04:00
Brian Ashworth 876b5147cf
Merge branch 'master' into commands 2018-08-28 12:32:22 -04:00
Drew DeVault 6143a64cda
Merge pull request #2528 from fokditkak/add-bulgarian-readme
Add bulgarian readme
2018-08-28 10:58:37 -04:00
Martin Kalchev 5f2ebe0dd5 added ref to bulgarian translation 2018-08-28 17:12:38 +03:00
Ian Fan bc30f2d528 commands: fix moving container to different output
When moving a container to an inactive workspace on a different output, this will change the focus on the destination output back to its last active workspace
2018-08-28 15:08:46 +01:00
Martin Kalchev 15f709b155 spellcheck and help add. 2018-08-28 17:06:15 +03:00
Drew DeVault 83230435f7
Merge pull request #2511 from RyanDwyer/refactor-arrange
Prepare arrange code for type safe arguments
2018-08-28 10:03:52 -04:00
Ryan Dwyer 126a82f14f Fix gaps issues
* In layout command, arrange parent of parent - not sure why this is
needed but it is
* Remove gap adjustment when rendering
* Workspace should use outer gaps, not inner
* Add exceptions for tabbed and stacked containers
* Don't mess with gap state when splitting a container
2018-08-28 23:53:51 +10:00
Ryan Dwyer f5b9815128 Prepare arrange code for type safe arguments
This commit changes the arrange code in a way that will support type
safe arguments.

The arrange_output et al functions are now public, however I opted not
to use them directly yet. I've kept the generic arrange_windows there
for convenience until type safety is fully implemented. This means this
patch has much less risk of breaking things as it would otherwise.

To be type safe, arrange_children_of cannot exist in its previous form
because the thing passed to it could be either a workspace or a
container. So it's now renamed to arrange_children and accepts a list_t,
as well as the parent layout and parent's box.

There was some code which checked the grandparent's layout to see if it
was tabbed or stacked and adjusted the Y offset of the grandchild
accordingly. Accessing the grandparent layout isn't easy when using type
safe arguments, and it seemed odd to even need to do this. I determined
that this was needed because a child of a tabbed container would have a
swayc Y matching the top of the tab bar. I've changed this so a child of
a tabbed container will have a swayc Y matching the bottom of the tab
bar, which means we don't need to access the grandparent layout.  Some
tweaks to the rendering and autoconfigure code have been made to
implement this, and the container_at code appears to work without
needing any changes.

arrange_children_of (now arrange_children) would check if the parent had
gaps and would copy them to the child, effectively making the
workspace's gaps recurse into all children. We can't do this any more
without passing has_gaps, gaps_inner and gaps_outer as arguments to
arrange_children, so I've changed the add_gaps function to retrieve it
from the workspace directly.

apply_tabbed_or_stacked_layout has been split into two functions, as it
had different logic depending on the layout.

Lastly, arrange.h had an unnecessary include of transaction.h. I've
removed it, which means I've had to add it to several other files.
2018-08-28 23:50:41 +10:00
Martin Kalchev da0ffa3b20 initial commit 2018-08-28 16:16:37 +03:00
Drew DeVault 98ef29c228
Merge pull request #2523 from RedSoxFan/fix-floating-drag-outputs
Stop floaters from snapping on move to new output
2018-08-27 13:44:08 -04:00
Drew DeVault 82423b88b8
Merge pull request #2494 from RyanDwyer/fix-overflowing-subsurfaces
Allow subsurfaces which overflow the container to be interacted with
2018-08-27 12:41:39 -04:00
Drew DeVault 9d9de97c4c
Merge pull request #2520 from RedSoxFan/destroy-empty-ws-on-evac
Destroy empty workspaces in output_evacuate
2018-08-27 12:32:29 -04:00
Drew DeVault efcaee190e
Merge pull request #2519 from ianyfan/set-focus-cleanup
seat.c: clean-up seat_set_focus_warp function
2018-08-27 12:30:26 -04:00
Ian Fan 3bf849d993 seat.c: clean-up seat_set_focus_warp function 2018-08-27 13:25:01 +01:00
Drew DeVault fed6976840
Merge pull request #2522 from ascent12/build_fix
Build fix
2018-08-27 08:16:25 -04:00
Brian Ashworth 11c1619f30 Stop floaters from snapping on move to new output 2018-08-27 03:06:37 -04:00
Scott Anderson 31c3c8a365 Initialise variable properly 2018-08-27 18:01:17 +12:00
Scott Anderson ff86dc0c35 Hide deprecated wayland functions 2018-08-27 18:01:00 +12:00
Brian Ashworth 148b113b8d Destroy empty workspaces in output_evacuate 2018-08-27 00:18:20 -04:00
Brian Ashworth d6a5dfc913
Merge pull request #2518 from ianyfan/ipc
Emit window close event earlier, before destroying
2018-08-26 21:59:38 -04:00
Ian Fan 6ae2e3a4a8 ipc: clean-up container_create_notify function 2018-08-26 19:01:09 +01:00
Ian Fan e7c94708f2 ipc: emit window close event earlier, before destroying 2018-08-26 19:01:09 +01:00
Drew DeVault 6afc0590a1
Merge pull request #2517 from fokditkak/add_fish_completion
Add fish completion
2018-08-26 13:55:08 -04:00
Martin Kalchev f3c18336d2 added fish to meson.build 2018-08-26 19:27:18 +03:00
Martin Kalchev 4f57c3da0e added untested files 2018-08-26 18:53:51 +03:00
Drew DeVault 10c2c09cf6
Merge pull request #2513 from RyanDwyer/rename-root-outputs
Rename sway_root.outputs to sway_root.all_outputs
2018-08-26 10:50:02 -04:00
Drew DeVault df7083a2d0
Merge pull request #2515 from RyanDwyer/remove-layout-file
Remove layout.c
2018-08-26 10:49:49 -04:00
Ryan Dwyer 5dbbab7bdc Remove layout.c
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.
2018-08-26 12:05:16 +10:00
Drew DeVault 1a30c50ef4
Merge pull request #2488 from RyanDwyer/separate-gaps-functions
Make separate gaps functions per container type
2018-08-25 20:07:37 -04:00
Ryan Dwyer 8bed4be1f3 Make separate gaps functions per container type
In preparation for using type safety.
2018-08-26 09:52:12 +10:00
Brian Ashworth ed147aed30
Merge pull request #2512 from apreiml/workspace_move_wrap
Workspace move cycle
2018-08-25 11:19:17 -04:00
Armin Preiml 1a72149d88 Workspace move cycle
On move workspace to direction: Try the farthest on the opposite
direction if no workspace is found at given direction.
2018-08-25 17:10:41 +02:00
Ryan Dwyer 1e024b91fa Add comment for sway_root.all_outputs 2018-08-25 23:42:04 +10:00
Ryan Dwyer 2e7401772e Rename sway_root.outputs to sway_root.all_outputs
This list includes disabled outputs.

When sway_container is demoted, we'll need to store the root's children
(ie. enabled outputs) in the sway_root. It makes sense to put these in a
list called `outputs`, so I'm renaming the existing list in advance.
2018-08-25 23:41:11 +10:00
Drew DeVault b945957b9b
Merge pull request #2510 from RyanDwyer/relocate-layout-functions
Relocate container_move, container_move_to and container_get_in_direction
2018-08-25 09:38:33 -04:00
Ryan Dwyer 33d1022650
Merge pull request #2495 from ianyfan/commands
commands: implement move absolute
2018-08-25 13:24:12 +10:00
Ryan Dwyer 4b9ad9c238
Merge branch 'master' into commands 2018-08-25 13:06:04 +10:00
Ryan Dwyer f4bc25bcc6 Relocate container_move, container_move_to and container_get_in_direction
* 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.
2018-08-25 12:09:42 +10:00
Drew DeVault e86d99acd6
Merge pull request #2499 from RyanDwyer/refactor-destroy-functions
Refactor destroy functions and save workspaces when there's no outputs
2018-08-24 08:27:05 -04:00
Ryan Dwyer b6058703fa Refactor destroy functions and save workspaces when there's no outputs
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.
2018-08-24 22:17:28 +10:00
emersion f53c28d52a
Merge pull request #2470 from ianyfan/completions
[WIP?] Fix zsh completions
2018-08-22 09:35:17 +01:00
emersion a81c148e25
Merge pull request #2507 from RyanDwyer/move-workspace-translate-floating
Translate floating containers when a workspace is moved
2018-08-22 09:34:27 +01:00
emersion 8232cbf00f
Merge pull request #2506 from vilhalmer/ipc-get_tree-return-app_id-and-class
Add app_id and class to get_tree output
2018-08-22 09:32:12 +01:00
Ryan Dwyer e1d5dc0804 Translate floating containers when a workspace is moved
When a workspace is moved to another output, or the output it's on
changes its global layout position, the floating containers on that
workspace should be translated by the same amount as the workspace. This
keeps the floating containers in the same position relative to the
workspace.

A check is done to make sure the floating container's center point isn't
being moved off screen. If it is, it is centered within the workspace.

Fixes part of #2500.
2018-08-22 17:46:12 +10:00
vilhalmer 03718aaebb
Add app_id and class to get_tree output 2018-08-21 20:51:01 -04:00