Commit graph

90 commits

Author SHA1 Message Date
Victoria Brekenfeld
c4ec3fa75f compositor: Make cached_state access thread-safe 2024-06-21 16:26:59 +02:00
Ivan Molodetskikh
fe654453b0 Make input focus store f64 Logical global coords
Some checks are pending
Continuous Integration / format (push) Waiting to run
Continuous Integration / clippy-check (push) Waiting to run
Continuous Integration / check-msrv (push) Blocked by required conditions
Continuous Integration / check-minimal (push) Blocked by required conditions
Continuous Integration / smithay-check-features (push) Waiting to run
Continuous Integration / smithay-tests (push) Blocked by required conditions
Continuous Integration / smallvil-check (push) Blocked by required conditions
Continuous Integration / anvil-check-features (push) Blocked by required conditions
Continuous Integration / WLCS: ${{ matrix.job_name }} (buffer, BadBufferTest*, Bad Buffer Test) (push) Blocked by required conditions
Continuous Integration / WLCS: ${{ matrix.job_name }} (core, SelfTest*:FrameSubmission*, Core tests) (push) Blocked by required conditions
Continuous Integration / WLCS: ${{ matrix.job_name }} (output, XdgOutputV1Test*, Output tests) (push) Blocked by required conditions
Continuous Integration / WLCS: ${{ matrix.job_name }} (pointer-input, */SurfacePointerMotionTest*:RelativePointer*, Pointer input tests) (push) Blocked by required conditions
Continuous Integration / Documentation on Github Pages (push) Blocked by required conditions
Surface position in global compositor space is not required to be
rounded to logical integers. The compositor is free to put surfaces
wherever. So, do not require an integer-logical position.

Not to be confused with:

* A subsurface can only be at an integer-logical offset from its parent
  surface (for now, at least). However, this is unrelated to the
  subsurface position in the global compositor space.
* A surface buffer is (generally expected to be) at an integer
  *physical* pixel position. However, this is unrelated, and frequently
  isn't, an integer *logical* pixel position.
2024-06-17 14:04:40 +02:00
Ian Douglas Scott
eea0d9c171 Call *grab::unset in *set_grab, before restoring focus
This fixes an issue I noticed where cancelled drag-and-drop in clients
like Firefox and Nautilus caused a window to ignore pointer events until
losing and regaining focus. It seems calling the `.ungrab` method at the
end of `with_grab` means calling it after pointer focus is restored, and
clients seem not to handle the `wl_pointer.enter` before the drag is
actually over.

Deferring the focus restoration as well is slightly complicated to
implement, and seems problematic when it involves a serial. Maybe there
shouldn't be any input events after the `*set_grab` call but before
returning, but this seems cleaner.

Taking a reference to the handler in `*InterHandle.*set_grab` is a bit
annoying, but easy enough to deal with, and allows this to work more
cleanly. This seems reasonable as long as we don't have a better
solution to the whole `GrabStatus::Borrowed` thing.
2024-04-16 12:00:38 +02:00
Ian Douglas Scott
033df94071 Add unset method to input grab traits
`unset` is called when a grab is removed with `unset_grab` or replaced
with `set_grab`.

This fixes https://github.com/pop-os/cosmic-comp/issues/403. There are a
couple other grabs in Smithay and cosmic-comp that they run before
unsetting the grab, that may cause issues if the grab is removed without
running it. So this seems useful in general.
2024-04-12 20:42:07 +02:00
Ivan Molodetskikh
bfa56fc54b {an,small}vil: Fix winit scroll values
The usual value for one wheel tick is 15, not 3. This can be verified
with Firefox by scrolling on a TTY backend vs. on the winit backend
(since this particular fallback is used on the winit backend).
2024-04-02 17:58:38 +02:00
Christian Meissl
dc43fbd60a input: add infrastucture for proper touch support
this brings touch handling to the same level as we
already provide for pointer and keyboard.
2024-02-23 22:50:08 +01:00
saihaze
ead293c501 Make Window support X11 windows 2024-02-19 12:42:52 +01:00
Ivan Molodetskikh
125b7972c4 Add OutputHandler trait 2024-01-30 09:13:04 +01:00
Ivan Molodetskikh
e9b3d477d2 Implement popup unconstraining
Loosely based on code from cosmic-comp.
2023-12-19 15:11:50 +01:00
Ian Douglas Scott
d5782e1a64 High res scrolling support
This adds support for `wl_pointer` version 8, calling
`wl_pointer::axis_value120` with the v120 values from libinput. For
clients not binding version 8, values are accumulated to multiples of
120 to send the old `axis_discrete` event.

This helps even for clients using `wl_pointer::axis` with old versions
of `wl_pointer`, since the old libinput event only was emitted where
there was a whole discrete scroll step.

Raises libinput requirement to 1.19, which should be widely available
now. Removes handling of versions before that.

