Commit Graph

851 Commits

Author SHA1 Message Date
Victor Brekenfeld 37adc1174c utils: Add Rectangle::contains_rect 2021-12-17 14:47:43 +01:00
Victor Brekenfeld 3c7bbf65c4 utils: Add Rectangle::to_i32_* variants 2021-12-17 14:47:43 +01:00
i509VCB b80281dcc8
x11: fix window drop not destroying 2021-12-15 20:04:53 -06:00
i509VCB 09ce3da742 x11: Do not hold lock when dispatching events 2021-12-06 16:39:02 -06:00
Christian Meissl 6b1788d002 rewind the keymap file before
passing it to clients
2021-12-05 17:40:47 +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 210ab8fb21 allocator: general impls for Arc<Mutex<_>> and Rc<RefCell<_>> 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
Victor Brekenfeld 485aa2a9c7 swapchain: Do not increase the age of 0-age slots
Slots with an age of 0 were never rendered to. This means
we should not increase their age, when others are submitted
or the renderer might wrongfully assume usuable contents are
available in the buffer.
2021-11-29 15:36:53 +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
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
Victor Brekenfeld 6c57e27e5e swapchain: Support buffer age 2021-11-24 18:57:51 +01:00
Victor Brekenfeld 643ff5395d gbm: Refactor: remove internal `Buffers` struct 2021-11-24 18:57:51 +01:00
Victor Brekenfeld 9584219ffa swapchain: Use `UserDataMap` instead of generic parameter 2021-11-24 18:57:49 +01:00
Victoria Brekenfeld a4fab6633c
Merge pull request #406 from i509VCB/input/remove-dispatch-new
input: remove `InputBackend::dispatch_new_events`
2021-11-24 18:57:01 +01:00
i509VCB 5506c7e1c5 apply cargo fmt and clippy 2021-11-24 18:43:37 +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
Victor Brekenfeld 42b646a152 x11: Initialize via egl instead of dri3 if possible 2021-11-24 18:11:26 +01:00
Christian Meissl c34a0dd4a5 fix xdg doc link 2021-11-24 16:57:04 +01:00
Christian Meissl 81f1e8b84d fix doc comment 2021-11-24 16:57:04 +01:00
Christian Meissl 2123760c9e make attributes state functions public in xdg shell 2021-11-24 16:57:04 +01:00
Christian Meissl 4f36e03266 allow xdg_role macro configure without braces 2021-11-24 16:57:04 +01:00
Christian Meissl a22b211e29 move the duplicate xdg state handling to...
...the base macro implementation
2021-11-24 16:57:04 +01:00
Christian Meissl 4849ae3b4a use the last configured decoration mode...
...to check for decoration mode changes instead
of the current decoration mode
2021-11-24 16:57:04 +01:00
Christian Meissl 29010d93a4 use the last pending server state...
...or last acked if available instead of the current state
2021-11-24 16:57:04 +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
Victor Brekenfeld 8bf7d91f98
backend/drm: Do not open new file descriptors in `DrmNode`
`DrmNode` was made to manage open drm nodes (including render nodes)
without having to create a `DrmDevice`. Even if opening render nodes
*should* work in general on most systems, the user should be in charge
of opening device, because they *may* want to use a `Session` or
something else. Therefor remove all `open` calls from drm/node.

The X11-backend, which tries to optain a render node, now opens the
render node itself, if getting a path proves to be successful.
2021-11-23 10:09:48 -06:00
i509VCB 7b1c0501f3 clean up warnings from github 2021-11-23 14:45:38 +01:00
i509VCB d1fae4ba4e
Merge branch 'master' into input/remove-dispatch-new 2021-11-22 18:19:46 +00:00
Victor Brekenfeld 87069f26e9 renderer: rename function parameters for clearer purpose 2021-11-22 16:38:31 +01:00
Victor Brekenfeld 011a7da665 renderer: Remove render_texture from Frame 2021-11-22 16:38:31 +01:00
Victor Brekenfeld 7a7f1217d8 renderer: Allow to set texture filtering methods 2021-11-22 16:38:31 +01:00
Christian Duerr 076f824431 Add version method to ToplevelSurface
Currently the `shell_surface` is not accessible to the outside, meaning
there is no way to query for the XDG shell protocol version supported by
the client.

