There was code that attempted to fill in the gap below the title texture
when the texture isn't tall enough, but this only worked when the output
was positioned at 0,0. The reason is that render_rect expects a box
passed in a hybrid layout-local/output-buffer-local system, and we were
passing purely output-buffer-local. I've added a comment documenting
this.
By the way, we can't use layout-local coordinates for the rectangle box
because in some cases we set the box based on a texture size. Texture
sizes are buffer-local, and we'd have to divide them to bring it back to
layout-local which means losing precision. We could use
output-buffer-local coordinates for the box, but this would require
translating the coordinates from layout-local to output-buffer-local in
many places during rendering.
This patch also vertically centers the text inside the title bar.
This fixes pinentry-gtk-2, but might make other views floating which
would otherwise be tiled. This patch is more of a trial which could end
up becoming a permanent fix.
To reproduce the problem this is fixing, create H[view view view],
fullscreen one of the views and close it. The entire workspace will be
given focus rather than one of the siblings.
This happens because we emit the destroy event, so the seat code tries
to find a new focus, but the view it finds is still believed to be
hidden by the fullscreen view so it's discarded and the workspace is
used instead.
This clears the workspace's fullscreen pointer prior to emitting the
destroy event so that the seat code finds an appropriate new focus.
When rendering, the workspace for the output needs to be retrieved from
the output's `current` state. output_get_active_workspace returns the
pending workspace, which crashes if the pending workspace is new and
hasn't completed a transaction yet.
These are the same as seat_set_focus, but accept a specific type rather
than using nodes. Doing this adds more typesafety and lets us avoid
using &con->node which looks a little ugly.
This fixes a crash that pretty much nobody would ever come across. If
you have a bindsym for "focus" with no arguments and run it from an
empty workspace, sway would crash because it assumes `container` is not
NULL.
* Fullscreen a view
* Run `focus <direction>` where there is no output in that direction
The output returned was rightfully NULL, which needs to be handled.
It was incorrectly determining that the container being moved and the
destination had the same parent, which resulted in tree corruption. Both
parents can be NULL but the containers may belong to different
workspaces.
To reproduce, create layout H[V[view] view] in one workspace then move a
view left or right from another output into that workspace.
Suppose the following:
* Transactions are already in progress - say transaction A.
* View A maps, which creates transaction B and appends it to the
transaction queue.
* View B maps, which creates transaction C and appends it to the queue.
* View A unmaps, which creates transaction D and appends it to the
queue.
* Transaction A completes, so transaction B attempts to save View A's
buffer, but this doesn't exist so it saves nothing.
* Rendering code attempts to render View A, but there is no saved buffer
nor live buffer that it can use.
Rather than implement an elaborate solution for a rare circumstance,
I've take the safe option of just not rendering anything for that view.
It means that if you reproduce the scenario above, you might get the
title and borders rendered but no surface.
Prior to f5b9815128, children of tabbed
and stacked containers would have their container size and position set
to the same as the tabbed/stacked container. Normally this would be a
problem for a layout such as T[V[view]], but there was some code in the
arrange functions which would check if the grandparent of the view was a
tabbed or stacked container and would offset the view's Y accordingly.
Commit f5b9815128 changed the box to
exclude the titlebar for all tabbed/stacked children so that the
grandparent check could be removed. But this meant the title was not
covered in the container and wasn't damaged when the child changed its
title.
This patch changes it so that a child of a tabbed/stacked container will
have its box include the title bar if the child is a view, but not if
it's a layout container. This fixes the title damage issue while
avoiding the grandparent check in the arrange functions, and matches
what we see visually.
seat_execute_command needs to check the flags on `binding_copy`, as
`binding` will be a dangling pointer after a reload command.
handle_keyboard_key needs to set the next_repeat_binding for
non-reloads prior to executing the command in case the binding is
freed by the reload command.
* Was crashing when a view was moved to the scratchpad (prev focus had
no parent).
* Was crashing when a hidden scratchpad view unmaps because it has no
workspace.
When changing focus from a view in one workspace to an empty workspace
using `focus <direction>`, the view in the previous workspace would keep
focused styling. This is because the check to unfocus it was only done
in the container case and not workspace case, so it's been moved out of
both.