It should be possible to support high res scrolling in the X11 and Winit
backends, where the platform supports it, but for now this just converts
the low-res value to v120.
2023-12-12 18:36:03 +01:00
Kirill Chibisov
86de9aeee3
Update winit to 0.29.2
Make better winit integration by providing a calloop's WaylandSource
for it. The winit backend now doesn't use vsync and utilizes frame
callbacks, when the user cooperates and asks for `redraw_requested`.

Fixes #146.
2023-10-24 16:06:02 +04:00
Ian Douglas Scott
b34ccf0210 Add restore_focus argument to PointerInnerHandle::unset_grab
Used in `ClickGrab` to prevent `motion` events from occurring with every
`button` event. Otherwise, behavior should be unchanged. This matches
the argument taken by `KeyboardInnerHandle::unset_grab`.

This seems like the simplest solution. It would also be possible to add
a method to the `PointerGrab` trait indicating if focus should be
restored, but that's complicated since `unset_grab` can't access the
grab when it's `Borrowed`, so it would have to add a bool to
`GrabStatus::Borrowed`, etc.

This still doesn't send a `frame`, but since this takes a serial and a
time, it probably will be sent along with other pointer events, and
hopefully part of a `frame`. The Wayland spec isn't all that specific
about when things can/should be part of a `frame`...

Calling `motion` is also incorrect with pointer constraints, but grabs
other than `ClickGrab` generally shouldn't exist while a constraint is
active. It would be good to enforce that some way.

Fixes https://github.com/Smithay/smithay/issues/1148.
2023-10-18 16:56:34 -07:00
Kirill Chibisov
8e779d02a3
wayland: add wlr-data-control protocol
wlr_data_control is a protocol used to implement clipboard managers or
access clipboard without creating a window. The implementation of it
ties to regular selections, thus the selection handling was unified
to reduce the maintainance burden.

The present selection modules, like `walyand/primary_selection` and
`wayland/data_device` moved into the new `wayland/selection` module.
Keeping their original implementation, where it was possible.

The new selection module uses the common structure of `seat_data`,
`device`, `source`, and `mod.rs` used in the said above modules, however
it uses the hand-rolled dynamic dispatch with the `selection_dispatch!`
macro. The offers and selection replies are all handled together,
so the code is unique in the most cases.

As a side effect of the selection update and merging the handling of
the primary and clipboard selection into the single `SelectionHandler`
trait (users could still just use one of them, it's not a must to have
both), the xwayland was changed to use some types from the
`wayland/selection` module.
2023-10-02 15:55:00 +04:00
Eivind Gamst
9418366f3a merged master 2023-09-27 12:23:01 +02:00
Elinor Berger
8dfcb418ef Update calloop to 0.12.1 2023-09-24 10:20:08 +02:00
Ian Douglas Scott
3050d3039f Updates for calloop 0.11, using BorrowedFd 2023-09-22 13:16:35 -07:00
Ian Douglas Scott
4c37923cf0 Make frame a seperate method of PointerTarget/PointerGrab
Input handling in compositors will have to emit this appropriatly. But
then other methods don't have to map perfectly to frames.

Meant to address https://github.com/Smithay/smithay/issues/1126.
2023-09-21 14:36:57 -07:00
Ivan Molodetskikh
332fdf89c9 ‘vils: Fix axis_stop event delivery
It's only supposed to be sent when there actually is a zero in the
event, not when the value is missing.

