Commit graph

997 commits

Author SHA1 Message Date
Ryan Dwyer 7586f150c0 Implement type safe arguments and demote sway_container
This commit changes the meaning of sway_container so that it only refers
to layout containers and view containers. Workspaces, outputs and the
root are no longer known as containers. Instead, root, outputs,
workspaces and containers are all a type of node, and containers come in
two types: layout containers and view containers.

In addition to the above, this implements type safe variables. This
means we use specific types such as sway_output and sway_workspace
instead of generic containers or nodes. However, it's worth noting that
in a few places places (eg. seat focus and transactions) referring to
them in a generic way is unavoidable which is why we still use nodes in
some places.

If you want a TL;DR, look at node.h, as well as the struct definitions
for root, output, workspace and container. Note that sway_output now
contains a workspaces list, and workspaces now contain a tiling and
floating list, and containers now contain a pointer back to the
workspace.

There are now functions for seat_get_focused_workspace and
seat_get_focused_container. The latter will return NULL if a workspace
itself is focused. Most other seat functions like seat_get_focus and
seat_set_focus now accept and return nodes.

In the config->handler_context struct, current_container has been
replaced with three pointers: node, container and workspace. node is the
same as what current_container was, while workspace is the workspace
that the node resides on and container is the actual container, which
may be NULL if a workspace itself is focused.

The global root_container variable has been replaced with one simply
called root, which is a pointer to the sway_root instance.

The way outputs are created, enabled, disabled and destroyed has
changed. Previously we'd wrap the sway_output in a container when it is
enabled, but as we don't have containers any more it needs a different
approach. The output_create and output_destroy functions previously
created/destroyed the container, but now they create/destroy the
sway_output. There is a new function output_disable to disable an output
without destroying it.

Containers have a new view property. If this is populated then the
container is a view container, otherwise it's a layout container. Like
before, this property is immutable for the life of the container.

Containers have both a `sway_container *parent` and
`sway_workspace *workspace`. As we use specific types now, parent cannot
point to a workspace so it'll be NULL for containers which are direct
children of the workspace. The workspace property is set for all
containers, except those which are hidden in the scratchpad as they have
no workspace.

In some cases we need to refer to workspaces in a container-like way.
For example, workspaces have layout and children, but when using
specific types this makes it difficult. Likewise, it's difficult for a
container to get its parent's layout when the parent could be another
container or a workspace. To make it easier, some helper functions have
been created: container_parent_layout and container_get_siblings.

container_remove_child has been renamed to container_detach and
container_replace_child has been renamed to container_replace.

`container_handle_fullscreen_reparent(con, old_parent)` has had the
old_parent removed. We now unfullscreen the workspace when detaching the
container, so this function is simplified and only needs one argument
now.

container_notify_subtree_changed has been renamed to
container_update_representation. This is more descriptive of its
purpose. I also wanted to be able to call it with whatever container was
changed rather than the container's parent, which makes bubbling up to
the workspace easier.

There are now state structs per node thing. ie. sway_output_state,
sway_workspace_state and sway_container_state.

The focus, move and layout commands have been completely refactored to
work with the specific types. I considered making these a separate PR,
but I'd be backporting my changes only to replace them again, and it's
easier just to test everything at once.
2018-09-05 18:01:43 +10:00
Ryan Dwyer 7797490e9e Deny repeating reload by holding key
Fixes #2568

The binding that gets stored in the keyboard's `repeat_binding` would
get freed on reload, leaving a dangling pointer.

Rather than attempt to unset the keyboard's `repeat_binding` along with
the other bindings, I opted to just not set it for the reload command
because there's no point in reloading repeatedly by holding the binding.
This disables repeat bindings for the reload command.

