Commit graph

4387 commits

Author SHA1 Message Date
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
Drew DeVault 6f0bc469e9
Merge pull request #2432 from RyanDwyer/fix-move-crash
Fix crash when running `move container to workspace back_and_forth`
2018-08-07 10:27:45 -04:00
Drew DeVault 84845adb8e
Merge pull request #2433 from RyanDwyer/fix-sticky-infinite-loop
Fix infinite loop when focusing sticky containers via workspace command
2018-08-07 10:27:25 -04:00
Ryan Dwyer 50f3a7ff5c Fix infinite loop when focusing sticky containers via workspace command
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-07 23:32:25 +10:00
Ryan Dwyer 5ac6f2f429 Fix crash when running move container to workspace back_and_forth
The back_and_forth condition is intended to be handled in the else-if
block, but this was never reached because it remained in the first
block's conditions.
2018-08-07 23:04:21 +10:00