1
1
Fork 0
mirror of https://github.com/swaywm/sway synced 2024-05-29 02:36:16 +02:00
Commit Graph

4620 Commits

Author SHA1 Message Date
Alexander Orzechowski dbd2fbf430 view: init function should return a success bool 2024-01-18 18:36:54 +03:00
Alexander Orzechowski b4d7e84d38 desktop: Rename layers to shell_layers
This code will be deleted later, but for the time being rename
it so it doesn't conflict with future properties.
2024-01-18 18:36:54 +03:00
Kirill Primak 2c69e19fd3 layer-shell: don't configure uninitialized surfaces 2024-01-17 16:54:37 +01:00
Kirill Primak 8d1b0cecd9 layer-shell: wait for an initial commit before configuring 2024-01-17 16:54:37 +01:00
Kirill Primak 904d256581 layer-shell: don't try to unmap on destroy
A surface is guaranteed to be unmapped on destruction.
2024-01-17 16:54:37 +01:00
Simon Ser c5fd8c050f Mark DRM lease protocol privileged
Allowing sandboxed clients to request DRM leases has security
implications.
2024-01-08 11:17:26 -05:00
Simon Ser 7e69a7076f Drop wl_drm
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4397
2024-01-04 08:21:33 +01:00
Simon Ser 95265fba59 input: reconfigure send_events on output hotplug
Closes: https://github.com/swaywm/sway/issues/7890
2024-01-02 14:07:35 +01:00
Billli11 0aceff7469
Remove wlr_presentation in sway_server struct
It is no longer in use.
2023-12-28 11:28:28 +01:00
Bill Li 64d644f0da Chase wlroots!4482 2023-12-27 20:57:35 +01:00
Simon Ser 22d0dd8bde Check wlr_pointer_constraint_v1_state.cursor_hint.enabled
Update for a wlroots breaking change which resets the committed
mask.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4478
2023-12-25 11:57:30 +01:00
Alexander Orzechowski bbabb9aae8 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
2023-12-13 18:10:03 +01:00
Simon Ser c6edbb7e5a input/seat: simplify seat_is_input_allowed()
Use an early return to make the code more readable.
2023-12-13 10:11:35 +01:00
Simon Ser e8a0205607 input/seat: rename seat_set_exclusive_client() 2023-12-13 10:11:35 +01:00
Simon Ser 607b8aed0c input/seat: inline seat_set_exclusive_client() with NULL client 2023-12-13 10:11:35 +01:00
Simon Ser 7ad8c80bfe input/{keyboard,switch}: rename input_inhibited variable to locked
This is more descriptive now.
2023-12-13 10:11:35 +01:00
Simon Ser dbd70faf2e input/seat: drop exclusive_client
This was a input-inhibit concept.
2023-12-13 10:11:35 +01:00
Simon Ser a6ef12d968 Detect proprietary DisplayLink drivers
evdi is open-source, but is just some condom for their proprietary
user-space driver.
2023-12-12 10:04:14 -05:00
Simon Ser ff07eab85b Detect Nvidia proprietary driver via drmGetVersion()
This is less punishing for users with the Nvidia driver loaded but
not used by Sway (e.g. for CUDA).
2023-12-12 10:04:14 -05:00
Simon Ser b81c4da494 Drop fglrx detection
This ancient driver doesn't do KMS. So we were never able to run
with it anyways.
2023-12-12 10:04:14 -05:00
Tamino Bauknecht 255ff665c5 sway: raise error on non-accessible background file 2023-12-12 09:39:46 -05:00
Simon Ser bf2b79b284 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
2023-12-06 23:24:44 +03:00
mrusme ae3acf26f8 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.
2023-12-04 16:30:20 +01:00
Alexander Orzechowski f12023b1a2 Don't destroy output layout on exit
wlroots will destroy this object itself.
2023-12-01 09:11:20 +01:00
Sergei Trofimovich 2cd73a33c2 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.
2023-11-29 10:30:17 +01:00
Kirill Primak 47e6a1164c xdg-shell: chase events update 2023-11-23 19:41:57 +01:00
Simon Ser 128b6253a9 Pass wl_display to wlr_output_layout
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4310
2023-11-23 16:13:19 +03:00
Simon Ser fd6d6f1d97 Add wlr/util/transform.h includes
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4097
Closes: https://github.com/swaywm/sway/issues/7830
2023-11-23 16:13:19 +03:00
llyyr a946b1aecf Chase wlroots!4440
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4440
2023-11-22 00:42:55 +03: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
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
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
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
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
Simon Ser 4a2210577c Hide xwayland_shell_v1 from regular clients
Regular clients are not allowed to use this interface. wlroots
already sends a protocol error if a non-Xwayland client tries to
use this interface, but let's remove all temptation by hiding it
completely.
2023-08-24 18:27:22 +02:00
Kirill Primak a908651821 chore: chase wlroots xdg-surface role rework 2023-08-21 18:41:32 +02:00
Leonardo Hernández Hernández 363c57984d chase wlroots!4316
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4316
2023-08-19 21:06:26 -07:00
ookami eebbecc780 Rebase all cursors in handle_surface_map
Fix swaylock showing transient cursor after locked.
2023-07-31 21:00:20 +02:00
Simon Ser f8ddd97e0e output: drop current_mode
This is now unused.
2023-07-31 16:25:01 +02:00
Simon Ser 170598d71b desktop/output: fix output manager enabled state
With recent wlroots changes, backends which don't support output
modes can now support being disabled.