Adding a `version` method fixes that problem, which allows compositors
to act differently based on the supported protocol version. As an
example this allows setting the state to `State::Maximized` if the
tiling states are not available.
2021-11-22 15:28:09 +01:00
Adrien 4dec5f7fa2 Fixed a typo in the lib.rs docs. 2021-11-22 15:27:57 +01:00
i509VCB d00197052c x11: add option to make extensions optional 2021-11-22 15:26:52 +01:00
Christian Duerr 0d2c3acdc7 Add debug assertion 2021-11-22 15:25:47 +01:00
Christian Duerr d46be20d6e Add SubAssign for Size 2021-11-22 15:25:47 +01:00
Victor Brekenfeld cf6f7a0726 gbm: use Xrgb8888, if alpha variant is not available 2021-11-04 19:13:57 +01:00
i509VCB 8ca5d1f301 input: remove `InputBackend::dispatch_new_events` 2021-10-28 15:37:02 -05:00
i509VCB 3283010d2c Add Forward/Back mouse buttons 2021-10-27 12:23:12 -05:00
i509VCB e1400a1926 Mention where keyboard key code constants may be found 2021-10-27 12:23:07 -05:00
Poly 63f9a713ce Clippy fixes 2021-10-27 14:18:52 +02:00
Poly 10aee60b87 wayland.xdg-decor: Implement XDG Decoration protocol 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
Victor Brekenfeld 3dde8d70ef Update to input-rs 0.7 2021-10-23 22:49:32 +02:00
Victor Brekenfeld 2aedeead7d Fix clippy needless_return 2021-10-23 15:34:50 +02:00
Victor Brekenfeld af8863578e Fix trailing_semicolon on egl macro 2021-10-23 15:24:55 +02:00
Victor Berger 121014a9eb compositor.cache: fix MultiCache::has() 2021-10-18 19:33:49 +02:00
i509VCB 2e68cfda5a X11 backend 2021-10-17 13:46:15 -05:00
i509VCB 953d9ce158 Implement `Hash` on some enums in `backend::input` 2021-10-17 13:46:07 -05:00
i509VCB c8d56f1cf3 Move X11Source to smithay under`x11rb_event_source` feature 2021-10-17 13:46:07 -05:00
i509VCB 4d93805814 Add `DrmNode` to `backend::drm`. 2021-10-17 13:46:07 -05:00
Poly 8114bac8fd Remove XDG Shell V6 2021-10-16 19:33:15 +02:00
Demi Marie Obenour a9f1188fea Add missing check for dead surfaces
Previously a pointer.leave event would be sent with a NULL target,
causing the client to disconnect.
2021-10-16 13:32:03 +02:00
Victor Brekenfeld bafc378181 wayland/dmabuf: Allow global creation with a client filter 2021-09-30 18:37:54 +02:00
Victor Berger 3842b78979 wayland.compositor: fix leak of surface data
The subsurface logic holds a self-reference to the WlSurface to
track stacking orders of the children relative to the parent. This
self-reference needs be dropped during cleanup to avoid reference
cycles.

