Commit graph

7034 commits

Author SHA1 Message Date
Łukasz Adamczak 4a31d18837 Clarify documentation for window_rect
(cherry picked from commit 8e4b659578)
2023-02-12 18:48:15 +01:00
Łukasz Adamczak 95c5d8d7b5 Correct window_rect.y with hide_edge_borders
With `hide_edge_borders both` (or at least `vertical`),
`window_rect.y` will equal `border_thickness` for SOME windows,
but it will be 0 for windows adjacent to top screen edge.

Therefore setting it to `border_thickness` is not sufficient.

This commit changes it to the actual y offset of content
into the container.

(cherry picked from commit fadfbe8dba)
2023-02-12 18:48:15 +01:00
Alexander Courtis 2921b232be Apply new adaptive sync value from wlr-output-management
fixes #7394

Test cases:
* zwlr_output_configuration_head_v1_set_adaptive_sync 0->0, no change
* 0->1, enabled
* 1->0, disabled
* 1->1, no change

Similar tests with an incapable display resulted in `"Adaptive sync
failed, ignoring"` messages as expected.

(cherry picked from commit 2c0f68b7c6)
2023-02-10 18:14:21 +01:00
Tobias Bengfort 7693682b73 focus_on_window_activation: raise if floating
(cherry picked from commit a7b9f6fedc)
2023-02-10 18:12:58 +01:00
Simon Ser 3696060549 Fix pointer events for ext-session-lock surfaces
We were never sending any pointer event to ext-session-lock
surfaces.

(cherry picked from commit 6a3e265326)
2023-02-10 18:12:27 +01:00
Simon Ser 9e9b812e3b Send wl_surface.enter for ext-session-lock surfaces
(cherry picked from commit 284966fd57)
2023-02-10 18:12:19 +01:00
Kirill Primak 41e473f8c0 input/tablet: handle focusing NULL surface
Additionally, rename the function responsible for switching focus to
match its behavior better.

(cherry picked from commit 53c9a4a643)
2023-02-10 18:12:12 +01:00
Alexander Orzechowski 908d7db441 warp_to_constraint_cursor_hint: Handle NULL view
This might be the wrong fix, but the crash is happening because the ->data
field on an xwayland surface is NULL. A NULL data field is normal for
unmanaged surfaces, however it seems clients can do weird things: They can
create a cursor lock on a regular xwayland surface then make it unmanaged
by calling override_redirect. In this case, the xwayland server should
destroy the cursor lock, which is does, but does so in the wrong order
making it try to dereference a NULL pointer after sway has acknowledged
its new unmanaged status.

```
(gdb) bt full
0  0x000055fd91934861 in warp_to_constraint_cursor_hint (cursor=0x55fd93486c00)
    at ../sway/input/cursor.c:1243
        sy = 605
        lx = 6.9527431433545762e-310
        sx = 1272
        view = 0x0
        con = 0x7ffd1cdfe400
        ly = -6.949595189996421e+59
        constraint = 0x55fd93e7faa0
1  0x000055fd91934976 in handle_constraint_destroy (listener=0x55fd93f0fd58, data=0x55fd93e7faa0)
    at ../sway/input/cursor.c:1266
        sway_constraint = 0x55fd93f0fd30
        constraint = 0x55fd93e7faa0
        cursor = 0x55fd93486c00
2  0x00007fda8275bf6e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
3  0x00007fda82e57016 in pointer_constraint_destroy (constraint=0x55fd93e7faa0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:49
4  0x00007fda82e570dc in pointer_constraint_destroy_resource (resource=0x55fd933cf8f0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:66
        constraint = 0x55fd93e7faa0
5  0x00007fda8275d8ba in  () at /usr/lib/libwayland-server.so.0
6  0x00007fda8275f6a9 in wl_resource_destroy () at /usr/lib/libwayland-server.so.0
7  0x00007fda82e56fb3 in resource_destroy (client=0x55fd93ea52e0, resource=0x55fd933cf8f0)
    at ../subprojects/wlroots/types/wlr_pointer_constraints_v1.c:39
8  0x00007fda81d8f4f6 in  () at /usr/lib/libffi.so.8
9  0x00007fda81d8bf5e in  () at /usr/lib/libffi.so.8
10 0x00007fda81d8eb73 in ffi_call () at /usr/lib/libffi.so.8
11 0x00007fda8275aada in  () at /usr/lib/libwayland-server.so.0
12 0x00007fda8275f01c in  () at /usr/lib/libwayland-server.so.0
13 0x00007fda8275d9e2 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
14 0x00007fda8275e197 in wl_display_run () at /usr/lib/libwayland-server.so.0
15 0x000055fd919264d3 in server_run (server=0x55fd919a3a80 <server>) at ../sway/server.c:320
16 0x000055fd91925457 in main (argc=1, argv=0x7ffd1cdfed98) at ../sway/main.c:411
        verbose = false
        debug = false
        validate = false
        allow_unsupported_gpu = false
        config_path = 0x0
        c = -1
```

