1
1
Fork 0
mirror of https://github.com/swaywm/sway synced 2024-06-01 13:56:27 +02:00
Commit Graph

4109 Commits

Author SHA1 Message Date
fwsmit 8106f01c17 desktop/layer_shell: fix centering for opposing anchors 2021-04-12 12:13:25 -07:00
Elyes HAOUAS b40c6448e6 desktop/layer_shell.c: Fix misspelled "exclusive"
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-04-12 18:07:18 +02:00
Simon Ser 78fc9d0d2d Log wlroots version on startup
Can be useful to make sure a bugfix is included. In the future maybe
the wlroots version string could include a commit hash when built
from source, too.
2021-04-12 16:18:17 +02:00
Ronan Pigott a558866f42 container: retain focus position on floating enable
When a tiling container is floated, the focus stack needs to be
appropraitely modified to return the container to its original
position in the tree upon floating disable, like i3.
2021-04-11 21:01:33 -04:00
Simon Ser 1a72049c04 Remove WLR_HAS_XDG_FOREIGN checks
References: https://github.com/swaywm/wlroots/pull/2833
2021-04-11 19:14:05 +02:00
Simon Ser 86b08e3257 desktop/render: remove unused wlr_gles2_texture_attribs
We were calling wlr_gles2_texture_get_attribs, but we were never
using the result.
2021-04-11 12:15:51 +02:00
Ronan Pigott 62fbf33ce2 output: damage whole output when exiting scanout 2021-04-01 12:24:33 +02:00
columbarius 1d62d6bfa0
config: allow whitespaces in config path 2021-03-25 17:22:26 +01:00
Ivan Fedotov 346f5a9d14 Add toggle logic inside DPMS handler
Logic that obtains current DPMS state is put inside the handler.

sway_output from which the current DPMS state will be obtained is selected by the following logic:
* For '-' and '--' the focused output is used;
* For '*' error "Cannot apply toggle to all outputs" is reported;
* For everything else all_output_by_name_or_id() is used.

Fixes #5929.
2021-03-25 11:01:04 +01:00
Kenny Levinsen d79ea9a0db view: subsurface NULL check in view_from_wlr_surface
Necessary NULL checks had been added to xdg_shell and xwayland surfaces,
but subsurfaces had been missed.
2021-03-24 00:55:15 +01:00
Kenny Levinsen 152a559e30 idle_inhibit: Store wlr inhibitor instead of view
When an application inhibited idle, a view pointer was stored and a
destroy listener was registered to the wlr inhibitor. As the wlr
inhibitor lives longer than the view, this lead to a dangling view
pointer between view unmap and inhibitor destroy.

Store a pointer to the wlr inhibitor instead of to the view, and look up
the view when needed, which may at any point be NULL. This also allows
for an inhibitor to remain functional if a surface is re-mapped.
2021-03-21 12:27:29 +01:00
Kenny Levinsen 70842f4e14 view: Handle NULL role object when role is set
wlr_(xdg|xwayland)_surface_from_wlr_surface can return NULL even though
wlr_surface_is_(xdg|xwayland)_surface returned true.
2021-03-21 12:27:29 +01:00
xdavidwu e5913f8106
Implement input method keyboard grab 2021-03-12 12:18:08 +01:00
Simon Ser 585abdb357 xwayland: simplify override-redirect focus restoration
No need to grab the xwayland surface from the wlr_surface, the
parent is already an xwayland surface.
2021-03-12 10:52:12 +01:00
Vyivel ba6c0eb18b output: simplify layer surface iteration 2021-03-11 10:55:25 +01:00
Kenny Levinsen 2e06403548 container: Add view_container_content_at
container_at checks if the position provided matches the currently
focused container with view_container_at as a fast path.

view_container_at checks using the main container geometry, which
includes the titlebar and border area. If a tabbed container is focused,
then positions over unfocused tabs are incorrectly reported as belonging
to the focused container, breaking focus on click.

Add view_container_content_at for use in the focused container fast path
which only tests container content area, and fall back to full workspace
scans for border and titlebar areas.

Closes: https://github.com/swaywm/sway/issues/6074
2021-03-10 17:50:57 +01:00
Kenny Levinsen d358aab8d9 container: Limit tiled focus to container geometry
container_at would maintain the current focus as long as a position was
over one of the container view's surfaces. If an oversized surface was
being clipped, this lead to weird focus behavior.

Instead, use view_container_at for this test, which intersects the
container box before looking at surfaces.
2021-03-01 16:14:10 +01:00
Kenny Levinsen a6544f5a64 render: Clip surfaces to container bounds
If a surface is associated with a sway container, we limit the
destination box to the container dimensions.

Floating views and popups are exempt from this clipping.
2021-03-01 16:14:10 +01:00
ftilde 1afedcb94c Fix for_window criteria and mouse button bindings
Previously, the special case handling of scratchpad and unmark commands
was (probably accidentally) limited to criteria directly handled in the
execute_command function. This would exclude: 1. for_window criteria, as
these are handled externally for views and 2. and mouse bindings which
select target the node currently under the mouse cursor.