This was not the case, and caused every surface user data to be
leaked as it kept a reference to itself (and all of its children).
2021-09-28 16:30:46 +02: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 d0ee7d831e
Merge pull request #367 from PolyMeilex/fix-2
backend.libseat: Fix dispatch double borrow
2021-08-31 10:34:24 +02:00
i509VCB b07f1af494
Implement Coordinate for all numerical types (#372)
This allows Size, Point and Rectangle to be made with any numeric type
2021-08-30 22:02:00 +02:00
Poly 10cab4eab9 backend.libseat: Fix dispatch double borrow 2021-08-26 01:00:31 +02:00
Christian Meissl 6d3d5f7933 implement popup protocol checks 2021-08-04 23:12:22 +02:00
Christian Meissl 477f737b95 filter tiled toplevel states if not supported 2021-08-04 23:12:16 +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 ea59b2f522
wayland.xdg-activation: fix `retain_requests` typo
Co-authored-by: Victor Berger <vberger@users.noreply.github.com>
2021-07-31 22:38:42 +02:00
Poly f24332f4b4 wayland.xdg-activation: Initial implementaion 2021-07-31 21:16:39 +02:00
Poly 1c6db1e7ee wayland.shell.layer: change role static to constant 2021-07-31 13:45:57 +02:00
Poly 84d3d6e609 wayland.shell: implement wlr_layer_shell 2021-07-31 13:44:04 +02:00
i509VCB 23a8af399d xdg-foreign
This is very much incomplete, but it implements the import and export of surfaces. However functions related to setting and imported surface the parent of another surface is not done.

importer destructor destroys all imports made from the same client 


Implement SetParentOf, no undoing yet


Add inner import type


Destroy child surface relationships when importing


A note


move init function upwards


use 0.29.0 crate


Move role string constants into the public


Use toplevel_like for surface checks in foreign


add methods to get the parent surface


Make sure ZXDG roles are public api


Consistent ordering of parameters on xdg_foreign impl methods


Let's update the changelog


Document how to use xdg_foreign


wl_shell_surface is likely invalid, so it cannot be imported or exported


Changelog suggestions


remove redundant inner ref cell


Remove all uses of the refcell like behavior


Allow compositor to export surfaces on server



Appease new clippy lints


then


Use string references and iterate in reverse to simplify removals


heed request for order
2021-07-31 11:40:24 +02:00
Poly df9be985ca Fix Clippy 2021-07-30 18:10:48 +02:00
Poly e3522dfb34
backend.egl: Early return on dead buffers (#352) 2021-07-28 23:31:43 +02:00
Poly c136cd5f34 wayland.data_device: Early return on protocol error 2021-07-27 09:32:34 +02:00
Poly 6856ae891f wayland.data_device: Add None as a valid DND action 2021-07-27 09:32:34 +02:00
Victor Berger 07deba4c1b Documentation fixes in preparation for release 2021-07-25 11:19:09 +02:00
i509VCB 7e4eff529e Put smithay's docs through a spell checker.
I noticed quite a few spelling errors, so I fixed a whole bunch of them.
2021-07-25 09:09:56 +02:00
Victor Berger 5524f1f6bd Deny warnings in CI 2021-07-25 09:09:12 +02:00
Victor Berger 782b21f363 Update dependencies 2021-07-25 09:09:12 +02:00
Victor Brekenfeld 3cc89dcf6e gles2: expose texture id 2021-07-25 08:30:01 +02:00
Victor Brekenfeld 3e4d93dfff egl: Fix segfault in egl logging for empty command strings 2021-07-25 08:29:41 +02:00
Poly 7e4e78151a Implement XdgOutput protocol 2021-07-24 18:51:27 +02:00
Victor Brekenfeld 6933494b6a docs: some backend clarifications 2021-07-16 00:34:00 +02:00
Victor Brekenfeld 945d7128d8 Backend documentation fixes and additions 2021-07-15 20:53:05 +02:00
Victor Brekenfeld 1cf1d4739b buffer: use Size instead of width/height 2021-07-13 23:37:28 +02:00
Victor Brekenfeld 00fb4561b7 gles2: Enable scissor test for optimization.
Skips unnecessary drawcalls outside of the viewable area.
This may happen with textures rendered over the edges of our screen.
2021-07-13 23:28:11 +02:00
Victor Brekenfeld 8bd17d71d2 renderer: Support cropping and scaling 2021-07-13 23:28:07 +02:00
Victor Brekenfeld 56f5557f8c anvil: Move import_bitmap into anvil 2021-07-13 23:21:08 +02:00
Victor Brekenfeld a938c2874f gles2: Allow usage of raw-gl calls out-of-tree 2021-07-13 23:21:08 +02:00
Christian Meissl d09de13bfc use size for transformed functions 2021-07-13 22:38:32 +02:00
Christian Meissl 72e4d910fe implement fractional HiDPI scaling
expose output from output map and return a reference
in find

change scale with keyboard shortcut

scale input coordinates and render location
according to output_scale

scale buffers during rendering

adapt window locations on output scale
change to that the location will appear
to be stable

scale udev pointer location on output scale
change to make the pointer location appear stable

Use a UserDataMap to store the udev output id

Short names for udev outputs for easier output
scale configuration
2021-07-13 22:38:32 +02:00
Victor Berger e60374a459 Fix unused imports 2021-07-13 14:23:21 +02:00
Victor Berger 0bad0a4a62 move input.rs to input/mod.rs, same for libinput.rs 2021-07-13 14:23:21 +02:00
Victor Berger 54ea0d3a74 Introduce Logical/Physical Point/Rectangle 2021-07-13 13:58:06 +02:00
Victor Brekenfeld 510c0a5400 egl: Add debug logging
Add debug logging to egl via the `EGL_KHR_debug` extension similar to our
support for `GL_KHR_debug`. Sadly unlike the GL-extensions the EGL-extension
does not let us provide any user-data for the callback, so we fall back to
using `slog-stdlog`, when available.

Since we only want to initialize this once, when libEGL gets loaded and
not per display, but we need to query the list of supported extensions
first, some initialization steps where moved around.
2021-07-10 20:07:12 +02:00
Victor Brekenfeld 3e2f2afa28 egl: Let the native surface handle attributes
The required surface attributes for egl surface creation might be very
dependent on the used egl platform. Therefor let the native surface type
handle the attributes instead of deriving them from a set of properties.
2021-07-10 20:05:08 +02:00
Victor Brekenfeld d97a9f9970 egl: Fix egl display handle visibility
Currently there is no way to get the raw handle of an `EGLDisplay`, but
this can be necessary for implementing additional egl platforms out-of-tree.
2021-07-10 19:48:00 +02:00
Poly 07743faad2 Apply suggestions from code review & Rebase 2021-07-05 23:57:28 +02:00