We were always marking mode-less outputs as disabled. Stop doing
that, check whether the output takes up some space in the layout
instead.
2023-07-31 16:25:01 +02:00
Simon Ser d3626efe5e desktop/output: drop handle_mode()
We already perform the exact same logic on transform/scale change.
2023-07-31 16:25:01 +02:00
Simon Ser d557b6876b desktop/output: drop logic to handle backend-applied mode
The wlroots backends no longer magically apply output modes behind
the compositor's back.
2023-07-31 16:25:01 +02:00
Simon Ser 6bd11ad0df Add support for cursor-shape-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4106
2023-07-24 11:28:31 +02:00
bretello dc634c4a13 fix crash when resizing tiled scratchpad windows
Splitting and then hiding a scratchpad container results in
a segfault.

fixes #6693
2023-07-23 11:10:26 -07:00
Simon Ser ee4637b086 Deprecate seat idle_wake
Sway has two knobs to control idling:

- seat idle_inhibit: when the seat is active (ie. not idle), this
  extends the active state. When the seat is idle, this is
  ignored.
- seat idle_wake: when the seat is idle, this wakes up the seat.
  When the seat is active, this is ignored.

The motivation for the deprecation is two-fold:

- The concept of "seat idle state" is ill-defined. Each idle-notify-v1
  client will pass a different idle timeout. With the old logic, a
  seat was declared idle if and only if all idle-notify-v1 timeouts have
  expired. However, if only a portion of the timeouts have expired,
  then some clients would wake up, and the rest would stay active.
  This is inconsistent with the definition of idle_inhibit/idle_wake:
  idle_inhibit was used for clients which are waking up.
- It never worked properly with the new idle-notify-v1 protocol
  and no-one noticed. Only the legacy KDE idle protocol is taken
  into account, but that protocol is not used anymore.
2023-07-19 09:28:33 +02:00
Artturin 9107907969 chase wlroots 'presentation-time: add separate helper for zero-copy '
67447d6cb4
2023-07-15 15:21:35 +02:00
nukoseer 6c234d013a Calculate tiled resize amount relative to parent container
sway should shrinks/grows tiled windows according to parent container
for ppt unit for i3 compatibility.

Resolves: #7593
2023-07-13 13:27:46 -07:00
Simon Ser fc16fb6549 Send wl_surface.preferred_buffer_scale
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696
2023-07-12 09:59:00 +02:00
Mark Bolhuis 20c91335f6 input: Move wlr_pointer_gestures_v1 to sway_input_manager
On multi-seat configurations a zwp_pointer_gestures_v1 global was
created for every seat.