As a concrete example `for_window [app_id="foobar"] move scratchpad,
scratchpad show` would show (or hide due to the toggling functionality)
another window from the scratchpad, instead of showing the window with
app_id "foobar".

This commit replaces the "using_criteria" flag with "node_overridden"
with the more general notion of signifying that the node (and
container/workspace) in the current command handler context of the sway
config is not defined by the currently focused node, but instead
overridden by other means, i.e., criteria or mouse position.
2021-02-25 09:48:39 -05:00
lbonn c6e7cf1ae5 focus: beyond fullscreen when focused explicitly
When issuing a focus command on a specific container, users expect to
proceed it even if is hidden by a fullscreen window.

This matches the behavior of i3.
2021-02-25 09:40:20 -05:00
Simon Ser eea9c6331f Automatically map built-in touchscreens/tablets to built-in panels
Detect whether an output is built-in via its type. Detect whether
a touchscreen or tablet tool is built-in via its ID_PATH property.
2021-02-25 09:38:00 -05:00
Simon Ser 641b8719ad man: document `input XXX map_to_output *`
This is useful to reset the output mapping.
2021-02-25 09:38:00 -05:00
Quantum e01a3c85f6 render: handle containers without output when rendering titles
In e0a94bee8d, it was believed that if the
container is being rendered, it must have an output.

This turned out not to be the case. When rendering a container, all its
children are rendered, even if the children is positioned off screen and
thus not having any output. This is the cause of the crash in #6061.

This commit introduces a null-check, which fixes #6061.
2021-02-25 00:43:02 -05:00
Tadeo Kondrak bb41b7b814 output: Reconfigure xcursor when applying output config
Before this commit, when an output had its scale dynamically changed,
Sway would not load a cursor theme with the new scale. This results
in stale cursor images when moving the cursor into an area controlled
by the compositor, like the background or resize areas.

To reproduce:
- Using IPC, set an output scale to a value that isn't currently used
- Move the cursor into a compositor-controlled area
- The cursor will not change
2021-02-24 20:54:48 +01:00
Tadeo Kondrak de471e67d3 build: Add dependency on libdrm
As of 66343839b1, sway now uses a
libdrm header. Add this dependency to the build system so headers from
it can be used on systems where pkg-config is required to find them.
2021-02-23 20:27:38 +01:00
Kenny Levinsen 95901d906a shells: Update comment about size change on commit 2021-02-23 19:38:05 +01:00
Kenny Levinsen 1989b18ff2 transaction: Remove unused ready_immediately 2021-02-23 19:38:05 +01:00
Kenny Levinsen 35b9a41720 transaction: Note if instructions are server requests
On server request, we need to send configure events to inform the client
of the new intended size. If the client changes size itself, sending a
configure event will only cause problems.

Use transaction_commit_dirty_client to distinguish between the two
transaction causes.
2021-02-23 19:38:05 +01:00
Simon Ser 66343839b1 Fix wl_shm_format passed to wlr_texture_from_pixels
See https://github.com/swaywm/wlroots/pull/2744
2021-02-23 17:42:04 +01:00
Dimitris Triantafyllidis aac1582ea9 Fix #5643, #5064: rounding issues in floating-point -> integer conversions
Currently, various floating-point expressions involving
the coordinates of borders, titlebars and content surfaces
are directly assigned to integers, and so they are rounded
towards zero.

This results in off-by-one distances between these elements
when the signs of their coordinates differ.

Fixed by wrapping these expressions with a call to
floor before the assignment.
2021-02-22 21:23:35 -05:00
Kenny Levinsen 1a6471be17 view: Set parent for view_child subsurfaces on init
view_child_init was calling view_init_subsurfaces, which did not set the
parent attribute for the subchildren. This lead to the subchildren
acting as standalone children. If the parent was an xdg_popup, this
would make the subchild unaware of the popup position.

Introduce view_child_init_subsurfaces for view_child_init to use
instead.

Closes: https://github.com/swaywm/sway/issues/6038
2021-02-23 00:17:32 +01:00
Kenny Levinsen 79e43b19d7 view: Mark subchildren as unmapped in view_child_destroy
The subchildren lose their parent association at this point, so they
will not be able to see that the parent is unmapped.

Instead, just set the subchildren to be unmapped directly.
2021-02-23 00:17:32 +01:00
Kenny Levinsen e7af5b6309 view: Recursively check mapped of view_child tree
A subsurface may be set to mapped without its parent.
2021-02-23 00:17:32 +01:00
Kenny Levinsen 2c917a8c34 container: Add container_is_current_floating
Needed to check if containers are currently floating from render code,
as container_is_floating checks pending state.
2021-02-22 23:55:22 +01:00
Quantum e0a94bee8d render: scale titlebars correctly when straddling outputs
When a container straddles multiple outputs, the title bar is only rendered
at the scale of the "effective" output. If the title bar straddles onto
another output with a different scale factor, it was drawn at the wrong size.

