Commit graph

5914 commits

Author SHA1 Message Date
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
Drew DeVault ce12d912dc
Merge pull request #2505 from RyanDwyer/fix-set-fullscreen
Fix sending fullscreen event to view
2018-08-21 18:46:23 -04:00
Ryan Dwyer e81c26fab9 Fix sending fullscreen event to view
Fixes #2504
2018-08-22 08:23:29 +10:00
Brian Ashworth 395ff7a541
Merge pull request #2503 from RyanDwyer/use-wlr-edges
Replace enum resize_edge with wlr_edges
2018-08-20 22:56:43 -04:00
Ryan Dwyer f129b1b89f Replace enum resize_edge with wlr_edges 2018-08-21 12:41:57 +10:00
Drew DeVault 389610795b
Merge pull request #2502 from minus7/workspace-names
Improve new workspace name selection
2018-08-20 19:22:44 -04:00
minus 471533be0a Improve new workspace name selection
Improves upon 18e425ed by using the first assigned workspace instead of
the last one. The order isn't explicitly guaranteed to be the same as in
the config, but in general works.
2018-08-20 23:17:07 +02:00
Drew DeVault 99631c5050
Merge pull request #2501 from RedSoxFan/fix-bad-free-swaynag
Fix bad-free in swaynag
2018-08-20 15:21:34 -04:00
Brian Ashworth f0d21c46dd Fix bad-free in swaynag 2018-08-20 15:06:12 -04:00
Ian Fan f51b9478f2 commands: implement move absolute 2018-08-20 10:17:32 +01:00
emersion 881f729af9
Merge pull request #2498 from RyanDwyer/fix-jumping-views
Fix jumping views
2018-08-20 08:17:16 +01:00
Ryan Dwyer 771ad7bffa Fix jumping views
Fixes #2490.

To be honest I'm not sure why this fixes the issue.

I observed that I could only make the view jump if I resized it to the
smallest possible size first. Then I had a suspicion that we were
accidentally factoring in the title and border sizes into the view size
when it uses CSD. So I changed that and it appears to have fixed the
jumping issue.

I guess when we factor the title and borders in, we send a configure to
the surface with a size smaller than the minimum, and it comes back with
a surface at the minimum size. We interpret this as an unexpected
resize, and this somehow makes it jump.
2018-08-20 13:24:57 +10:00
Drew DeVault 08a69f267a
Merge pull request #2483 from RyanDwyer/floating-emit-reparent
Send enter/leave events for floating views
2018-08-19 22:06:09 -04:00
Drew DeVault fdcf9275b1
Merge pull request #2496 from RyanDwyer/fix-transaction-crash
Fix crash when a view destroys with pending transactions
2018-08-19 22:03:57 -04:00
Ryan Dwyer e1955c5c08 Fix crash when adding output 2018-08-20 10:37:52 +10:00
Ryan Dwyer a49e4b13bf Clean up tracked outputs when an output is destroyed 2018-08-20 09:23:34 +10:00
Ryan Dwyer 0f6d212629 Send output enter/leave events correctly
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
2018-08-20 09:23:24 +10:00
Ryan Dwyer b3e2c49774 Fix crash when a view destroys with pending transactions
We were removing the saved buffer when one transaction applies, then
didn't have a new buffer to save when the next transaction ran. This
made the rendering code crash as it had no surface to use.

This commit makes it continue to hold the buffer if the view is
destroying and has more transactions. Additionally, a check is added
when saving the buffer to make sure there's no one already there.
2018-08-20 09:04:04 +10:00
emersion 8db6c68db6
Merge pull request #2493 from RyanDwyer/fix-popup-position
Fix popup position when parent uses geometry
2018-08-19 21:51:53 +01:00
Drew DeVault 9f913614ca
Merge pull request #2478 from RyanDwyer/standardise-debug
Standardise debug variables
2018-08-19 10:29:29 -04:00
Ryan Dwyer 4afb2e3f24 Allow subsurfaces which overflow the container to be interacted with
Fixes #2492.
2018-08-19 21:50:33 +10:00
Ryan Dwyer 76bdb21ca9 Fix popup position when parent uses geometry
Fixes #2489.
2018-08-19 21:09:39 +10:00
emersion 2c91afbb34
Merge pull request #2487 from RyanDwyer/workspace-floating-list
Replace hacky L_FLOATING container with a list
2018-08-19 09:21:55 +01:00
Ryan Dwyer 2b5a404ac9 Replace hacky L_FLOATING container with a list
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
2018-08-19 16:18:33 +10:00
Ryan Dwyer f9563d88f3 Use enum for damage debug options 2018-08-19 16:17:24 +10:00
Ryan Dwyer 8d1dd03823 Standardise debug variables
This makes all debug options stored in a single struct rather than in
various places, changes/fixes the behaviour of existing options, and
introduces some new options.