Instead, create the global once in the input manager, to be shared
across all seats.
2023-06-26 22:57:46 +02:00
Simon Ser 974a8629a8 Use "default" XCursor instead of "left_ptr"
"left_ptr" is the legacy XCursor name. "default" is the cursor
spec name.
2023-06-25 22:38:10 +02:00
Simon Ser b762f455d9 idle-inhibit-v1: simplify with server global
We only have a single running server, no need to keep track of
multiple server instances. Also no need to support multiple
idle inhibit managers.
2023-06-23 12:32:38 +02:00
Simon Ser 5411ed4ef0 Use wlr_cursor_unset_image()
A bit cleaner.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4209
2023-06-19 19:48:53 +02:00
Simon Ser 6f1a3b6652 Use wlr_cursor_set_xcursor()
wlr_xcursor_manager_set_cursor_image() is deprecated.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4170
2023-06-19 19:48:53 +02:00
Alexander Orzechowski 876687000d render: Use wlroots scale filter 2023-06-19 19:14:28 +02:00
Cezary Drożak c08762901e input/libinput: add scroll_button_lock method
Closes https://github.com/swaywm/sway/issues/6987

Co-authored-by: JJGadgets <git@jjgadgets.tech>
Co-authored-by: DeltaWhy <mike5713@gmail.com>
2023-06-16 15:30:04 +02:00
Rouven Czerwinski 8b4b65d665 gamma_control_v1: handle destroyed output
In case a display is unplugged, the sway output may be removed from the
userdata before the gamma_control can be reset. In this case we can't
schedule a commit on the output, simply return within the function.

backtrace full:

  #0  handle_gamma_control_set_gamma (listener=0x4856a8 <server+616>, data=0x7ffce1ed59c0) at ../sway/desktop/output.c:1105
          server = 0x485440 <server>
          event = 0x7ffce1ed59c0
          output = 0x0
  #1  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #2  0x00007f430d142370 in gamma_control_destroy (gamma_control=0x29eb9b0) at ../types/wlr_gamma_control_v1.c:37
          manager = 0x27e33e0
          output = 0x2a10770
          event = {output = 0x2a10770, control = 0x0}
  #3  0x00007f430d14239b in gamma_control_handle_output_destroy (listener=<optimized out>, data=<optimized out>)
      at ../types/wlr_gamma_control_v1.c:59
          gamma_control = <optimized out>
  #4  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #5  0x00007f430d12a0e0 in wlr_output_destroy (output=output@entry=0x2a10770) at ../types/output/output.c:384
          cursor = <optimized out>
          tmp_cursor = <optimized out>
          layer = <optimized out>
          tmp_layer = <optimized out>
  #6  0x00007f430d114ecf in disconnect_drm_connector (conn=conn@entry=0x2a10770) at ../backend/drm/drm.c:1757
          __PRETTY_FUNCTION__ = "disconnect_drm_connector"
  #7  0x00007f430d117078 in scan_drm_connectors (drm=drm@entry=0x1eebab0, event=event@entry=0x7ffce1ed5c1c) at ../backend/drm/drm.c:1597
          c = <optimized out>
          wlr_conn = 0x2a10770
          drm_conn = 0x2e760d0
          conn_id = <optimized out>
          index = 4
          i = 4
          res = 0x2e761f0
          seen_len = 5
          seen = {true, true, true, true, true, false}
          new_outputs_len = 0
          new_outputs = 0x7ffce1ed5ab0
          conn = <optimized out>
          tmp_conn = <optimized out>
          index = <optimized out>
  #8  0x00007f430d113425 in handle_dev_change (listener=0x1eebbb0, data=0x7ffce1ed5c18) at ../backend/drm/backend.c:157
          drm = 0x1eebab0
          change = 0x7ffce1ed5c18
  #9  0x00007f430d1dca0c in wl_signal_emit_mutable ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #10 0x00007f430d111696 in handle_udev_event (fd=<optimized out>, mask=<optimized out>, data=<optimized out>)
      at ../backend/session/session.c:213
          event = {type = WLR_DEVICE_HOTPLUG, {hotplug = {connector_id = 0, prop_id = 0}}}
          devnum = <optimized out>
          dev = 0x1ed9460
          session = <optimized out>
          udev_dev = 0x2e70db0
          sysname = 0x2e73c60 "card0"
          devnode = <optimized out>
          action = 0x7f430d6677b5 "change"
          seat = <optimized out>
          __PRETTY_FUNCTION__ = "handle_udev_event"
  #11 0x00007f430d1de8e2 in wl_event_loop_dispatch ()
     from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #12 0x00007f430d1dc445 in wl_display_run () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0
  No symbol table info available.
  #13 0x000000000041daa5 in server_run (server=server@entry=0x485440 <server>) at ../sway/server.c:338
  No locals.
  #14 0x000000000041cf4d in main (argc=<optimized out>, argv=0x7ffce1ed5fe8) at ../sway/main.c:415
          verbose = false
          debug = false
          validate = false
          allow_unsupported_gpu = false
          config_path = 0x0
        c = <optimized out>