In this commit, we take into consideration the scale the title was rendered
at and scale it accordingly so that it appears at the right size on the other
outputs.

This fixes #6054.
2021-02-22 02:08:37 -05:00
Tadeo Kondrak f58f054c87 Fix incorrect damage being applied on popups
To reproduce:

- Open a floating window and a popup that hangs over the bottom or right
- Move the window in the direction of the popup overhang
- The previous position of the popup is damaged, not the new one
2021-02-21 17:30:49 -05:00
Kenny Levinsen 35342d89a9 render: Use current instead of pending fullscreen 2021-02-16 22:05:00 -05:00
Kenny Levinsen a047b5ee4a container: Move pending state to state struct
Pending state is currently inlined directly in the container struct,
while the current state is in a state struct. A side-effect of this is
that it is not immediately obvious that pending double-buffered state is
accessed, nor is it obvious what state is double-buffered.

Instead, use the state struct for both current and pending.
2021-02-16 22:05:00 -05:00
David96 28cadf5580 Add missing transaction commits to seatop_default
Every seat_set_focus* should be followed by a transaction_commit_dirty.
In cases where the focus change is followed by a seatop_begin* this is
not needed, as transaction_commit_dirty is then called by the
seatop_begin* function.

Fixes #6034
2021-02-16 09:35:48 -05:00
Tadeo Kondrak 42cbaf278c text_input: Add support for focusing layer-shell surfaces 2021-02-15 18:24:47 -05:00
Kenny Levinsen c8bf84c82d transactions: Amend pending transactions
The transaction system contains a necessary optimization where a popped
transaction is combined with later, similar transactions. This breaks
the chronological order of states, and can lead to desynchronized
geometries.

To fix this, we replace the queue with only 2 transactions: current and
pending. If a pending transaction exists, it is updated with new state
instead of creating additional transactions.

As we never have more than a single waiting transaction, we no longer
need the queue optimization that is causing problems.

Closes: https://github.com/swaywm/sway/issues/6012
2021-02-16 00:18:26 +01:00
Jan Palus b944735b47 Align ordering of core node properties with i3
Try to better mimic JSON node structure produced by i3 which might be
relied on by already existing tools. In particular having "type" right
after "id" is quite handy for streaming high-performance JSON parsers
such as simdjson (which are handy for maintaining responsiveness on
resource constrained systems).

refer ab2a22a78b/src/ipc.c (L338)
2021-02-15 18:14:27 -05:00
Kenny Levinsen 37d7bc6998 transaction: Only wait for ack from visible views
Transactions currently wait for all configures to be acked, regardless
fo what they were sent to. This includes views that are hidden in tabbed
or stacked containers. If these views do not ack the configure in
response to a single frame callback, they can cause transaction
timeouts.

Check if a container is hidden before registering the configure serial
and saving any view buffers.

Closes: https://github.com/swaywm/sway/issues/6023
2021-02-15 16:58:19 -05:00
Tadeo Kondrak c88f7ad1d0 text_input: Only send surrounding_text and content_type if supported 2021-02-15 16:45:35 -05:00
Tadeo Kondrak b0e8f4ade2 text_input: Ignore text_input disable from unfocused windows
Before this commit, there would be cases where focus changes from one
window to another, the new window activates text_input, then the old
window sends a deactivate request, making text_input unfocused
completely.
2021-02-15 16:44:15 -05:00
Kenny Levinsen 31a01bb80d input: Commit transactions in seatop_default
This is needed for focus_follows_mouse, and was accidentally omitted in
the previous transaction commit shuffle.
2021-02-15 13:49:47 -05:00
Kenny Levinsen b5b628cb41 input: Only commit transactions when necessary
There is no need to check for transactions at the end of every user
input, as the vast majority of input will not issue transactions. This
implementation can also hide where changes are made without an
appropriate transaction commit, as a future unrelated input would issue
the commit instead.

Instead, commit transactions in places where changes are made or are
likely to be made.
2021-02-14 13:19:08 -05:00
Kenny Levinsen 63a6635163 view: Read geometry directly in view_update_size 2021-02-09 09:37:10 +01:00
Kenny Levinsen 82b1019658 shells: Align geometry change commit handling
xdg_shell and xwayland handled geometry changes differently despite
needing mostly identical behavior. The xwayland implementation has been
changed to match that of xdg_shell.
2021-02-09 09:37:10 +01:00
Kenny Levinsen 90fa6953ea shells: Only center tiled views on size change
The size of a tiled container cannot change in response to new buffer
sizes, so there is no need to commit a new transaction. Instead, simply
recenter the view with the new geometry, leaving the full transaction
flow for floating containers.
2021-02-09 09:37:10 +01:00