Commit graph

902 commits

Author SHA1 Message Date
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 2aa6d98c5a
Merge pull request #2449 from RyanDwyer/remove-bfs
Remove container_for_each_descendant_bfs
2018-08-11 08:29:34 -04: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
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
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 d8b65193c4
Merge pull request #2268 from emersion/server-decoration-borders
Enable borders on floating SSD xdg-shell views
2018-08-06 11:32:17 -04:00
emersion 9d578e0a0f Handle views created after decoration mode is sent for xdg-shell 2018-08-06 15:20:30 +01:00
emersion 700941dde8 Listen to server-decoration mode changes 2018-08-06 15:20:30 +01:00
Ian Fan 85ae121caa commands: complete workspace implementation
Allow optional --no-auto-back-and-forth flag, as well as refactoring some logic
2018-08-06 14:17:58 +01:00
Ian Fan 356063b6c0 commands: fix layout implementation (also better name for previous split layout) 2018-08-06 14:17:58 +01:00
Ian Fan 69e1a421fc commands: complete move implementation 2018-08-06 14:17:58 +01:00
Ryan Dwyer 30e7e0f7c7 Move workspace pid code to root.c 2018-08-04 14:01:49 +10:00
Ryan Dwyer 04489ff420 Separate root-related code
This creates a root.c and moves bits and pieces from elsewhere into it.

* layout_init has been renamed to root_create and moved into root.c
* root_destroy has been created and is called on shutdown
* scratchpad code has been moved into root.c, because hidden scratchpad
containers are stored in the root struct
2018-08-04 14:01:20 +10:00
Brian Ashworth 36fd84cc42 Remove swaynag_clone and use memcpy 2018-08-03 10:40:09 -04:00
Brian Ashworth a7f7d4a488 Write to swaynag pipe fd directly on config errors 2018-08-03 10:37:35 -04:00
Brian Ashworth f9a6407111 Show swaynag on config errors 2018-08-03 10:37:35 -04:00
Ryan Dwyer c17f0870ef Fix crash when moving cursor over a fullscreen split container
Calling container_at_view fails an assertion if the container isn't a
view. Calling tiling_container_at works correctly, as that function
checks if the container is a view and calls container_at_view if so.
2018-08-03 18:08:20 +10:00
emersion b336564511 Fix pointer events for fullscreen views 2018-08-02 22:48:43 +01:00
Ryan Dwyer 8392eae40f Revert "Revert "Fix popups""
This reverts commit 9aa258d33a.

Reverting the revert, so that popups can be fixed.
2018-08-02 23:36:36 +10:00
Drew DeVault ea14ef4095
Merge pull request #2366 from RedSoxFan/nagbar
Implement swaynag
2018-08-02 09:28:13 -04:00
Ryan Dwyer 706c0fbe23
Merge branch 'master' into nagbar 2018-08-02 23:05:49 +10:00
Drew DeVault 9aa258d33a Revert "Fix popups"
This reverts commit de86d65627.
2018-08-02 09:05:46 -04:00
emersion 47bf4ed0cb
Merge branch 'master' into fix-resize-wiggle 2018-08-02 08:11:10 +01:00
Brian Ashworth 4f5cf330c8 swaynag: address some more of sircmpwn's comments
Fixes segfauls for any case where swaynag->outputs was not inititalized
including -h/--help, -v/--version, and invalid arguments.

Sets sane defaults for colors not given. Any color not given will
fallback to the default color values for type error.