This notably fixes non-diagonal scrolling in winit and alacritty.
2023-09-06 15:01:59 +04:00
Eivind Gamst
f2ef4d7101 clippy fixes 2023-09-05 17:17:06 +02:00
Ivan Molodetskikh
668ebd6ecc smallvil: Add pointer gesture methods to grabs 2023-09-04 15:20:07 +04:00
Ivan Molodetskikh
e241ccbbc4
Smallvil fixes 2 (#1100)
* smallvil: Store DisplayHandle in State

Will be useful for the data device focus.

* smallvil: Set data device focus

Makes clipboard work across clients.

* smallvil: Add basic PopupManager implementation

Doesn't handle popup grabs but gets smallvil far enough.
2023-08-15 17:02:24 +02:00
Ivan Molodetskikh
4b01026fa3 smallvil: Default scrolls to 0.0
On Winit the code seems fine as is, however when using smallvil as a
base for a libinput compositor, these unwraps crash on scrolls. Use
default values like in Anvil to make it work with no surprises.
2023-08-09 17:57:33 +04:00
Ivan Molodetskikh
98863fee57 smallvil: Pass new pointer location to pointer.motion()
This is the correct thing to do.
2023-08-09 17:49:05 +04:00
Ivan Molodetskikh
b42e452302 smallvil: Fix key repeat rate 2023-08-09 17:38:31 +04:00
Ivan Molodetskikh
f13a8e9388 smallvil: Remove full_redraw
It's unused in smallvil.
2023-08-09 17:37:06 +04:00
Christian Meissl
c858082405 build: fix clippy warnings 2023-06-20 12:47:50 +02:00
Victoria Brekenfeld
2e42a2a052 wayland: Add user_data to data_device/primary server-side selections 2023-05-23 19:15:32 +02:00
Ian Douglas Scott
4fd2ce66df Update dependencies
Updating `bitflags` is a slight breaking change to the public API. But
that should be fine here.
2023-05-14 20:25:33 -07:00
Victoria Brekenfeld
eadd43dd85 elements: Allow alpha to be specified in AsRenderElements 2023-05-11 17:59:59 +02:00
Victoria Brekenfeld
80c094c3b8
Merge pull request #1009 from Smithay/feature/surface_transactions
wayland: Surface Transactions
2023-05-10 18:42:40 +02:00
Victoria Brekenfeld
e6261d2f67
Merge pull request #967 from cmeissl/feature/xdg_v5
wayland: support xdg_wmbase v5
2023-05-10 18:11:59 +02:00
Victoria Brekenfeld
d5bacc6e7d compositor: Use the TransactionQueue 2023-05-09 12:01:34 +02:00
Christian Meissl
3cadf200a5 wayland: allow to always send a configure event
this changes send_configure for ToplevelSurface,
PopupSurface and LayerSurface to always generate
a configure event. The old behavior can be found
in send_pending_configure. This is needed as
set_fullscreen and set_maximized always expect
a configure event regardless if the request was
fulfilled or not.
2023-05-06 22:19:14 +02:00
Poly
581ece1f7a wayland.compositor: Pass state to the destruction hook 2023-05-05 19:02:17 +02:00
Victoria Brekenfeld
594fb497ef refactor: Rename Gles2 -> Gles 2023-04-11 21:02:02 +02:00
Christian Meissl
0190c5b7c9 renderer: rename damage tracking utils
DamageTrackedRenderer renamed to OutputDamageTracker
DamageTracker renamed to DamageBag
DamageTrackerSnapshot renamed to DamageSnapshot
2023-03-25 20:00:44 +01:00
Christian Meissl
5aba2ab8a9
feat: switch from slog to tracing
Switch from slog to tracing
---------

Co-authored-by: Victoria Brekenfeld <github@drakulix.de>
2023-02-22 18:41:12 +01:00
Ian Douglas Scott
3cfdcd7840 input: Make Event::time return u64 with microsecond precision
`PointerMotionEvent` now doesn't need a separate `utime` method for
relative pointer events.
2023-01-24 09:16:31 -08:00
Ian Douglas Scott
2e626111af Implement relative pointer protocol
Add helper for the relative pointer protocol, and a way to send relative
pointer events to clients. This also exposes unaccelerated vectors and
microsecond timestamps in pointer events from the libinput backend.

Enables `wlcs` relative pointer test, though what `wlcs` currently
handles seems to be limited at this point.

Adds relative pointer support for Anvil, exposing the global only on the
`udev` backend so clients won't use the protocol but get no events.
2023-01-23 12:14:29 -08:00
Victoria Brekenfeld
463f3fcaf1 smallvil: Fixes for new Window type 2022-12-30 16:33:33 +01:00
Flafy
bb08df5168
smallvil: fix bad handling of the active window state (#833) 2022-12-09 20:14:11 +01:00
Victoria Brekenfeld
a4b836f9f0
Merge pull request #816 from Smithay/feature/gat_renderer 2022-11-23 23:39:48 +01:00
Ian Douglas Scott
8eceeb8067 Remove io-lifetimes dependency
Since Smithay now requires Rust 1.65.0, and io-lifetimes reexports these
types from std on recent Rust versions, this dependency is redundant.
2022-11-17 11:17:39 -08:00
Victoria Brekenfeld
d2f406c284 anvil/smallvil/examples: New renderer api 2022-11-17 18:03:53 +01:00
Christian Meissl
e19d963b62 bump MSRV to 1.65.0 2022-11-15 10:11:59 +01:00
Victoria Brekenfeld
f300461ec6 winit: Support using the glow-renderer 2022-11-12 21:26:47 +01:00
Christian Meissl
96c107aa81 bump MSRV to 1.64.0 2022-11-07 17:05:33 +01:00
Christian Meissl
c3baca8e3e desktop: limit frame callbacks to primary scan-out output
this limits the frame callbacks to the primary scan-out output
which can be selected by a user provided function
2022-10-28 12:47:42 +02:00
Christian Meissl
fb5b65d528 renderer: report the render state of the elements
this extends the result of the dtr with a report
that holds the render states of the provided elements.
The state can be used to query states like skipped after
the rendering took place. This enables use-cases
where the actual state is needed like frame
callback throttling and wp_presentation.
2022-10-28 12:45:15 +02:00
Christian Meissl
cb05b11549 desktop: make space render_output more ergonomic
We can use IntoIterator instead of requiring a slice
for render_output and space_render_elements
2022-10-11 17:59:28 +02:00