Commit graph

5491 commits

Author SHA1 Message Date
Ian Fan 1fd62d3e0c Fix swaylock zsh completions 2018-08-16 23:21:30 +01:00
Drew DeVault 98ed05225e
Merge pull request #2458 from RyanDwyer/cleanup-transactions
Simplify transactions
2018-08-15 17:16:32 -04:00
emersion 647ace1d6d
Merge pull request #2459 from RyanDwyer/fix-workspace-prev-next
Use list_find in more places and refactor/fix workspace prev_next functions
2018-08-15 22:11:34 +01:00
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
Ryan Dwyer c3ef36d6b5 Simplify transactions
Commit 4b8e3a885b 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-15 10:03:55 +10:00
Drew DeVault b4887ba154
Merge pull request #2445 from RyanDwyer/resize-tiling-via-cursor
Implement resizing tiled containers via cursor
2018-08-14 09:07:59 -04:00
emersion d0fb2d9a53
Merge pull request #2454 from minus7/workspace-names
Use assigned workspace name for output
2018-08-13 22:17:38 +01:00
minus 18e425eda6 Use assigned workspace name for output
Instead of relying on bindings being configured, primarily source
new workspace names from workspace-output assignments.

Fixes #2435
2018-08-12 14:41:41 +02:00
Ryan Dwyer 4b8e3a885b Don't commit multiple transactions at the same time 2018-08-12 10:45:54 +10:00
Ryan Dwyer e7a7306063 Don't progress transaction queue if any are partially complete
This fixes an issue where views might commit to a transaction ahead of
the first one, and applying the first transaction causes us to save a
buffer of the wrong size.
2018-08-12 10:45:54 +10:00
Ryan Dwyer 4d023c0390 Make mod+resize a floating container resize the container itself
Rather than resizing the split within the container.
2018-08-12 10:45:54 +10:00
Ryan Dwyer e9d46ccbdd Use col-resize and row-resize cursor images 2018-08-12 10:45:54 +10:00
Ryan Dwyer 1893515d3a Fix right-click/popups and add state checks 2018-08-12 10:45:54 +10:00
Ryan Dwyer 2dceae6224 Allow resizing tiled views via mod key 2018-08-12 10:45:54 +10:00
Ryan Dwyer f4280e506b Refactor dispatch_cursor_button
There was a separate function dispatch_cursor_button_floating which
dealt with the resize and move operations, but as resize is not really
limited to floating views, it doesn't make as much sense to have this
separate. So both functions are now combined into one.

Additionally, dispatch_cursor_button now uses a pattern of returning
early instead of using else-ifs.
2018-08-12 10:45:54 +10:00
Ryan Dwyer b4a0363d17 Implement resizing tiled containers via cursor
* The OP_RESIZE seat operation has been renamed to OP_RESIZE_FLOATING,
and OP_RESIZE_TILING has been introduced.
* Similar to the above, seat_begin_resize and handle_resize_motion have
been renamed and tiling variants introduced.
* resize.c's resize_tiled has to be used, so container_resize_tiled has
been introduced in resize.c to allow external code to call it.
2018-08-12 10:45:54 +10:00
Drew DeVault 146cc0a441
Merge pull request #2452 from janza/position-command-fix-args
Man page: Correct argument format for output position config
2018-08-11 19:08:01 -04:00
Josip Janzic 5aca2b42e6
man: Correct format for output position config 2018-08-11 18:41:31 +02:00
Drew DeVault b6428f4751
Merge pull request #2451 from RyanDwyer/fix-ancestor-crash
Fix container_has_ancestor crash
2018-08-11 10:28:05 -04:00
Ryan Dwyer 5f3757c927 Fix container_has_ancestor crash
Fixes #2450
2018-08-12 00:14:52 +10:00
Drew DeVault 2aa6d98c5a
Merge pull request #2449 from RyanDwyer/remove-bfs
Remove container_for_each_descendant_bfs
2018-08-11 08:29:34 -04:00
emersion 9545c70928
Merge pull request #2448 from RyanDwyer/remove-container-has-child
Remove container_has_child
2018-08-11 08:44:11 +01:00
Ryan Dwyer 4ad1ccc9dc Remove container_for_each_descendant_bfs
The function was not used.