Adds support for a hidpi cursor
2018-08-01 22:47:54 -04:00
Brian Ashworth 0ef3988438 swaynag: fix hidpi 2018-08-01 22:47:54 -04:00
Brian Ashworth e01acb6097 swaynag: allow more config options 2018-08-01 22:47:54 -04:00
Brian Ashworth a6145914c6 swaynag: refactor {sway_,}nagbar to swaynag 2018-08-01 22:47:54 -04:00
Brian Ashworth 6124d0f9a2 swaynag: split config into own file and fix optind 2018-08-01 22:47:54 -04:00
Brian Ashworth 8463a2896a swaynag: implement config file support 2018-08-01 22:47:54 -04:00
Brian Ashworth a4f7bf23b2 Address first round review for swaynag 2018-08-01 22:47:54 -04:00
Brian Ashworth 72db10c2f1 Support a detailed message in swaynagbar 2018-08-01 22:47:54 -04:00
Brian Ashworth 88bc4b528e Implements swaynagbar 2018-08-01 22:47:54 -04:00
Drew DeVault 9564c73c0d
Merge pull request #2391 from RyanDwyer/fix-popups-v2
Fix popups (v2)
2018-08-01 22:02:12 -04:00
Ian Fan 46cfa8ff56 ipc: remove extraneous values
Removes IPC_EVENT_MODIFIER and IPC_EVENT_INPUT, which were sway-specific and unused
2018-08-01 16:57:15 +01:00
Ian Fan 03eaf444a4 ipc: prevent emitting a workspace::focus event when moving a container to a different workspace or output
When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
2018-08-01 16:57:15 +01:00
Ian Fan 3edaf2ce2a ipc: add tick event 2018-08-01 16:57:15 +01:00
Ian Fan 6865b8aae9 ipc: add binding event 2018-08-01 16:57:15 +01:00
Ian Fan 317217f2c8 ipc: add window::mark event 2018-08-01 16:57:15 +01:00
Ian Fan e8b179e313 ipc: add shutdown event 2018-08-01 16:57:14 +01:00
Ryan Dwyer d10ccc1eb1 Correctly track saved surfaces during multiple transactions
Fixes #2364.

Suppose a view is 600px wide, and we tell it to resize to 601px during a
resize operation. We create a transaction, save the 600px buffer and
send the configure. This buffer is saved into the associated
instruction, and is rendered while we wait for the view to commit a
601px buffer.

Before the view commits the 601px buffer, suppose we tell it to resize
to 602px. The new transaction will also save the buffer, but it's still
the 600px buffer because we haven't received a new one yet.

Then suppose the view commits its original 601px buffer. This completes
the first transaction, so we apply the 601px width to the container.
There's still the second (now only) transaction remaining, so we render
the saved buffer from that. But this is still the 600px buffer, and we
believe it's 601px. Whoops.

The problem here is we can't stack buffers like this. So this commit
removes the saved buffer from the instructions, places it in the view
instead, and re-saves the latest buffer every time the view completes a
transaction and still has further pending transactions.

As saved buffers are now specific to views rather than instructions, the
functions for saving and removing the saved buffer have been moved to
view.c.

The calls to save and restore the buffer have been relocated to more
appropriate functions too, favouring transaction_commit and
transaction_apply rather than transaction_add_container and
transaction_destroy.
2018-08-01 16:24:15 +10:00
Ryan Dwyer 7a59508da4 Close popups when changing focus
Also reverts the send frame done changes from the previous commit.
2018-07-31 19:58:34 +10:00
Ryan Dwyer de86d65627 Fix popups
Fixes the render and container_at order for popups.

Fixes #2210

For rendering:

* render_view_surfaces has been renamed to render_view_toplevels
* render_view_toplevels now uses output_surface_for_each_surface (which
is now public), as that function uses wlr_surface_for_each_surface which
doesn't descend into popups
* Views now have a for_each_popup iterator, which is used by the
renderer to render the focused view's popups
* When rendering a popup, toplevels (xdg subsurfaces) of that popup are
also rendered

For sending frame done, the logic has been updated to match the
rendering logic:

* send_frame_done_container no longer descends into popups
* for_each_popup is used to send frame done to the focused view's popups
and their child toplevels

For container_at:

* floating_container_at is now static, which means it had to be moved
higher in the file.
* container_at now considers popups for the focused view before checking
containers.
* tiling_container_at has been introduced, so that it doesn't call
container_at recursively (it would check popups recursively if it did)
2018-07-31 18:41:30 +10:00
Drew DeVault cbd0c3ec40
Merge pull request #2367 from emersion/iterator-redesign
Refactor surface iterators
2018-07-30 13:12:22 -04:00
Drew DeVault 6c30b3fcc8
Merge pull request #2381 from frsfnrrg/key-repeat
Implement key repeat for keybindings
2018-07-30 13:10:56 -04:00
Eric Engestrom 52a27f1529 delete references to swaygrab 2018-07-30 16:24:46 +01:00
Eric Engestrom c6a6faaeae util.h: add missing include
parse_boolean() takes and returns a `bool`
2018-07-30 15:21:52 +01:00
Brian Ashworth b8efdeae29 Fix title textures on scale change 2018-07-30 01:59:20 -04:00