As we now need to detect whether it's a reload command in two places,
I've added a binding flag to track whether it's a reload or not.
2018-09-04 20:00:04 +10:00
Ryan Dwyer 29f5cc7508 Implement window_role criteria token
Depends on https://github.com/swaywm/wlroots/pull/1226
2018-09-04 08:23:50 +10:00
Pascal Pascher 93673095f0 move criteria "instance", "class" and "window_role" inside HAVE_XWAYLAND ifdefs" 2018-09-03 14:25:48 +02:00
Pascal Pascher 587e320cd8 Fixed window_type with disabled xwayland support. 2018-09-03 11:13:50 +02:00
Ryan Dwyer 6fb03817c9 Rename fowa enum and use switch in view_request_activate 2018-09-02 18:25:45 +10:00
Ryan Dwyer f057a0195e Implement focus_on_window_activation
Depends on https://github.com/swaywm/wlroots/pull/1223
2018-09-02 18:20:34 +10:00
Drew DeVault 89a045835f
Merge pull request #2547 from RyanDwyer/fix-reload-crash
Fix crash on reload
2018-09-01 10:39:36 -04:00
Ryan Dwyer f4ec308376 Implement window_type criteria token 2018-09-01 23:04:49 +10:00
Ryan Dwyer 7e81e58e7d Allow reload command to exist anywhere in the command string
This fixes a crash if you have commands where reload appears in the
middle or at the end, such as `bindsym r mode default, reload`.
2018-09-01 11:45:48 +10:00
Ryan Dwyer f5b9815128 Prepare arrange code for type safe arguments
This commit changes the arrange code in a way that will support type
safe arguments.

The arrange_output et al functions are now public, however I opted not
to use them directly yet. I've kept the generic arrange_windows there
for convenience until type safety is fully implemented. This means this
patch has much less risk of breaking things as it would otherwise.

To be type safe, arrange_children_of cannot exist in its previous form
because the thing passed to it could be either a workspace or a
container. So it's now renamed to arrange_children and accepts a list_t,
as well as the parent layout and parent's box.

There was some code which checked the grandparent's layout to see if it
was tabbed or stacked and adjusted the Y offset of the grandchild
accordingly. Accessing the grandparent layout isn't easy when using type
safe arguments, and it seemed odd to even need to do this. I determined
that this was needed because a child of a tabbed container would have a
swayc Y matching the top of the tab bar. I've changed this so a child of
a tabbed container will have a swayc Y matching the bottom of the tab
bar, which means we don't need to access the grandparent layout.  Some
tweaks to the rendering and autoconfigure code have been made to
implement this, and the container_at code appears to work without
needing any changes.

arrange_children_of (now arrange_children) would check if the parent had
gaps and would copy them to the child, effectively making the
workspace's gaps recurse into all children. We can't do this any more
without passing has_gaps, gaps_inner and gaps_outer as arguments to
arrange_children, so I've changed the add_gaps function to retrieve it
from the workspace directly.

apply_tabbed_or_stacked_layout has been split into two functions, as it
had different logic depending on the layout.

Lastly, arrange.h had an unnecessary include of transaction.h. I've
removed it, which means I've had to add it to several other files.
2018-08-28 23:50:41 +10:00
Drew DeVault 10c2c09cf6
Merge pull request #2513 from RyanDwyer/rename-root-outputs
Rename sway_root.outputs to sway_root.all_outputs
2018-08-26 10:50:02 -04:00
Ryan Dwyer 5dbbab7bdc Remove layout.c
When we have type safety we'll need to have functions for
workspace_add_tiling and so on. This means the existing container
functions will be just for containers, so they are being moved to
container.c. At this point layout.c doesn't contain much else, so I've
relocated everything and removed the file.

* container_swap and its static functions have been moved to the swap
command and made static.
* container_recursive_resize has been moved to the resize command and
made static.
* The following have been moved to container.c:
    * container_handle_fullscreen_reparent
    * container_insert_child
    * container_add_sibling
    * container_add_child
    * container_remove_child
    * container_replace_child
    * container_split
* enum movement_direction and sway_dir_to_wlr have been moved to util.c.

Side note: Several commands included layout.h which then included
root.h. With layout.h gone, root.h has to be included by those commands.
2018-08-26 12:05:16 +10:00
Ryan Dwyer 8bed4be1f3 Make separate gaps functions per container type
In preparation for using type safety.
2018-08-26 09:52:12 +10:00
Ryan Dwyer 1e024b91fa Add comment for sway_root.all_outputs 2018-08-25 23:42:04 +10:00
Ryan Dwyer 2e7401772e Rename sway_root.outputs to sway_root.all_outputs
This list includes disabled outputs.

When sway_container is demoted, we'll need to store the root's children
(ie. enabled outputs) in the sway_root. It makes sense to put these in a
list called `outputs`, so I'm renaming the existing list in advance.
2018-08-25 23:41:11 +10:00
Ryan Dwyer f4bc25bcc6 Relocate container_move, container_move_to and container_get_in_direction
* container_move is only called from the move command
* container_move_to was called from both the move command and the sticky
command, but the sticky command can easily not call it
* container_get_in_direction is only called from the focus command