* Fixes damage issues with `-Drender-tree` texture (by removing scissor)
* Offsets the render tree overlay's `y` position for those who have
swaybar at the top
* Replaces `-Ddamage=rerender` with `-Dnodamage`
* Replaces `-Ddamage=highlight` with `-Dhighlight-damage`
* Replaces `-Dtxn-debug` with `-Dtxn-wait`
* Introduces `-Dnoatomic`
* Removes the `create_time` and `ms_arranging` figures from transactions
and the log message. Transactions are created after arranging and the
create time is of no significance.
* Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working.
2018-08-19 16:17:24 +10:00
Ryan Dwyer 389d159c81
Merge pull request #2453 from ianyfan/commands
More commands
2018-08-19 16:16:32 +10:00
Ryan Dwyer 7f22fab389
Merge branch 'master' into commands 2018-08-19 16:07:11 +10:00
Drew DeVault d0a24465d7
Merge pull request #2466 from RyanDwyer/geometry
Fix geometry
2018-08-18 19:26:36 -04:00
Ryan Dwyer 373f0254a8
Merge pull request #2484 from ianyfan/con-for-each-child-fix
Fix double iterating in container_for_each_child
2018-08-19 08:59:00 +10:00
Ian Fan 37e37627ca commands: move newly-stickied containers to focused workspace 2018-08-18 18:29:18 +01:00
Ian Fan 1be75fe740 Fix double iterating in container_for_each_child 2018-08-18 18:10:41 +01:00
Ian Fan b3f7801fca commands: prevent focusing mode with no containers
Explicitly fail when trying to focus tiling/floating when there are no tiling/floating containers.
2018-08-18 17:25:06 +01:00
Ian Fan 23601a8771 commands: complete assign command 2018-08-18 17:25:06 +01:00
Ian Fan e81cc8a575 commands: saner workspace number handling 2018-08-18 17:25:06 +01:00
Ian Fan 69e00151bb commands: handle quoted exec command 2018-08-18 15:50:26 +01:00
Ian Fan 453646b887 commands: fix documentation formatting mistakes for move command 2018-08-18 15:50:26 +01:00
Ian Fan 7717c2231a commands: require set variable to start with $ 2018-08-18 15:50:26 +01:00
Ian Fan c1af79532f commands: add nop 2018-08-18 15:50:26 +01:00
Drew DeVault 744724b3cb
Merge pull request #2473 from RyanDwyer/iterators-per-type
Implement iterators per container type
2018-08-18 10:29:46 -04:00
Ryan Dwyer d6cd79c342 Implement iterators per container type
This introduces the following `for_each` functions:

* root_for_each_workspace
* root_for_each_container
* output_for_each_workspace
* output_for_each_container
* workspace_for_each_container

And introduces the following `find` functions:

* root_find_output
* root_find_workspace
* root_find_container
* output_find_workspace
* output_find_container
* workspace_find_container
* container_find_child

And removes the following functions:

* container_descendants
* container_for_each_descendant
* container_find

This change is preparing the way for demoting sway_container. Eventually
these functions will accept and return sway_outputs, sway_workspaces and
sway_containers (meaning a C_CONTAINER or C_VIEW).

This change also makes it easy to handle abnormalities like the
workspace floating list, root's scratchpad list and (once implemented)
root's saved workspaces list for when there's no connected outputs.
2018-08-18 23:38:54 +10:00
Drew DeVault d4a32800d5
Merge pull request #2460 from RyanDwyer/implement-mousedown
Implement mousedown operation
2018-08-18 09:32:04 -04:00