Commit Graph

7227 Commits

Author SHA1 Message Date
Simon Ser 6cbc83fd67 build: bump version to 1.9-rc.4 2024-02-17 14:27:27 +01:00
Aleksei Bavshin b4800fbc90 xdg-activation: distinguish activation and urgency requests
Check if the app that requested a token has provided a valid input
serial and a focused surface. Downgrade activation request to urgency
otherwise.

This is mostly in line with what other Wayland compositors decided to
do, and offers a better security than the original logic.

(cherry picked from commit d19810eba8)
2024-02-17 14:27:05 +01:00
Ronan Pigott d91779d647 launcher: track the seat in the launcher ctx
This is a more suitable place to track the requesting seat, since we are
able to respond appropriately to destroy notifications.

(cherry picked from commit f6d22f8e68)
2024-02-17 14:27:03 +01:00
Simon Ser 1875e03dd0 Fix build with wlroots DRM backend disabled
The header is not installed by wlroots when the DRM backend is
disabled. We don't need it here, so don't include it.

Closes: https://github.com/swaywm/sway/issues/7943
(cherry picked from commit ca40663d42)
2024-02-17 14:26:57 +01:00
Simon Ser 9a26c82437 commands: make primary_selection a config-only command
It's not possible to switch this at runtime.

(cherry picked from commit 93d391651c)
2024-02-17 14:26:32 +01:00
Simon Ser 9c13ed6e70 build: bump version to 1.9-rc.3 2024-02-09 18:25:12 +01:00
Violet Purcell 1c07868f2f sway/config.c: only reset primary_selection at launch
Otherwise, an error will be shown whenever reloading due to the value of
primary_selection being reset to true.

(cherry picked from commit 6b2aa83246)
2024-02-09 18:23:03 +01:00
Simon Ser ff67f5f352 build: bump version to 1.9-rc.2 2024-02-02 18:59:55 +01:00
Tamino Bauknecht 176f78d9ac sway/output: Improve logging of swaybg execvp failure and more checks
This doesn't catch the error if a background changing command is
executed via swaymsg, but improves logging.
The additional checks at least propagate if e.g. forking failed.

(cherry picked from commit c8676fad54)
2024-02-02 18:51:03 +01:00
Simon Ser 23cf639aa8 build: bump version to 1.9-rc.1 2024-01-26 15:26:37 +01:00
Simon Ser 98515991db Clarify gdk-pixbuf dependency purpose
swaybg is out-of-tree so not relevant here. swaybar's tray doesn't
actually depend on gdk-pixbuf, but gdk-pixbuf enables more image
formats for swaybar tray when available.

Closes: https://github.com/swaywm/sway/issues/7913
(cherry picked from commit ae33f4eb37)
2024-01-26 15:16:28 +01:00
Simon Ser f7f5ac7a97 Mark DRM lease protocol privileged
Allowing sandboxed clients to request DRM leases has security
implications.

(cherry picked from commit c5fd8c050f)
2024-01-26 15:14:47 +01:00
Simon Ser 6bf1260f61 readme: add swaybg as optional dep
(cherry picked from commit fa294a9094)
2024-01-26 15:14:42 +01:00
Simon Ser 37fce86c32 input: reconfigure send_events on output hotplug
Closes: https://github.com/swaywm/sway/issues/7890
(cherry picked from commit 95265fba59)
2024-01-26 15:14:37 +01:00
Alexander Orzechowski 80ea52910a output: Destroy when output layout is destroyed
Since output layout is destroyed when the wayland display is destroyed
we run into a destroy listener order problem: Either the display starts
destroying the outputs first, in which case we're good: The existing
handling will clean up. However, things go wrong if the display decides
to destroy the output layout first. In this case, sway will hold
invalid references to the output layout as part of each output so that
when it finally goes to destroy them, sway will dereference destroyed
output layout bits.

Ref: https://github.com/swaywm/sway/pull/6844#issuecomment-1843599513
(cherry picked from commit bbabb9aae8)
2024-01-26 15:14:24 +01:00
Tamino Bauknecht 2bba8a8618 sway: raise error on non-accessible background file
(cherry picked from commit 255ff665c5)
2023-12-14 10:49:20 +01:00
Simon Ser 79f82b3e6a desktop/xwayland: correctly handle association on o-r change
When override-redirect changes, we need to setup/teardown listeners,
just like we do for map.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3773
(cherry picked from commit bf2b79b284)
2023-12-14 10:48:56 +01:00
mrusme 2a2e65b766 Update sway.5.scd
Make it extra extra extra clear, because I had to stumbled upon https://github.com/swaywm/sway/issues/3292 to understand this.