(cherry picked from commit 88c17ece3b)
2023-02-10 18:11:12 +01:00
Carl Smedstad d7158ab984 Use correct length for strncmp comparison
(cherry picked from commit 714559812e)
2023-02-10 18:11:02 +01:00
Simon Ser a249ef3c0e man: fix typo in output disable docs
(cherry picked from commit 0c23b0ec33)
2023-02-10 18:10:38 +01:00
Kate 5218c04bc9 Allow setting the font size to 0 2023-02-01 16:23:19 +01:00
Simon Ser b88b1b6302 build: bump version to 1.8 2022-12-25 16:59:56 +01:00
Simon Ser 0500cdbfce swaynag: fix NULL font description
The font description was only set if provided on the CLI. It was
left NULL for the defaults and when reading from the config file.

Closes: https://github.com/swaywm/sway/issues/7186
(cherry picked from commit fd0af78e43)
2022-12-22 17:45:33 +01:00
Simon Ser 1340910a24 build: bump version to 1.8-rc4 2022-12-19 10:40:02 +01:00
Kenny Levinsen 6b900bab60 seat: Set keyboard if seat keyboard is NULL
sway sends wl_keyboard.enter on seat focus change and when a keyboard
active on a seat is configured. If all keyboards are removed and a
keyboard is added back without changing the focused client, no new
notify event would be sent despite having keyboard focus. This could
lead to key events without notify, which is a protocol violation.

As a quick fix, when configuring a keyboard on a seat where no keyboard
is currently active, activate the keyboard so that a focused surface
will receive a notify event.

Regressed by: e1b268af98
Closes: https://github.com/swaywm/sway/issues/7330

(cherry picked from commit 1ade0ce753)
2022-12-19 10:39:53 +01:00
Ankit Pandey 51663bb120 commands/move: Warp cursor after moving workspace to another output
This makes sway's behavior consistent with i3 when `mouse_warping` is
set to any value besides `none`.

Fixes #7027.

(cherry picked from commit e3c63bf58d)
2022-12-19 10:39:53 +01:00
Simon Ser 54d1e0d568 build: bump version to 1.8-rc3 2022-12-12 11:26:40 +01:00
Ronan Pigott 8d78ab6a45 criteria: be lenient on window_role and instance too 2022-12-12 11:26:11 +01:00
Kenny Levinsen 817f1bbec3 seat: Avoid sending redundant keymaps on reload
When we reload the config, we reset every input device and re-apply
configuration from the config file. This means that the keyboard keymap
is updated at least once during config reload, more if the config file
contains keyboard configuration.

When they keyboard keymap changes and is updated through wlr_seat, the
keymap ends up sent to every keyboard bound in every client, seemingly
multiple times. On an x230 of mine with a keyboard layout set in the
config file, I see 42 keymap events sent to foot on config reload.

Reduce events from keyboard configurations by skipping all but the
currently active keyboard for the seat, and by clearing the active
keyboard during input manager device reset. After this change, I only
see a single just-in-time keymap event.

Fixes: https://github.com/swaywm/sway/issues/6654
2022-12-12 11:26:11 +01:00
Simon Ser fb1cb0aa3a build: bump version to 1.8-rc2 2022-12-03 17:56:30 +01:00
Simon Ser 194fdc6c35 build: fix have_xwayland when xcb-icccm is not found
xcb-icccm is required to build Xwayland support.

Backported from commit d41f11e6bd.
2022-12-03 17:48:41 +01:00
nerdopolis baf027fc5b Fix build on Debian Stable
(cherry picked from commit dca0bb5749)
2022-11-29 00:09:44 +01:00
Simon Ser 27a56e63d3 build: bump version to 1.8-rc1 2022-11-26 23:27:03 +01:00
Simon Ser 6afe74ffec build: drop unused wayland-egl dependency
(cherry picked from commit 37e4a3d637)
2022-11-26 23:26:47 +01:00
Joan Bruguera 0a9b468540 swaybar: Make hotspots block bar release bindings
The previous commit prioritized hotspots before bar bindings for press events,
which matches i3's behaviour. However, since hotspots don't need to do any
processing on release events, those were not handled, and simply fell through
to `bindsym --release` bar bindings (if any).

This is counter-intuitive, and doesn't match i3's behaviour. Instead in case
a hotspot handles the press event, it should also handle the release event,
doing nothing, but blocking the event from triggering a --release bar binding.

E.g., in Sway, without this commit, this config. shows a text on tray clicks:

    bar {
        # ...
        bindsym --release button1 exec swaynag -m I_got_the_release_event.
    }

But the same configuration in i3 (with i3-nagbar) doesn't show the text.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 94b69acf0d)
2022-11-26 10:29:59 +01:00
Joan Bruguera b92af7e3ca swaybar: Prioritize hotspot events to bar bindings
This is consistent with i3bar's behaviour, and for example, allows binding a
command to button1, while still being able to click on tray icons or other
zones on the bar's status line which may have their own bindings.

E.g., in Sway, without this commit, this config. makes tray icons unclickable:

    bar {
        # ...
        bindsym button1 exec swaynag -m You_clicked_the_tray._Want_some_help?
    }

