Commit graph

4400 commits

Author SHA1 Message Date
Ryan Dwyer 982a2d0c99 Fix geometry 2018-08-18 10:39:38 +10:00
emersion b3ee9af0c8 Add view_get_geometry 2018-08-18 10:39:38 +10:00
Drew DeVault db4b4935b3
Merge pull request #2472 from RyanDwyer/refactor-seat-get-focus
Refactor seat_get_focus functions
2018-08-17 09:53:28 -04:00
emersion 754bbd03c0
Merge pull request #2471 from RyanDwyer/reap-when-floating
Attempt to reap old tiling parent when floating a container
2018-08-17 13:37:39 +01:00
emersion 782d0e087e
Merge pull request #2474 from RyanDwyer/transactionise-csd
Add using_csd variable to transaction state
2018-08-17 13:33:21 +01:00
Ryan Dwyer 1801b725e2 Add using_csd variable to transaction state
This fixes a race condition flicker when unfloating a view which uses
client side decorations.

When the view is floated it has using_csd = true, so the decorations are
not drawn. When unfloating it it changes to false, but this change
wasn't part of transactions so it could potentially render the
decorations around the view while it's waiting for the transaction to
apply.
2018-08-17 20:25:33 +10:00
Ryan Dwyer 3a888163a0 Refactor seat_get_focus functions
Fixes #2467.

This commit introduces seat_get_focus_inactive_floating to supplement
seat_get_focus_inactive_tiling, and uses it during `focus mode_toggle`
which fixes a focus bug.

This also refactors the seat_get_focus_inactive functions so that they
do their selection logic themselves rather than offloading it to
seat_get_focus_by_type which was getting bloated. seat_get_focus_by_type
is now removed.

Lastly, this commit changes seat_get_focus to just return the first
container in the focus stack rather than looping and calling
seat_get_focus_by_type.
2018-08-17 17:32:53 +10:00
Ryan Dwyer 6a26b499a4 Attempt to reap old tiling parent when floating a container 2018-08-17 16:23:37 +10:00
Ryan Dwyer 32193c7e4d
Merge pull request #2465 from DonnieWest/master
Default to the previous workspace if the current one has no focused windows
2018-08-17 10:04:03 +10:00
Donnie West a9433cbded
When the workspace is focused, return it instead of checking parent 2018-08-16 18:52:40 -05: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