(cherry picked from commit ae3acf26f8)
2023-12-14 10:48:44 +01:00
Sergei Trofimovich 4683b53817 sway/config.c: use `memcpy()` for known buffer size
`gcc-14` added a new warning around dangerous use of `strncpy()` withi
known overflow:

    ../sway/config.c: In function 'do_var_replacement':
    ../sway/config.c:983:33: error: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Werror=stringop-truncation]
      983 |                                 strncpy(newptr, var->value, vvlen);
          |                                 ^
    ../sway/config.c:971:45: note: length computed here
      971 |                                 int vvlen = strlen(var->value);
          |                                             ^~~~~~~~~~~~~~~~~~

It's a bit fishy to rely on truncating behaviour of `strncpy()`. The
change uses `memcpy()` as more explicit way to express copy of `vvlen`
bytes.

(cherry picked from commit 2cd73a33c2)
2023-12-14 10:48:24 +01:00
Simon Ser 064b279e9b ci: checkout wlroots 0.17 2023-11-22 00:38:05 +01:00
Matt Fellenz bff991dfdc Use locale time format for default bar command 2023-11-21 17:42:09 +01:00
Simon Ser 9d666a08e1 Fix reference to wlr_output_event_commit.committed
This has been dropped from wlroots. Previous commit missed that.
2023-11-21 16:52:19 +01:00
Simon Ser 072fa60cb4 Add support for security-context-v1
As a first step, deny access to privileged protocols to sandboxed
apps.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3589
2023-11-21 15:12:42 +01:00
Simon Ser 5bdd608514 Apply gamma LUT when an output re-enabled
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3679
2023-11-21 15:05:58 +01:00
EBADBEEF 86f96a786b view: re-apply criteria when window gets unmapped
Remove any existing executed criteria items at unmap time. If a window
gets unmapped but not destroyed, we want to reapply 'for_window'
criteria. Fixes #6905.
2023-11-21 14:57:58 +01:00
NemuiBanila c3ec141b34 seat: Fix cursor theme reload for tablet tool 2023-11-21 11:35:49 +01:00
Lina Banik f7a40cfa2f seat: Fix reloading cursor theme after change
This reverts commit afde6369
"seat: avoid unneeded reloading xcursor theme".
Always avoiding to reload the xcursor theme prevents reloading the
cursor even when this is desired. Instead seat_configure_xcursor
can determine whether a full reload is necessary.

To stay with the spirit of the reverted change, cursors are only fully
reloaded, if the theme has changed.

Fixes #6931
2023-11-21 11:35:49 +01:00
Simon Ser 5c99b98805 input/input-manager: drop input_manager_configure_all_inputs
This is now unused.
2023-11-16 16:29:07 +01:00
Simon Ser 7036769bea Only reconfigure input mappings on output change
Fully reconfiguring all input devices on output change takes a
loooong time. Let's just reconfigure what we need: only mappings
depend on outputs.
2023-11-16 16:29:07 +01:00
Simon Ser caa92ddee8 input/seat: rename seat_apply_input_config
seat_apply_input_mapping is a lot more descriptive.
2023-11-16 16:29:07 +01:00
Simon Ser 01dcad80e1 input/seat: don't configure mappings for switches
Switch devices cannot be mapped to an output/region, stop trying
to do so.
2023-11-16 16:29:07 +01:00
Sergei Trofimovich 020a572ed6 swaynag/config.c: fix build against gcc-14 (-Walloc-size)
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of
an individual element matches size of a pointed type:

        https://gcc.gnu.org/PR71219

`sway` triggers it on `calloc()` calls where member size is used as
`1` (instead of member count):

    swaynag/config.c:169:65: error: allocation of insufficient size '1'
     for type 'struct swaynag_button' with size '48' [-Werror=alloc-size]
      169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
2023-11-03 13:25:27 +01:00
Bill Li 6f6b82793d chase wlroots!4411
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4411
    fix #7802
