Age | Commit message (Collapse) | Author |
|
These properties are before rotation.
|
|
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.
|
|
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.
|
|
Depends on https://github.com/swaywm/wlroots/pull/1226
|
|
Fix window_type with disabled xwayland support
|
|
FreeBSD fixes
|
|
fix misaligned integer stores/loads
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Depends on https://github.com/swaywm/wlroots/pull/1223
|
|
Depends on https://github.com/swaywm/wlroots/pull/1222.
I don't know of a program that sets the state to modal without setting
the window type, but I know the modal property works because logging the
property shows it's true for the Firefox Open File dialog.
|
|
Update for swaywm/wlroots#1216
|
|
|
|
Fix crash when running deferred commands
|
|
|
|
Fix crash on reload
|
|
Implement deprecated new_window and new_float commands
|
|
|
|
May as well make it as easy as possible for users who are coming from
i3.
This also changes the `border` command to accept a thickness when
setting the border to normal. This makes it work the same way as the
`default_border` command. Eg. `border normal 5`
|
|
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`.
|
|
If sway is reloaded using a bindsym which has multiple commands, it
failed to detect the reload command, didn't create a duplicate of the
binding and would crash because the reload command frees the bindings.
For example:
mode system {
bindsym r reload, mode default
}
In this example, the binding->command is "reload, mode default".
Fixes #2545
|
|
This moves the arrange_windows call into the arrange_layers function,
where we know the output actually needs to be arranged.
Additionally, we shouldn't set focus to the parent of an unknown
container type, because the parent may be an output and this causes a
crash because outputs can't have direct focus.
Fixes #2543
|
|
Fixes #2541
|
|
Privilege dropping works on FreeBSD too, so only the caps parts need to
be Linux-only.
|
|
Rootston calls "wlr_xwayland_destroy" and "wl_display_destroy_clients"
on shutdown, but these were not called by Sway. Without them, Sway
crashes on exit before the display destroy event handler could be
called. This causes two problems:
- The TTY is not reset, and it locks up after exiting Sway.
- drmDropMaster is not called, and the implicit drop (that should
occur when the DRM fd is closed) seems not to be working in some
scenarios (e.g. if you have a tmux session running - maybe the fd
is retained somehow by tmux?). In other words, it you exit Sway,
you can't start it (or any other program that wants to be DRM
master) again until you close all your tmux sessions.
|
|
On FreeBSD, snprintf and vsnprintf are visible only if
_XOPEN_SOURCE >= 600.
|
|
commands: fix exec quoting
|
|
Don't use bitfield to test for similar transactions
|
|
|
|
The C_CONTAINER check needs to apply to C_VIEW as well.
|
|
It wasn't returning the surviving container.
|
|
When collecting focus to save into the transaction state, the workspace
needs to look in the tiling list only.
As seat_get_focus_inactive_tiling returns any descendant, the list also
needs to be traversed back up to the direct child of the workspace.
Fixes #2532
|
|
When there's multiple transactions in the queue, sway can take a
shortcut by checking if they all operate on the same set of containers.
If they do, it can skip all but the last transaction. The way we tested
for transactions which used the same containers was to exclusive-or
their con IDs together, but this has proved not only to be ineffective
but also has the potential to make sway crash.
This patch replaces the exclusive-or with a loop and container
comparison.
|
|
When moving a container to an inactive workspace on a different output, this will change the focus on the destination output back to its last active workspace
|
|
* In layout command, arrange parent of parent - not sure why this is
needed but it is
* Remove gap adjustment when rendering
* Workspace should use outer gaps, not inner
* Add exceptions for tabbed and stacked containers
* Don't mess with gap state when splitting a container
|
|
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.
|
|
Stop floaters from snapping on move to new output
|
|
Allow subsurfaces which overflow the container to be interacted with
|
|
Destroy empty workspaces in output_evacuate
|
|
|
|
|
|
|
|
|
|
|