Moving these functions to their respective commands gives better
separation of code and removes bloat from layout.c. These functions will
need to be refactored to take advantage of type safety, so separating
them will make this easier to refactor.

The following static functions have also been moved:

* is_parellel
* invert_movement
* move_offs
* container_limit
* workspace_rejigger
* move_out_of_tabs_stacks
* get_swayc_in_output_direction

They were all used by the move functions, except for the last one which
is used by focus.

Other changes:

* index_child has been renamed to container_sibling_index, moved to
container.c and made public
* sway_output_from_wlr has been renamed to output_from_wlr_output, moved
to output.c and made public
* container_handle_fullscreen_reparent has been made public
* sway_dir_to_wlr has been made public

No changes have been made to any of the moved functions, other than
updating calls to functions that have been renamed.
2018-08-25 12:09:42 +10:00
Ryan Dwyer b6058703fa Refactor destroy functions and save workspaces when there's no outputs
This changes the destroy functions to the following:

* output_begin_destroy
* output_destroy
* workspace_begin_destroy
* workspace_destroy
* container_begin_destroy
* container_destroy
* view_begin_destroy
* view_destroy

The terminology was `destroy` and `free`, and it has been changed to
`begin_destroy` and `destroy` respectively.

When the last output is disconnected, its workspaces will now be stashed
in the root. Upon connection of a new output they will be restored.

There is a new function `workspace_consider_destroy` which decides
whether the given workspace should be destroyed or not (ie. empty and
not visible).

Calling container_begin_destroy will no longer automatically reap the
parents. In some places we want to reap the parents and in some we
don't, so this is left to the caller.

container_reap_empty_recursive and container_reap_empty have been
combined into one function and it will recurse up the tree.
2018-08-24 22:17:28 +10:00
Ryan Dwyer f129b1b89f Replace enum resize_edge with wlr_edges 2018-08-21 12:41:57 +10:00
Brian Ashworth f0d21c46dd Fix bad-free in swaynag 2018-08-20 15:06:12 -04:00
Ryan Dwyer e1955c5c08 Fix crash when adding output 2018-08-20 10:37:52 +10:00
Ryan Dwyer 0f6d212629 Send output enter/leave events correctly
Previously we used a reparent event to detect when a view changes
parent, then sent an output enter/leave to the surfaces if needed. This
worked for tiling views but not floating views, as floating views can
intersect another output without changing parent.

The solution implemented for floating views also applies cleanly to
tiling views, so the previous method has been completely replaced and
the reparent event has been removed.

This introduces a new function container_discover_outputs. This function
compares the container's `current` position to the outputs, sends enter
and leave events as needed, and keeps track of which outputs it's
intersecting in a new `container->outputs` list. If it has entered a new
output with a different scale then the title and marks textures will
also be recreated at the new scale.

The function is called when a transaction applies. This is convenient as
it means we don't have to call it from various places.

There is imperfect rendering when a floating view overlaps two outputs
with different scales. It renders correctly for the most recently
entered output, but there is only one title texture so it renders
incorrectly on the old output.

