swayfx/sway
Ryan Dwyer 701fcafc70 Use list_find in more places and refactor/fix workspace prev_next functions
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-15 15:14:35 +10:00
..
commands Implement resizing tiled containers via cursor 2018-08-12 10:45:54 +10:00
config Allow a fallback color to be specified for swaybg 2018-08-08 15:37:06 -04:00
desktop Don't commit multiple transactions at the same time 2018-08-12 10:45:54 +10:00
input Make mod+resize a floating container resize the container itself 2018-08-12 10:45:54 +10:00
tree Use list_find in more places and refactor/fix workspace prev_next functions 2018-08-15 15:14:35 +10:00
base64.c Rework get_clipboard implementation 2017-07-07 21:51:34 +02:00
commands.c Write to swaynag pipe fd directly on config errors 2018-08-03 10:37:35 -04:00
config.c Remove container_for_each_descendant_bfs 2018-08-11 15:57:09 +10:00
criteria.c Remove container_for_each_descendant_bfs 2018-08-11 15:57:09 +10:00
debug-tree.c Add L_FLOATING back to debug tree 2018-06-01 23:14:58 +10:00
decoration.c Handle views created after decoration mode is sent for xdg-shell 2018-08-06 15:20:30 +01:00
ipc-json.c ipc: add window::mark event 2018-08-01 16:57:15 +01:00
ipc-server.c Remove container_for_each_descendant_bfs 2018-08-11 15:57:09 +10:00
main.c Remove obsolete security sanity check 2018-08-09 08:45:32 -04:00
meson.build Listen to server-decoration mode changes 2018-08-06 15:20:30 +01:00
security.c Add minimal config subsystem 2017-12-05 10:40:55 +01:00
server.c Handle views created after decoration mode is sent for xdg-shell 2018-08-06 15:20:30 +01:00
sway-bar.5.scd Add sway-bar(5) 2018-05-11 21:13:43 -04:00
sway-input.5.scd Escaping underscores in tap_button_map 2018-07-29 14:47:53 +02:00
sway.1.scd delete references to swaygrab 2018-07-30 16:24:46 +01:00
sway.5.scd man: Correct format for output position config 2018-08-11 18:41:31 +02:00
swaynag.c Fix compiler errors. 2018-08-05 00:24:44 -07:00