Also renames container_for_each_descendant_dfs to just
container_for_each_descendant.
2018-08-11 15:57:09 +10:00
Ryan Dwyer 31844bf42b Remove container_has_child
In all cases you can use container_has_ancestor with the arguments
swapped, which is faster than container_has_child.
2018-08-11 15:36:19 +10:00
emersion e474d87e42
Merge pull request #2447 from ianyfan/swaynag-leak
Fix memory leak in swaynag
2018-08-10 18:53:18 +01:00
Ian Fan 6e7052fc44 swaynag: destroy old cursor theme when updated 2018-08-10 18:34:23 +01:00
Drew DeVault c7e99ee0d4
Merge pull request #2446 from emersion/xwayland-unmanaged-order
xwayland: fix unmanaged surfaces order
2018-08-10 09:46:08 -04:00
emersion d1433c637a xwayland: fix unmanaged surfaces order 2018-08-10 12:47:24 +01:00
Brian Ashworth df1aeed6c2
Merge pull request #2441 from RyanDwyer/finish-resize-commands
Finish resize commands
2018-08-09 20:04:33 -04:00
Ryan Dwyer af693cba26 Update resize documentation 2018-08-10 08:50:38 +10:00
Ryan Dwyer 6c730a2cb2 Implement resize set <width> <height> for tiled containers
Unlike i3, this implementation allows px measurements.

Also fixes a sane size check.
2018-08-10 08:50:15 +10:00
Ryan Dwyer 9395d3c93c Implement resize grow|shrink <direction> <amount> for tiled containers 2018-08-10 08:50:15 +10:00
Drew DeVault db0fa066e5 Remove obsolete security sanity check 2018-08-09 08:45:32 -04:00
Drew DeVault 425ee270b4
Merge pull request #2440 from RedSoxFan/bg-swaynag-reading-only
Don't call swaynag_log for bg when not reading
2018-08-08 17:21:22 -04:00
Brian Ashworth b6f4623551 Don't call swaynag_log for bg when not reading 2018-08-08 17:04:12 -04:00
Drew DeVault 78c0f013dd
Merge pull request #2439 from RedSoxFan/fix-2434
Allow a fallback color to be specified for swaybg
2018-08-08 16:42:33 -04:00
Brian Ashworth 43d1ffc9dd Allow a fallback color to be specified for swaybg
This allows for a color to be set when the wallpaper does not fill the
entire output. If specified, the fallback color is also used when the
image path is inaccessible.
2018-08-08 15:37:06 -04:00
Brian Ashworth fc039f0759
Merge pull request #2423 from manio/master
[RFC] Fix segv when sway is terminating
2018-08-08 15:36:17 -04:00
Brian Ashworth 3c26536267
Merge branch 'master' into master 2018-08-08 15:26:44 -04:00
Drew DeVault e28101e6e1 私の日本語が上手じゃないですね 2018-08-08 11:53:11 -04:00
Drew DeVault 1c7a6a49b6 Remove setcap instructions
These are obsolete, we don't require them anymore.
2018-08-08 11:40:33 -04:00
emersion 89e176d3fb
Merge pull request #2436 from RyanDwyer/fix-floating-deco-focus
Fix focus when clicking floating decorations
2018-08-08 13:49:00 +01:00
Ryan Dwyer f5dc3ac09d Don't call send_pointer_notify_button when doing move or resize 2018-08-08 22:32:59 +10:00
Ryan Dwyer 4c5dc6f135 Focus floating views when beginning move/resize operations 2018-08-08 22:28:13 +10:00
Ryan Dwyer a0ece6f956 Rename container_at_view to surface_at_view and make it return void 2018-08-08 22:28:13 +10:00
Ryan Dwyer 1e984fec05 Fix focus when clicking floating decorations
It's not right for container_at_view to only return the swayc if a
surface was clicked.
2018-08-08 22:28:13 +10:00
Drew DeVault c8a8216629
Merge pull request #2420 from RyanDwyer/floating-move-to-workspace
Implement move to workspace on a floating container
2018-08-08 08:13:22 -04:00
Ryan Dwyer 5653fc754b Deny moving a sticky container to workspace if it's the same output
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-08 12:50:42 +10:00
Ryan Dwyer a0649190de Fix edge cases when moving floating container to new workspace
* 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-08 08:48:20 +10:00
Ryan Dwyer 36281609ea Implement move to workspace on a floating container
Also adjusts container_floating_translate to not change the current
properties directly.
2018-08-08 08:48:20 +10:00