Commit Graph

287 Commits

Author SHA1 Message Date
Victor Berger d797cdcdcb wayland.seat: Fix pointer grab API
The pointer grab mecanism had a few inconsistencies in its behavior when
a grab is set or unset. THis commit uniformizes the behavior, and also
introduces a synthetic motion event when the grab is set, allowing the
newly set grab to change the focus or the pointer location if needed.

Also adjust the DnDGrab, as well as the resize and move grabs from anvil
to unset the focus while they are active, matching weston's behavior.
2022-02-01 19:42:01 +01:00
Christian Duerr c6cbce2082
Remove socket initialization from udev.rs
Since `AnvilState::init` already initializes the socket, it shouldn't be
necessary to duplicate this in the `udev.rs` backend.
2022-01-29 14:31:42 +01:00
Victoria Brekenfeld 3454146c92 gbm: Allow usage of other allocators for GbmBufferedSurface 2022-01-26 20:13:41 +01:00
Victor Berger 71fad616f8
Merge pull request #467 from cmeissl/feature/popup_grab
Add support for popup grabs to desktop abstraction
2022-01-23 21:47:38 +01:00
Victoria Brekenfeld 4b22624e74 anvil: Use buffer transformations 2022-01-17 11:20:57 +01:00
Christian Meissl 070dc78c11 add the keyboardgrab and rename GrabStartData
to PointerGrabStartData
2022-01-16 20:19:49 +01:00
Victor Brekenfeld 51ece28120 anvil: Fix winit resizing 2022-01-12 22:14:53 +01:00
Victor Brekenfeld 36d910056c anvil: Update to new apis 2022-01-05 21:44:58 +01:00
Victor Brekenfeld 76787fb7df renderer: Account for OpenGLs coordinate system in the Gles2Renderer 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 57f45d9941 renderer: Allow clear calls on specific regions 2022-01-04 12:50:39 +01:00
Victor Brekenfeld cc6225ce21 x11: Move window from Metadata into events
Some events (especially from xinput) cannot be cleanly mapped to a window.
Instead of requiring every event to come with a `Window` reference, move
the window into those events, that have one.
2021-12-22 19:33:33 +01:00
i509VCB e4e964c869 x11: rework impl to allow multiple windows 2021-12-03 11:03:51 -06:00
i509VCB 4f26641f8c x11: require wrapping gbm device in an Arc<Mutex<_>> 2021-12-03 11:03:51 -06:00
i509VCB 7358d8c9cb resolve new clippy lints 2021-12-02 18:18:39 -06:00
Victor Brekenfeld bd305dc7ee x11: fixup buffer age
The current code always acquires the buffer it just submitted,
which results in always rendering to a buffer with age "1", although
its contents are older, because the currently held buffer is already
submitted, just not to the swapchain. When it finally is submitted
its age is again set to 1, the other gets its correct age (but too late)
and the circle is repeated again. So lets fix that.
2021-11-29 15:55:27 +01:00
Victoria Brekenfeld a8bc2f4a50
Merge pull request #421 from Smithay/x11/swapchain
x11: use swapchain and expose age
2021-11-27 19:53:12 +01:00
Victoria Brekenfeld 8a5d030a98 x11: Use swapchain and expose age
Refactors the `X11Surface` to use the `Swapchain` internally,
which gives us a buffer age implemenation, which we can then use
to change the `Present` struct of the X11 backend to provide age
values to the user.

This change also merged the `Present` struct into the surface
because submits should now happen explicitly via a new `submit`-call
instead of being submitted implicitly on drop.
This allows the buffer to be discarded if rendering fails.
2021-11-26 22:24:12 +01:00
LoipesMas 4c514156b7
Fix ScaleDown scaling up 2021-11-26 20:57:16 +01:00
Victoria Brekenfeld 6b3a00fc06
Merge pull request #420 from i509VCB/x11/egl-drm
Rework X11 backend to use EGL for finding gbm device and associated commits
2021-11-26 13:43:49 +01:00
Victor Brekenfeld a4f2729608 gbm: expose buffer age 2021-11-24 18:57:51 +01:00
i509VCB 86716f9c9f x11: allocate buffers using gbm with modifiers 2021-11-24 18:42:24 +01:00
i509VCB 53d43905ac x11: store dmabufs in buffer object userdata 2021-11-24 18:11:27 +01:00
i509VCB e4891b0c9e
egl: Introduce EGLDevice
More specifically, this introduces a way to query the available EGL devices on a system, `EGLDevices::enumerate`.
Also this introduces a way to get the `EGLDevice` used by an `EGLDisplay`, `EGLDevice::device_for_display`