where event->output->data is NULL:

  (gdb) p event->output->data
  $5 = (void *) 0x0
2023-06-14 10:13:12 +02:00
Alexander Orzechowski 59c27c94d3 gamma_control_v1: Reset dirty flag 2023-06-11 20:53:39 +02:00
33KK be14cd96cd
Fix `bindsym --to-code` not respecting input configs
Fixes #7535
2023-06-11 11:36:30 +02:00
Shaked Flur 6a1c176d14
man: add --inhibited and --no-repeat to bindsym and bindcode usage 2023-06-09 12:23:05 +02:00
Simon Ser 65b1a6964c desktop/output: fix damage bitfield in wlr_output_state 2023-06-09 11:41:41 +02:00
Simon Ser f3b8c9feee desktop/output: use detached output state for page-flips
This avoids relying on the implicit wlr_output.pending state.
2023-06-08 14:33:23 -07:00
Simon Ser b1b3563d54 Handle gamma-control-v1 set_gamma events
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4046
2023-06-08 22:11:50 +02:00
Erik Reider 913a7679cb Add support for wlr-layer-shell ON_DEMAND keyboard interactivity
This allows for layer shell surfaces to receive focus while the surface is explicitly focused, i.e allowing
text fields to receive keyboard input just like a regular surface.
2023-06-06 09:07:05 +02:00
Artturin 7ab8cb2ee6 chase wlroots wlr_renderer_begin_buffer_pass change
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4159

