aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
AgeCommit message (Collapse)Author
2018-08-20Fix jumping viewsRyan Dwyer
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-20Fix crash when adding outputRyan Dwyer
2018-08-20Clean up tracked outputs when an output is destroyedRyan Dwyer
2018-08-20Send output enter/leave events correctlyRyan Dwyer
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-19Replace hacky L_FLOATING container with a listRyan Dwyer
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-19Merge branch 'master' into commandsRyan Dwyer
2018-08-18Merge pull request #2466 from RyanDwyer/geometryDrew DeVault
Fix geometry
2018-08-18Fix double iterating in container_for_each_childIan Fan
2018-08-18commands: complete assign commandIan Fan
2018-08-18commands: saner workspace number handlingIan Fan
2018-08-18Implement iterators per container typeRyan Dwyer
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-18Rename container_sort_workspaces and container_wrap_childrenRyan Dwyer
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.
2018-08-18Store geometry in the view and handle any floating view resizingRyan Dwyer
2018-08-18Handle xwayland views sending new sizes in their commitsRyan Dwyer
2018-08-18Fix geometryRyan Dwyer
2018-08-18Add view_get_geometryemersion
2018-08-17Attempt to reap old tiling parent when floating a containerRyan Dwyer
2018-08-16When the workspace is focused, return it instead of checking parentDonnie West
2018-08-15Merge pull request #2458 from RyanDwyer/cleanup-transactionsDrew DeVault
Simplify transactions
2018-08-15Use list_find in more places and refactor/fix workspace prev_next functionsRyan Dwyer
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).
2018-08-15Simplify transactionsRyan Dwyer
Commit 4b8e3a885be74c588291c51f798de80bd81a92db makes it so only one transaction is committed (ie. configures sent) at a time. This commit removes the now-unnecessary code which was used to support concurrent committed transactions. * Instead of containers storing a list of instructions which they've been sent, it now stores a single instruction. * Containers now have an ntxnrefs property. Previously we knew how many references there were by the length of the instruction list. * Instructions no longer need a ready property. It was used to avoid marking an instruction ready twice when they were in a list, but this is now avoided because there is only one instruction and we nullify the container->instruction pointer when it's ready. * When a transaction applies, we no longer need to consider releasing and resaving the surface, as we know there are no other committed transactions. * transaction_notify_view_ready has been renamed to view_notify_view_ready_by_serial to make it consistent with transaction_notify_view_ready_by_size. * Out-of-memory checks have been added when creating transactions and instructions.
2018-08-12Use assigned workspace name for outputminus
Instead of relying on bindings being configured, primarily source new workspace names from workspace-output assignments. Fixes #2435
2018-08-12Fix container_has_ancestor crashRyan Dwyer
Fixes #2450
2018-08-11Merge pull request #2449 from RyanDwyer/remove-bfsDrew DeVault
Remove container_for_each_descendant_bfs
2018-08-11Remove container_for_each_descendant_bfsRyan Dwyer
The function was not used. Also renames container_for_each_descendant_dfs to just container_for_each_descendant.
2018-08-11Remove container_has_childRyan Dwyer
In all cases you can use container_has_ancestor with the arguments swapped, which is faster than container_has_child.
2018-08-08Merge branch 'master' into masterBrian Ashworth
2018-08-08Rename container_at_view to surface_at_view and make it return voidRyan Dwyer
2018-08-08Fix focus when clicking floating decorationsRyan Dwyer
It's not right for container_at_view to only return the swayc if a surface was clicked.
2018-08-08Deny moving a sticky container to workspace if it's the same outputRyan Dwyer
Rationale: Sticky containers are always assigned to the visible workspace. The basic idea here is to check the destination's output (move.c:190). But if the command was `move container to workspace x` then a workspace might have been created for it. We could destroy the workspace in this case, but that results in unnecessary IPC events. To avoid this, the logic for `move container to workspace x` has been adjusted. It now delays creating the workspace until the end, and uses `workspace_get_initial_output` to determine and check the output before creating it.
2018-08-08Fix edge cases when moving floating container to new workspaceRyan Dwyer
* 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.
2018-08-08Implement move to workspace on a floating containerRyan Dwyer
Also adjusts container_floating_translate to not change the current properties directly.
2018-08-07Fix infinite loop when focusing sticky containers via workspace commandRyan Dwyer
In a multi-output setup, if a sticky container is on one output and focus is on the other output, and you run (eg) `workspace 1` to focus the workspace containing the sticky container, an infinite loop would occur. It would loop infinitely because it would remove the sticky container from the workspace, add it back to the same workspace, and then decrement the iterator variable. The fix just wraps the loop in a workspace comparison.
2018-08-06Merge branch 'master' into workspace-move-to-outputBrian Ashworth
2018-08-07Move workspace moving code out of container_move_toRyan Dwyer
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.
2018-08-06commands: fix workspace edge casesIan Fan
2018-08-06commands: check for special workspaces in workspace & move commandsIan Fan
2018-08-06commands: complete workspace implementationIan Fan
Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
2018-08-06commands: fix layout implementation (also better name for previous split layout)Ian Fan
2018-08-06commands: complete move implementationIan Fan
2018-08-05Fix segv when sway is terminatingMariusz Bialonczyk
I've got the following SIGSEGV when terminating sway: ``` Program terminated with signal SIGSEGV, Segmentation fault. 0x00005607dc603af5 in view_unmap (view=0x5607dcb3d350) at ../sway/tree/view.c:599 599 if (surviving_ancestor->type >= C_WORKSPACE) { ``` surviving_ancestor was NULL at that time This commit is trying to fix this problem.
2018-08-04Move workspace pid code to root.cRyan Dwyer
2018-08-04Separate root-related codeRyan Dwyer
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
2018-08-03Check correct ws for sticky and fix floating iterBrian Ashworth
2018-08-03Merge pull request #2414 from RyanDwyer/fix-inactive-fullscreen-crashemersion
Fix crash when fullscreen view closes on inactive workspace
2018-08-03Fix crash when moving cursor over a fullscreen split containerRyan Dwyer
Calling container_at_view fails an assertion if the container isn't a view. Calling tiling_container_at works correctly, as that function checks if the container is a view and calls container_at_view if so.
2018-08-03Fix crash when fullscreen view closes on inactive workspaceRyan Dwyer
When a view unmaps, normally the surviving ancestor (ie. after reaping) needs to be arranged. When a fullscreen view unmaps, it arranges the workspace rather than the surviving ancestor, but didn't handle cases where the workspace itself was reaped. This happens if the workspace is not currently shown and the fullscreen view was the last container on that workspace. This commit rewrites this part of view_unmap so it's more readable, and fixes the crash by not arranging the workspace if it's been reaped. Note that it no longer arranges the output under any circumstance - this wasn't required anyway.
2018-08-02Fix pointer events for fullscreen viewsemersion
2018-08-02Revert "Revert "Fix popups""Ryan Dwyer
This reverts commit 9aa258d33a9baa42895214da7e82f4568fcb8f76. Reverting the revert, so that popups can be fixed.
2018-08-02Revert "Fix popups"Drew DeVault
This reverts commit de86d65627e96cffe77f4abf11c4a0b982326ff9.