aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
Commit message (Collapse)AuthorAge
...
* Refactor destroy functions and save workspaces when there's no outputsLibravatar Ryan Dwyer2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Improve new workspace name selectionLibravatar minus2018-08-20
| | | | | | 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.
* Replace hacky L_FLOATING container with a listLibravatar Ryan Dwyer2018-08-19
| | | | | | | | | | | | | | | | 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
* commands: saner workspace number handlingLibravatar Ian Fan2018-08-18
|
* Implement iterators per container typeLibravatar Ryan Dwyer2018-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Rename container_sort_workspaces and container_wrap_childrenLibravatar Ryan Dwyer2018-08-18
| | | | | | | | 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.
* When the workspace is focused, return it instead of checking parentLibravatar Donnie West2018-08-16
|
* Use list_find in more places and refactor/fix workspace prev_next functionsLibravatar Ryan Dwyer2018-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Use assigned workspace name for outputLibravatar minus2018-08-12
| | | | | | | Instead of relying on bindings being configured, primarily source new workspace names from workspace-output assignments. Fixes #2435
* Deny moving a sticky container to workspace if it's the same outputLibravatar Ryan Dwyer2018-08-08
| | | | | | | | | | | | | | | 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.
* Fix infinite loop when focusing sticky containers via workspace commandLibravatar Ryan Dwyer2018-08-07
| | | | | | | | | | | 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.
* commands: check for special workspaces in workspace & move commandsLibravatar Ian Fan2018-08-06
|
* commands: complete workspace implementationLibravatar Ian Fan2018-08-06
| | | | Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
* commands: fix layout implementation (also better name for previous split layout)Libravatar Ian Fan2018-08-06
|
* Move workspace pid code to root.cLibravatar Ryan Dwyer2018-08-04
|
* Check correct ws for sticky and fix floating iterLibravatar Brian Ashworth2018-08-03
|
* Preserve workspace nameLibravatar Mihai Coman2018-07-28
|
* Merge pull request #2165 from swaywm/pid-workspacesLibravatar Drew DeVault2018-07-24
|\ | | | | Implement pid->workspace tracking
| * Address @emersion's review commentsLibravatar Drew DeVault2018-07-24
| |
| * Merge branch 'master' into pid-workspacesLibravatar Drew DeVault2018-07-23
| |\
| * | Implement pid->workspace trackingLibravatar Drew DeVault2018-07-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | When you spawn a process with the exec command, sway now notes the workspace you had focused and the pid of the child process, then assigns that workspace to the child when its window appears. Some of this is carried over from sway 0.15, but with some major refactoring and centralization of state.
* | | Also extract first workspace name from bindcodesLibravatar frsfnrrg2018-07-23
| |/ |/|
* | Render containers as urgent if they have an urgent childLibravatar Ryan Dwyer2018-07-16
| |
* | Mark containers as urgent in IPC if they have urgent viewsLibravatar Ryan Dwyer2018-07-16
| |
* | Update workspace urgent state when views close or move workspacesLibravatar Ryan Dwyer2018-07-16
| |
* | Implement urgency base functionalityLibravatar Ryan Dwyer2018-07-16
| | | | | | | | | | | | Introduces a command to manually set urgency, as well as rendering of urgent views, sending the IPC event, removing urgency after focused for one second, and matching urgent views via criteria.
* | Simplify transactions by utilising a dirty flag on containersLibravatar Ryan Dwyer2018-07-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR changes the way we handle transactions to a more simple method. The new method is to mark containers as dirty from low level code (eg. arranging, or container_destroy, and eventually seat_set_focus), then call transaction_commit_dirty which picks up those containers and runs them through a transaction. The old methods of using transactions (arrange_and_commit, or creating one manually) are now no longer possible. The highest-level code (execute_command and view implementation handlers) will call transaction_commit_dirty, so most other code just needs to set containers as dirty. This is done by arranging, but can also be done by calling container_set_dirty.
* | Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
| |
* | workspace_next_name: free targets later than these already found in orderLibravatar Dominique Martinet2018-07-05
| |
* | workspace_next_name: fix string length for ws_num >= 100Libravatar Dominique Martinet2018-07-02
| | | | | | | | | | | | | | | | | | | | | | The check didn't include && ws_num < 100 so l would always be 1 or 2 Instead of fixing logic it's simpler to just call snprintf twice to get length and use that. Also change malloc failure check to sway_assert because both callers of this function do not do null check and would segfault... Found through static analysis.
* | find prev/next output/workspace: add NULL checkLibravatar Dominique Martinet2018-07-02
|/ | | | | | These could be called with NULL if there is no focus Found through static analysis.
* Implement atomic layout updates for tree operationsLibravatar Ryan Dwyer2018-06-23
| | | | | This implements atomic layout updates for when views map, reparent or unmap.
* Refactor everything that needs to arrange windowsLibravatar Ryan Dwyer2018-06-09
| | | | | | | | | | * The arrange_foo functions are now replaced with arrange_and_commit, or with manually created transactions and arrange_windows x2. * The arrange functions are now only called from the highest level functions rather than from both high level and low level functions. * Due to the previous point, view_set_fullscreen_raw and view_set_fullscreen are both merged into one function again. * Floating and fullscreen are now working with transactions.
* Make main properties be the pending stateLibravatar Ryan Dwyer2018-06-09
|
* WIP: Atomic layout updates ground workLibravatar Ryan Dwyer2018-06-09
|
* Restore workspaces to outputs based on priorityLibravatar Brian Ashworth2018-06-08
|
* Support runtime var expansion and set at runtimeLibravatar Brian Ashworth2018-06-05
|
* Fix issues with sticky containers and workspacesLibravatar Ryan Dwyer2018-06-01
| | | | | | | | | * Attach sticky containers to new workspaces when switching * Fire the close event *before* we start destroying the workspace to prevent a crash Because the sticky container now follows the visible workspace, this simplifies the rendering and container_at logic.
* Use L_FLOATING instead of reapable booleanLibravatar Ryan Dwyer2018-06-01
|
* Implement floatingLibravatar Ryan Dwyer2018-06-01
|
* Implement `floating enable`Libravatar Drew DeVault2018-06-01
|
* Refactor arrange_windows()Libravatar Ryan Dwyer2018-04-28
| | | | | | | | | Replaces arrange_windows() with arrange_root(), arrange_output(), arrange_workspace() and arrange_children_of(). Also makes fullscreen views save and restore their dimensions, which allows it to preserve any custom resize and is also a requirement for floating views once they are implemented.
* Remove sway_container.workspace_layoutLibravatar Ryan Dwyer2018-04-26
| | | | Fixes #1716.
* Create sway_workspace struct.Libravatar Ryan Dwyer2018-04-17
|
* Revert "Break everything^W^WUse wlr_box for sway_container"Libravatar Drew DeVault2018-04-06
|
* Break everything^W^WUse wlr_box for sway_containerLibravatar Drew DeVault2018-04-06
|
* Merge branch 'wlroots' into split-containers2Libravatar Tony Crisci2018-04-04
|\
| * Merge pull request #1712 from RedSoxFan/workspace-number-namesLibravatar Drew DeVault2018-04-03
| |\ | | | | | | Fix name generation from workspace number commands
| | * Fix name generation for workspace number <name>Libravatar Brian Ashworth2018-04-03
| | |
* | | move workspace create to workspace.cLibravatar Tony Crisci2018-04-03
| | |