> ../sway/desktop/output.c:618:47: error: too few arguments to function 'wlr_renderer_begin_buffer_pass'
>   618 |         struct wlr_render_pass *render_pass = wlr_renderer_begin_buffer_pass(
>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-06-05 23:12:20 +02:00
Kirill Primak b5cb49bce9 xwayland: fix mapped state check in OR handlers 2023-06-03 09:12:12 +02:00
Kirill Primak c001a57e8b lock: listen to the correct map signal 2023-06-02 22:22:29 +02:00
Kirill Primak c9e1dab318 chore: chase wlroots map logic unification 2023-06-02 20:11:42 +02:00
Kirill Primak 72881b5d12 xwayland: don't rely on event source being data
This pattern is being slowly removed from wlroots.
2023-06-02 20:11:42 +02:00
Erik Reider 48d6eda3cb Fix layer old damage not being offset by the monitor layout coords 2023-05-20 16:56:25 +02:00
hrdl 01b0c11394 seatop_down: Call seatop_begin_default after sending touch events
This is consistent with pointer tablet and button events.

Fixes #7577.
2023-05-11 12:47:56 +02:00
Simon Ser 19cc36accc render: fix titlebar texture clipping
We need to provide an unclipped dst_box.

Fixes: https://github.com/swaywm/sway/issues/7573
Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 18:12:06 +02:00
Kenny Levinsen 0a951517ae render: Clear using wlr_output dimensions
Clear was done using sway_output's logical dimensions, instead of the
wlr_output physical dimensions. This meant that when output scaling was
applied, only a part of the screen would be cleared.

Use the wlr_output dimensions instead.

Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 15:55:31 +02:00
Kenny Levinsen 393c29fc59 render: Apply clip to rendered texture correctly
The new wlr_render_pass API provides src_box, dst_box and clip
parameters for texture rendition. Rather than clipping the dst_box,
which control the projection matrix and leads to compression, intersect
the damage and clip box and pass these as a clip parameter.

Fixes: https://github.com/swaywm/sway/issues/7579
Regressed by: https://github.com/swaywm/sway/pull/7552
2023-05-09 15:55:31 +02:00
hrdl 3cd7c71780 handle_touch_cancel: fix begin default
I forgot to call seatop_begin_default in
e8f7551e46.
2023-05-04 17:34:54 +02:00
hrdl e8f7551e46 Add support for touch cancel events 2023-05-04 13:30:57 +02:00
Alexander Orzechowski db7638a0e5 Don't crash if there is no damage during render 2023-05-02 23:25:50 +02:00
Alexander Orzechowski 029b99b482 render: Use wlr_render_pass 2023-05-02 18:31:55 +02:00
Alexander Orzechowski 07cdf6ccd0 render: Don't pass matrix into render_texture 2023-05-02 18:31:55 +02:00
Alexander Orzechowski d5cc474aef render: pass rendering state together in a struct
This lets us easily add rendering state that we need in the future
2023-05-02 18:31:55 +02:00
Alexander Orzechowski 33cfdbe886 xdg_shell: Fix crash if popup generates while toplevel is in the scratchpad 2023-04-16 19:55:00 +02:00
Simon Ser 08c1946d71 Use format_str() throughout 2023-04-14 18:34:54 +02:00
Simon Ser a7b50f6c9c commands: add printf attribute to cmd_results_new()
And fix the resulting build failures.
2023-04-14 18:34:54 +02:00
Simon Ser d6915f6428 commands/floating_minmax_size: fix error strings
cmd_results_new() does not take the command name as argument.
2023-04-14 18:34:54 +02:00
Simon Ser 4118c49349 Use output_match_name_or_id() in workspace functions 2023-04-14 18:34:54 +02:00
Simon Ser fcec581748 Use output_match_name_or_id() in apply_output_config_to_outputs() 2023-04-14 18:34:54 +02:00
Simon Ser 04904ab9a5 Use all_output_by_name_or_id() in merge_id_on_name()
No need to iterate over the outputs manually.
2023-04-14 18:34:54 +02:00
Simon Ser 8d95638df6 Introduce output_match_name_or_id()
Reduces code duplication.
2023-04-14 18:34:54 +02:00
Elyes Haouas 63f9bdf001 Fix old style function definitions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-04-14 18:21:43 +02:00
Simon Ser ab4f460597 Set output damage during direct scan-out
During direct scan-out, pass the damaged region to the wlroots
backend.
2023-04-14 17:43:37 +02:00
Simon Ser 777df22377 Skip direct scan-out commit when damage is empty
When there is no damage, no need to perform an output commit, even
when direct scan-out is used.
2023-04-14 17:43:37 +02:00
Simon Ser 5e847fe3c8 Pass version to wlr_compositor_create()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696
2023-04-14 17:26:03 +02:00
Alexander Orzechowski dadf3e9b78
Chase wlroots!4067 2023-04-06 22:03:52 +02:00
Simon Ser e8fb7f53b8 Remove duplicate wlr_damage_ring_set_bounds() call
We already do this in handle_commit().
2023-04-06 16:35:21 +02:00
Erik Reider fa7b686e61
Fix damage-ring bounds not being set when unplugging -> plugging in monitor
#7524 was a partial fix. Seems like this is still an issue when
unplugging and plugging the monitor back in.

Closes: https://github.com/swaywm/sway/issues/7528
2023-04-06 10:40:49 +02:00
Simon Ser dee032d0a0 ipc: add LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM entry
This was introduced in the last libinput release.

Fixes the following error:

    ../sway/ipc-json.c:928:17: error: enumeration value 'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM' not handled in switch [-Werror=switch]
      928 |                 switch (libinput_device_config_accel_get_profile(device)) {
          |                 ^~~~~~
2023-03-27 10:56:16 +02:00
Simon Ser 4f6e559dec man: deprecate seat cursor move/set/press/release
The Wayland protocol better serves this purpose, and is supported
by more compositors.
2023-03-26 23:22:04 +02:00
Erik Reider ac1ed638e9 Init the damage_ring bounds on output creation
Otherwise the initial bounds would be `INT_MAX` until `handle_mode` or `handle_commit` is called :)
2023-03-26 23:00:08 +02:00
Ankit Pandey f21090f978 root: Set inactive focus when scratchpad is moved to new workspace
Fixes an issue where an already visible scratchpad window being moved due to
'scratchpad show' leaves the entire workspace at the top of the focus stack in
the old workspace. Moving by 'focus output' back to the old workspace would
focus the entire workspace instead of just the last active container.
2023-03-24 13:20:13 -07:00
Ankit Pandey 90c2d631e2 root: Try to preserve relative positions of floating containers
This makes the behavior of floating containers more consistent with i3.
The coordinates of the container are scaled when the size of the
workspace it is on changes or when the container is moved
between workspaces on different outputs.

For scratchpad containers, add a new state that preserves the dimensions
of the last output the window appeared on. This is necessary because
after a container is hidden in the scratchpad, we expect it to be in the
same relative position on the output when it reappears. We can't just
use the container's attached workspace because that workspace's
dimensions might have been changed or the workspace as a whole could
have been destroyed.
2023-03-14 23:26:42 -07:00
Stanislav Ochotnický ebeed7e303 man: add warning for hide_cursor configuration
See https://github.com/swaywm/sway/issues/6297
2023-03-11 11:58:05 -05:00
novenary b28e1b0d3c Disable direct scanout for surfaces with popups 2023-02-28 15:38:05 +01:00
llyyr b757ef94ef sway{,bar}: use default font hint style
CAIRO_HINT_STYLE_FULL attempts to maximize contrast at the expense
of fidelity, this makes most fonts that haven't been hand hinted,
which makes up the majority of fonts out there, appear much worse.

In the absence of explicitly set hint style, cairo will default to
CAIRO_HINT_STYLE_SLIGHT, which attempts to improve contrast while
retaining fidelity to the original shapes, which is what we want.
2023-02-27 13:55:08 -05:00
Robin Jarry 9498e4d261 Allow windows in scratchpad to set the urgent flag
When a window in the scratchpad container requests for
xdg_activation_v1, it is ignored no matter what the value of
focus_on_window_activation is.

At least allow windows in the scratchpad to set the urgent flag. When
focus_on_window_activation is set to "focus", show the parent scratchpad
where the contained requested for xdg_activation_v1.
2023-02-22 11:41:43 -07:00
Simon Ser 16b0afd433 Check for empty damage before attaching render buffer
Check whether output->damage_ring.current is empty before calling
wlr_output_attach_render(). Saves us from having to un-do that
via wlr_output_rollback().
2023-02-22 13:37:44 -05:00
Simon Ser c2ccc0c9d4 Move output commit out of output_render()
That way output_render() only does what it says on the tin.
2023-02-22 13:37:44 -05:00
Simon Ser d6cb4fa8de Constify pixman_region32_t for rendering functions 2023-02-22 13:37:44 -05:00
Simon Ser 423459723b Adjust scale for fractional-scale-v1 2023-02-22 10:14:31 -05:00
Stacy Harper 4666d1785b Implement seatop_touch
Atm we got issue with the touch position sent to the clients. While
holding contact, leaving the initial container will continue to send
motion event to the client but with the new local position from the new
container.

This seatop goal is to send the position of the touch event, relatively
to the initial container layout position.
2023-02-20 10:35:10 -05:00
Simon Ser 7d2e4a5106 layer-shell: enter output before surface is mapped
This sends fractional-scale-v1 events before the first configure
event. That way clients have all of the metadata they need to render
the first frame.
2023-02-20 12:20:42 +01:00
Simon Ser 7a6c7d60d5 Update surface fractional scale on output change
Closes: https://github.com/swaywm/sway/issues/7464
2023-02-20 12:11:07 +01:00
Ronan Pigott 633d409b88 container: rehome the container_swap function into container.c
This function was already declared in container.h but defined in
commands/swap.c for some unknown reason. Everything in commands/ assumes
the handler context has been set appropriately by the command preludes
but this function snuck its way into seatop_* which doesn't set anything
in the handler context.

The fact that the seatop drag actions manipulate the focus without
custody of the seat means they are definitely very broken in multiseat.
2023-02-19 20:07:39 -05:00
Daniel Hill 788118f194 Fix map_to_output * turning off device
Signed-off-by: Daniel Hill <daniel@gluo.nz>
2023-02-18 20:15:28 +01:00
Simon Ser 9162b536f6 Add support for fractional-scale-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
2023-02-10 20:36:15 +01:00
Simon Ser 1cab17ada2 Introduce surface_{enter,leave}_output()
We can centralize all output-related surface events from there.
2023-02-10 20:36:15 +01:00
Łukasz Adamczak 8e4b659578 Clarify documentation for window_rect 2023-02-10 11:17:50 -07:00
Łukasz Adamczak fadfbe8dba 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.
2023-02-10 11:17:50 -07:00
Ronan Pigott 1b27e8c8fd xdg-activation: fix urgency when the client does not specify a seat
xdg-activation is now too strict in only allowing tokens with a seat to
activate a surface. Clients may rely on this behavior for urgency hints.
The seat argument is still useful in case the client does provide a seat
so we can activate it on the desired seat.

Fixes: 842609da64 (view: make request_activate take a seat, 2022-11-30)
2023-02-09 20:02:32 +01:00
Simon Ser b4ce0a30c1 Use wlr_linux_dmabuf_feedback_v1_init_with_options()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3933
Closes: https://github.com/swaywm/sway/issues/7436
Closes: https://github.com/swaywm/sway/pull/7437
2023-02-07 13:35:56 -05:00
Baltazár Radics 7d0351b411 ipc: add ability to subscribe to output event 2023-02-06 11:02:52 +01:00
Ronan Pigott 4cda9ee3a3 launcher: support external launcher tokens 2023-02-05 00:53:47 -07:00
Ronan Pigott dbc1eec850 launcher: make launcher context seat aware 2023-02-05 00:53:47 -07:00
Ronan Pigott 842609da64 view: make request_activate take a seat
This way we can move focus on the same seat an activation token
originates from.
2023-02-05 00:53:47 -07:00
Simon Ser 9959e6b8dc Convert to *_try_from_wlr_surface()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
2023-02-02 14:53:15 +03:00
Tobias Predel b31e97e55d root: free non_desktop_outputs list on root_destroy
This fixes a memory leak because the non_desktop_outputs list was not
freed when the root was destroyed.
2023-02-02 09:39:58 +01:00
Simon Ser ae2d14ceeb Convert to wlr_xwayland_surface_try_from_wlr_surface()
Accomodate for the breaking changes in [1].

[1]: fbf5982e38
2023-02-01 23:38:12 +01:00
Simon Ser 40eb29e7c5 ipc: add support for output event
For compatibility with i3 [1].

[1]: https://i3wm.org/docs/ipc.html#_output_event
2023-02-01 11:32:57 -05:00
Alexander Courtis 2c0f68b7c6
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.
2023-01-23 14:17:52 +01:00
Simon Ser 36f627d0fa Check return value of wlr_renderer_begin()
Since [1], wlr_renderer_begin() can fail. Check its return value
and bail.

This fixes an assertion error (when begin() fails and then we try
to render something) after a GPU reset.

[1]: a541c9510a
2023-01-21 14:16:21 +01:00
Tobias Bengfort a7b9f6fedc focus_on_window_activation: raise if floating 2023-01-20 17:04:26 +01:00
Simon Ser 6a3e265326 Fix pointer events for ext-session-lock surfaces
We were never sending any pointer event to ext-session-lock
surfaces.
2023-01-18 11:23:05 -05:00
Simon Ser d5b69d5912 Fix indentation in surface_is_xdg_popup() 2023-01-18 16:48:38 +01:00