But the same configuration in i3 (with i3-nagbar) keeps tray items clickable.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 53f9dbd424)
2022-11-26 10:29:59 +01:00
Ronan Pigott d5872d0880 launcher: export X startup ids and use them for workspace matching
(cherry picked from commit 28fda4c0d3)
2022-11-26 10:29:59 +01:00
Ronan Pigott 97423ca9c7 launcher: export xdga tokens and use them for workspace matching
(cherry picked from commit 30ad4dc4a5)
2022-11-26 10:29:59 +01:00
Ronan Pigott ee9266cf8c launcher: fudge the interface a bit
We want to create a context before knowing the pid it will match with.

(cherry picked from commit bdeb9f9565)
2022-11-26 10:29:59 +01:00
Ronan Pigott 66be031f6c launcher: initialize launcher_ctxs once on startup
(cherry picked from commit 66568508c0)
2022-11-26 10:29:59 +01:00
Ronan Pigott 5794a223ce view: associate launch contexts with views
Views now maintain a reference to a launch context which, as a last
resort, is populated at map time with a context associated with its pid.
This opens the possibility of populating it before map via another
source, e.g. xdga-tokens or configuration.

(cherry picked from commit 864b3a9a18)
2022-11-26 10:29:59 +01:00
Ronan Pigott 9d78ede905 launcher: rename pid_workspace to launcher_ctx
Soon we will match views with more than just a pid.

(cherry picked from commit d75c9f9722)
2022-11-26 10:29:59 +01:00
Ronan Pigott cb13b9d628 launcher: use xdga tokens
This reuses wlroots token tracking for workspace matching. It doesn't
export any xdga tokens for clients yet.

(cherry picked from commit bd66f4943d)
2022-11-26 10:29:59 +01:00
Ronan Pigott 69abc41d25 launcher: track workspaces by node
This removes the need to rename the pid_workspaces when a workspace
is renamed.

It also opens the possibility of tracking other node types. Tracking
containers would allow application to be placed correctly in the
container tree even if the user has moved their focus elsewhere since
it was launched.

(cherry picked from commit 3b49f2782e)
2022-11-26 10:29:59 +01:00
Ronan Pigott 16b391db48 node: prettify node type names
(cherry picked from commit 1c4b94ae3c)
2022-11-26 10:29:59 +01:00
Ronan Pigott 25f559dcde root: move the workspace matching code to its own file
This removes the pid_workspace bits from tree/root before it gets
too interesting.

No functional change.

(cherry picked from commit eb5021ef99)
2022-11-26 10:29:59 +01:00
Simon Ser 52166bc1f5 build: drop intermediate libraries for protocols
(cherry picked from commit af8a5a8918)
2022-11-26 10:29:58 +01:00
Simon Ser 2a6bcc6738 build: drop "server" from target name for protocol code
(cherry picked from commit e5475d9310)
2022-11-26 10:29:58 +01:00
Simon Ser 61e4e65ea6 build: unify server & client protocol generation
No need to make a difference here, let's just generate header
files for both.

(cherry picked from commit 5be5a038da)
2022-11-26 10:29:58 +01:00
Simon Ser ceece55850 build: drop wayland-scanner fallback
(cherry picked from commit 366f6ef3d3)
2022-11-26 10:29:58 +01:00
Manuel Stoeckl 9f4229827f Use shm_open instead of mkstemp
shm_open is more reliable because it does not require
a writeable filesystem folder, unlike mkstemp.

(cherry picked from commit e2bc8866f4)
2022-11-26 10:29:58 +01:00
Kirill Primak 68b4ed3a4a output: set damage ring bounds to pixel values
Fixes: https://github.com/swaywm/sway/issues/7254
(cherry picked from commit 85005b52fe)
2022-11-26 10:29:58 +01:00
Alexander Orzechowski 5a2563b1a4 workspace_create: Don't allow NULL name
(cherry picked from commit 34933bb843)
2022-11-26 10:29:58 +01:00
Simon Ser 0143c7ade8 ci: checkout wlroots 0.16.0 2022-11-11 22:30:10 +01:00
Baltazár Radics 5c239eaac5 container_get_siblings: handle NULL workspace 2022-11-11 18:57:29 +01:00
Simon Ser d945c8f519 lock: fix crash on output destroy
Closes: https://github.com/swaywm/sway/issues/7120
2022-11-11 17:01:50 +01:00
Kirill Primak 7862fa670e
Use wlr_damage_ring
wlr_output_damage is to be replaced with wlr_damage_ring, so use that.
2022-11-11 16:29:04 +01:00
Simon Ser dcd2076f38 Use wl_signal_emit_mutable()
This function fixes segfaults when emitting a signal potentially
removes arbitrary listeners.
2022-11-10 22:27:38 +03:00
Kirill Primak 6c3b35701d ci: install hwdata 2022-11-09 10:43:44 +01:00
Callum Andrew 3e19836f0e criteria: allow matching for NULL string criteria 2022-11-04 10:02:11 +01:00