Fixes #2482
2018-08-20 09:23:24 +10:00
Drew DeVault 9f913614ca
Merge pull request #2478 from RyanDwyer/standardise-debug
Standardise debug variables
2018-08-19 10:29:29 -04:00
Ryan Dwyer 2b5a404ac9 Replace hacky L_FLOATING container with a list
Workspaces previously had a magical `workspace->floating` container,
which had a layout of L_FLOATING and whose children were actual floating
views. This allowed some conveniences, but was a hacky solution because
the container has to be exempt from focus, coordinate transactions with
the workspace, and omit emitting IPC events (which we didn't do).

This commit changes it to be a list directly in the sway_workspace. The
L_FLOATING layout is no longer used so this has been removed as well.

* Fixes incorrect check in the swap command (it checked if the
containers had the L_FLOATING layout, but this layout applied to the
magical container).
* Introduces workspace_add_floating
2018-08-19 16:18:33 +10:00
Ryan Dwyer f9563d88f3 Use enum for damage debug options 2018-08-19 16:17:24 +10:00
Ryan Dwyer 8d1dd03823 Standardise debug variables
This makes all debug options stored in a single struct rather than in
various places, changes/fixes the behaviour of existing options, and
introduces some new options.

* Fixes damage issues with `-Drender-tree` texture (by removing scissor)
* Offsets the render tree overlay's `y` position for those who have
swaybar at the top
* Replaces `-Ddamage=rerender` with `-Dnodamage`
* Replaces `-Ddamage=highlight` with `-Dhighlight-damage`
* Replaces `-Dtxn-debug` with `-Dtxn-wait`
* Introduces `-Dnoatomic`
* Removes the `create_time` and `ms_arranging` figures from transactions
and the log message. Transactions are created after arranging and the
create time is of no significance.
* Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working.
2018-08-19 16:17:24 +10:00
Ryan Dwyer 7f22fab389
Merge branch 'master' into commands 2018-08-19 16:07:11 +10:00
Drew DeVault d0a24465d7
Merge pull request #2466 from RyanDwyer/geometry
Fix geometry
2018-08-18 19:26:36 -04:00
Ian Fan 23601a8771 commands: complete assign command 2018-08-18 17:25:06 +01:00
Ian Fan c1af79532f commands: add nop 2018-08-18 15:50:26 +01:00
Ryan Dwyer d6cd79c342 Implement iterators per container type
This introduces the following `for_each` functions:

* root_for_each_workspace
* root_for_each_container
* output_for_each_workspace
* output_for_each_container
* workspace_for_each_container

And introduces the following `find` functions:

* root_find_output
* root_find_workspace
* root_find_container
* output_find_workspace
* output_find_container
* workspace_find_container
* container_find_child

And removes the following functions:

* container_descendants
* container_for_each_descendant
* container_find

This change is preparing the way for demoting sway_container. Eventually
these functions will accept and return sway_outputs, sway_workspaces and
sway_containers (meaning a C_CONTAINER or C_VIEW).

This change also makes it easy to handle abnormalities like the
workspace floating list, root's scratchpad list and (once implemented)
root's saved workspaces list for when there's no connected outputs.
2018-08-18 23:38:54 +10:00
Drew DeVault d4a32800d5
Merge pull request #2460 from RyanDwyer/implement-mousedown
Implement mousedown operation
2018-08-18 09:32:04 -04:00
Ryan Dwyer 16c663ed49 Rename container_sort_workspaces and container_wrap_children
This commit renames container_sort_workspaces to output_sort_workspaces
and moves it to output.c.

This also renames container_wrap_children to workspace_wrap_children and
moves it to workspace.c. This function is only called with workspaces.
2018-08-18 22:02:03 +10:00
Ryan Dwyer b0a5f3a25f Store geometry in the view and handle any floating view resizing 2018-08-18 15:10:06 +10:00
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
Ryan Dwyer 07a897b3b7 Don't send motion if the cursor hasn't moved
Prevents GTK+ comboboxes from immediately closing.
2018-08-18 09:29:18 +10:00
Ryan Dwyer b637b61a7a Rename mousedown to down and make seat operation a named enum 2018-08-18 09:18:32 +10:00
Ryan Dwyer a36625a482 Implement mousedown operation
This allows you to move the cursor off the surface while dragging its
scrollbar.
2018-08-18 09:18:32 +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
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
Drew DeVault 98ed05225e
Merge pull request #2458 from RyanDwyer/cleanup-transactions
Simplify transactions
2018-08-15 17:16:32 -04: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
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
frsfnrrg 8dbbfa5965 Bindings use advised keyboard repeat parameters
Now 'repeat_delay' and 'repeat_rate' control the initial delay
and rate (per second) of repeated binding invocations.

If the repeat delay is zero, binding repetition is disabled.
When the repeat rate is zero, the binding is repeated exactly
once, assuming no other key events intervene.
2018-07-29 19:15:10 -04:00
frsfnrrg e33dfbfa75 Implement key repeat for pressed key bindings
Each sway_keyboard is provided with a wayland timer event source.
When a valid keypress binding has been found, a callback to
handle_keyboard_repeat is set. Any key event will either clear
the callback or (if the new key event is a valid keypress binding)
delay the callback again.
2018-07-29 19:15:02 -04:00
emersion fe0750fec1 Remove output_surface_for_each_surface from header 2018-07-29 14:33:26 +01:00
emersion 8d5cc8625c Completely switch over to new iterators 2018-07-29 14:33:26 +01:00
emersion e9d674cfd2 wip: redesign output_view_for_each_surface iterator 2018-07-29 14:33:26 +01:00