2023-10-31 09:51:19 +01:00
Kirill Primak f2425b4fd6 xdg-shell: send maximized if tiled isn't supported
wlroots doesn't do it automatically anymore.
2023-10-29 17:21:18 +01:00
Dudemanguy 647521244a xdg_shell: don't update wlr_toplevel if the container has no size yet
3d5ae9813d added logic to change the
underlying wlr_toplevel size for floating containers, but it does it
even if the container has no actual coordinates yet. This doesn't really
make sense to update the toplevel size in this case since there's many
things that could affect the initial coordinates (sway commands,
fullscreen state, etc.). Skip this by doing a crude check to see if the
current container state has any width.
2023-10-27 17:36:32 -07:00
Kirill Primak 47263aca28 view: check if the buffer was uploaded on save
wlr_surface_has_buffer() is insufficient; if a client has committed a
buffer but it couldn't be applied, NULL deref happens in the next line.
2023-10-24 14:35:57 +02:00
Tamino Bauknecht 0dfaf7ea63 config/output: Allow approximation of output refresh rate
Previous behavior was that only if resolution and refresh rate match
exactly, the mode was accepted. As fallback, the mode with the highest
refresh rate and the same resolution was chosen.

New behavior is that the mode with the closest match for the refresh
rate is used with a limit of up to 1Hz. The fallback behavior stays the same.

Additionally, the logging was made more verbose.
2023-10-23 11:05:08 +02:00
Tamino Bauknecht f2425b5163 gitignore: Ignore clangd-generated directory .cache/ 2023-10-23 11:05:08 +02:00
Alexander Orzechowski 4326a26ad6 Chase wlroots!4331 2023-10-06 14:39:12 +03:00
iff 8a8fb76ec1 Update sway-input.5.scd 2023-10-05 10:04:32 +02:00
Simon Ser 7cf4e1d5c6 Drop support for KDE's idle protocol
We support the standard idle-notify protocol since Sway 1.8.
2023-10-05 00:01:54 +02:00
Ashraf b3519c2d2f Translate README to Arabic 2023-09-14 13:37:50 +02:00
Jan Beich 68caa8deba readme: Stop recommending setuid bit for non-logind systems
- Optional since Sway 1.6 per swaywm/wlroots@bad1e9afa8
- Deprecated in Sway 1.7 per 67d3d952b6
- Removed in Sway 1.8 per e5728052b5
- Ignored in future versions (keeps root priveleges)
2023-09-13 10:21:59 +02:00
Manuel Stoeckl 8edc48f6dd sway/server: Fix null pointer crash when Xwayland disabled 2023-09-10 08:33:10 +09:00
Johan Sköld d952ce403e i3 compat: Adding support for the `all` criteria
Matches all views. i3 PR: https://github.com/i3/i3/pull/4460

Fixes #7110
2023-09-07 10:42:54 +09:00
iff 3dd2f4a67f
commands/input/map_from_region: don't treat 0x prefix as hex identifier
When using the `map_from_region` for pen tables, we will usually make
the available area as big as possible while maintaining the proportions
with the screen.

As most of the tablets uses a 16:10 ratios while the most popular screen
ratios is still 16:9, the argument for most people should be `0x0 1x0.9`
to have the maximum effective area.

However, the argument above won't work because the current code will
treat `0x...` as a hexadecimal number, instead of setting both `x` and
`y` to `0`.

This fix allows the use of the following syntax:

```
input type:tablet_tool {
	map_from_region 0x0 1x0.9
}
```
2023-09-07 01:31:35 +00:00
denppa 89f8531268
build: fix build with wayland-scanner subproject 2023-08-30 23:57:25 +09:00
Dudemanguy 3d5ae9813d xdg_shell: update wlr_toplevel size on client resizes
If a floating client resizes itself, sway updates several of its
internal dimensions to match but not wlr_toplevel. This means that the
next time wlroots sends a toplevel configure event, it can have wrong
coordinates that resize the client back to its old size. To fix this,
let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the
same dimensions as sway.

Exactly the same as 0183b9d35d but the
logic is onlly applied to xdg_shell and not xwayland.
2023-08-28 17:04:53 -07:00
Dudemanguy 60a94b4916 Revert "view: update wlr_toplevel size on client resizes"
This isn't the right fix for this issue because the xwayland code also
uses this function and updating the wlr_toplevel there doesn't make
sense and also causes problems. Fixes #7722.

This reverts commit bf44690ee8.
2023-08-28 17:04:53 -07:00
Dudemanguy bf44690ee8 view: update wlr_toplevel size on client resizes
If a floating client resizes itself, sway updates several of its
internal dimensions to match but not wlr_toplevel. This means that the
next time wlroots sends a toplevel configure event, it can have wrong
coordinates that resize the client back to its old size. To fix this,
let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the
same dimensions as sway. Fixes #5266.
2023-08-26 13:44:37 -07:00