Co-authored-by: Drakulix <github@drakulix.de>
2021-11-23 10:52:02 -06:00
i509VCB 5210b39c35 anvil: deduplicate some input handler logic 2021-11-22 15:27:42 +01:00
i509VCB 3283010d2c Add Forward/Back mouse buttons 2021-10-27 12:23:12 -05:00
Poly 67ed81a00c Anvil XDG Decoration 2021-10-27 14:18:52 +02:00
i509VCB 77c970e197 winit: rework around `WinitEvent` vs `InputEvent<Special = WinitEvent>` 2021-10-27 14:16:19 +02:00
i509VCB 2e68cfda5a X11 backend 2021-10-17 13:46:15 -05:00
i509VCB c8d56f1cf3 Move X11Source to smithay under`x11rb_event_source` feature 2021-10-17 13:46:07 -05:00
i509VCB d041e5cdf6 anvil: Derive missing `fmt::Debug` 2021-10-17 13:46:07 -05:00
Poly 8114bac8fd Remove XDG Shell V6 2021-10-16 19:33:15 +02:00
i509VCB fdaf1859b0 anvil: Pass window and output maps using dispatch data AnvilState 2021-10-16 13:14:46 +02:00
i509VCB f5bf204454 anvil: Passing `ANVIL_MUTEX_LOG` uses Mutex logging drain
fmt...
2021-10-14 10:54:43 -05:00
Victor Brekenfeld 55eb73cb9e wayland/seat: add return value to `KeyboardHandle::input` 2021-09-19 17:10:08 +02:00
Victor Brekenfeld 90dd28c910 wayland/seat: Add `KeysymHandle` to allow for keycode conversions.
Currently keycodes are always converted using xkbcommons
`State::key_get_one_sym` function. This may be not what the compositor
wants, e.g. if it represents keybindings with explicit modifiers.
Applying Shift in this case changes the sym, making it necessary for
the compositor to *undo* this transformation, which is hard or even
impossible and very unnecessary, when we have all the necessary
information in smithay.

Therefor this commit replaces the `Keysym` argument of the filter
closure with a `KeysymHandle`, which allows for different variants of
keysyms to be received. Modified (as previously), unmodified or even
as a raw keycode.
2021-09-17 17:12:26 +02:00
Victor Berger cc48759338
Merge pull request #369 from i509VCB/anvil_render_fn
anvil: Split out logic for drawing layers and windows from backends
2021-08-24 14:26:22 +02:00
Victor Berger f4ba6f5bea
Merge pull request #366 from psychon/x11-event-thread
Anvil: Use a dedicated X11 event thread for event reading
2021-08-24 11:31:02 +02:00
i509VCB 5d2e601426 Fence the module I guess 2021-08-21 17:18:54 -05:00
i509VCB e020347c6b anvil: Split out logic for drawing layers and windows
At the moment also splitting our Drag and Drop requires unraveling some backend specific stuff.
2021-08-21 16:55:32 -05:00
Uli Schlachter 9af64eb0b3 rustfmt
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:53:32 +02:00
Uli Schlachter 05e5036584 Exit the worker thread when X11Source is dropped
The previous commit added a new worker thread. This thread might sit in
wait_for_event() indefinitely even after the X11Source was dropped. This
is because nothing guarantees that an X11 event will come in "soonish".
And only then would the thread notice that its main thread is gone.

This commit cleans that up by having X11Source explicitly wake up the
event thread and wait for it to exit in its Drop implementation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:37:26 +02:00
Uli Schlachter 6004ecdc14 Anvil: Move X11 event reading to a thread
x11rb caches X11 events internally. This cache is used when waiting for
the reply of a request and an event is received first.  This cache is
however also used when sending a request, because the X11 client may
never block and stop reading while writing a request. Doing so could
cause a deadlock with the X11 server.

Thus, this commit changes X11Source to spawn a thread internally. This
thread calls wait_for_event() in a loop and uses a calloop channel to
forward these events to the main loop. x11rb's RustConnection internally
uses a ConditionVariable to make sure this thread will wake up when
needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-14 17:25:51 +02:00
Christian Meissl 85fa46ad2c Add example for setting the initial popup geometry 2021-08-04 23:12:22 +02:00
Christian Meissl 6d3d5f7933 implement popup protocol checks 2021-08-04 23:12:22 +02:00
Christian Meissl b36cfbb392 add v3 positioner fields and handle requests
add support for xdg_popup reposition
increment supported wm_base version to 3
2021-08-03 15:57:22 +02:00
Poly 524501b2e8 anvil: split `bring_nth_window_to_top` to separate fn 2021-07-31 22:36:55 +02:00
Poly f0cdb235d7 anvil: implement xdg-activation 2021-07-31 21:16:39 +02:00
Poly 115403633b anvil: Implement wlr_layer_shell 2021-07-31 13:44:04 +02:00
Poly 217b63f106 Fix Clippy for Anvil 2021-07-30 18:10:48 +02:00
Victor Berger 3387957065 CI: deny warnings in anvil 2021-07-25 10:14:08 +02:00