Commit Graph

264 Commits

Author SHA1 Message Date
Victor Brekenfeld ccd86cd8c1 anvil: Do not throw rendering errors away 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 795903d7e0 anvil: Fixup compiling egl support 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 0661ebebb8 anvil: Properly free textures 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 30a8693789 anvil: Reintroduce egl buffer support 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 45cd37373a anvil: Render software cursors again 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 43d3e9cd14 anvil: Fixup udev/tty backend, so that it runs at least 2021-05-15 16:12:12 +02:00
Victor Brekenfeld 2c9c150e5e renderer: Remove `Frame` trait and merge into `Renderer`
Tracking of Frames, so that only one unique one can exist at a time
(gles does not allow multiple frames being rendered in parallel)
lead to very unfriendly lifetime-heavy code. A renderer is already
*unique*, just move the code there and add an error variant to catch
misuses.
2021-05-15 16:12:12 +02:00
Victor Brekenfeld fb30c830d7 Fixup anvil for winit rendering
- Since a lot of functionality is now in smithay's rendering module
  we can get rid of shm_load, shaders and the glium dependency.
- glium_drawer becomes drawing and only features some code to get from surfaces
  to textures for any(!) renderer.
  (Should probably moved into smithay at some point as well.)
- buffer_utils is only necessary to query the buffer size anymore.
- disable egl-buffer support temporarily
2021-05-15 16:12:12 +02:00
Victor Berger 991eba216d Update most dependencies 2021-02-22 20:27:46 +01:00
Uli Schlachter ff09b8e116 Use the correct position for Xwayland surfaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 3504182a5e Add a new surface role for Xwayland surfaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 734b541ecd Map between X11 Windows and WlSurfaces
Xwayland gives us a mapping between X11 window and WlSurface IDs via
special WL_SURFACE_ID messages. This commit uses these messages to find
the corresponding WlSurface. For this, the new client.get_resource API
from wayland-server is needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter a6c40a002b Add an X11 EventSource to calloop
This commit creates an event source for calloop that receives X11 events
from the X11 server.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter df01587459 Become the X11 window manager after Xwayland startup
This commits adds the necessary magic incantations to become the X11 WM
after Xwayland starts.

This uses the pure-Rust implementation from x11rb, but any other X11
crate could be used as well.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Uli Schlachter 2f0dadd6ca anvil: Add a xwayland feature
This commit adds an xwayland feature to anvil. Right now, this feature
doesn't do much. anvil uses the smithay code to start XWayland, but does
not do anything with it once it is running.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-19 11:38:17 +01:00
Victor Berger 36e11284c2 New clippy fixes 2020-11-02 10:24:55 +01:00
Victor Berger 8fde779806 Dependencies updates 2020-11-02 10:24:55 +01:00
Eric Anholt 78d28165c3
Update nix to 0.19 (#237) 2020-10-31 18:33:18 +01:00
Victor Berger d3429fa37d anvil: send frame callback before blocking to draw on winit 2020-10-26 12:52:28 +01:00
Victor Berger 5421b9675c anvil: send millisecond time in frame callback
This is what the protocol requires, and apps rely on it to figure
out how long time elapsed between draws.
2020-10-26 12:52:28 +01:00
Jonas Platte bcc8f13b2b Fix most rustc & clippy warnings 2020-09-16 12:56:32 +02:00
Mateus Carmo M de F Barbosa 2a351d0879 Use Serial type for all serials 2020-08-27 13:07:01 +02:00
Victor Berger 49dda88c63 backend.input: keep sub-pixel precision in events
libinput provides sub-pixel precision for pointer motion & touch events.
Keep this precision by switching all coordinates values from input
events to f64 (rather than i32 or u32). Otherwise, values are rounded
and part of the movment is lost.

Potentially fixes #224
2020-07-13 17:56:20 +02:00
Victor Brekenfeld 9c3c3d939e cargo fmt & lint 2020-06-28 00:25:15 +02:00
Victor Brekenfeld 3fd336aba5 anvil: GliumDrawer handle hardware cursors and track state 2020-06-28 00:23:24 +02:00
Victor Brekenfeld bf011e8071 anvil: Introduce BufferTextures 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 4930e7e8b2 anvil: create a texture per backend 2020-06-28 00:23:24 +02:00
Victor Brekenfeld f84d6cb180 anvil/udev: do not upload a cursor every frame 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 7e75a68e57 anvil: allow swapping monitors via shortcut 2020-06-28 00:23:24 +02:00
Victor Brekenfeld 33fb393383 anvil: clamp input to current output instead of full hd 2020-06-28 00:23:22 +02:00
Victor Brekenfeld d7f800c76d anvil: create and render to multiple outputs independently 2020-06-28 00:05:01 +02:00
Victor Brekenfeld 9fd8dd9cec anvil: allow draw_windows to take optional output coordinates 2020-06-28 00:05:01 +02:00
Victor Brekenfeld 7b4459f649 drm: Make surfaces `Send` 2020-06-11 18:57:05 +02:00
Victor Brekenfeld cc67764c23 make clippy happy 2020-06-11 12:16:43 +02:00
Victor Berger a717fa36cd backend.session: Migrate to using Signaler
Change the session backend to rely on Signaler to propagate its
signals. Also introduce the Linkable trait to allow generic composition
of objects needing to listen for signals.
2020-05-23 21:37:22 +02:00
Victor Berger c3859d999b backend.session: use pkg-config to find logind lib
Introduce the `backend_session_elogind` cargo feature which pulls
`backend_session_logind` and makes the logind session backend seek
`libelogind.so` instead of `libsystemd.so`.

Fixes #127
2020-05-23 21:37:22 +02:00
Victor Berger b05c2ccbba backend.session: rework as calloop event sources
Rework the Session Notifiers so that they are calloop event sources
by themselves, allowing them to be inserted by the user without the
`bind_session` dance.

Also update the logind backend to use the current dbus-rs API, rather
than the deprecated one.
2020-05-23 21:37:22 +02:00
Victor Brekenfeld 0c19a461b6 anvil: use fallback-device for gbm/nvidia 2020-05-23 00:29:32 +02:00
Victor Brekenfeld 38d3db565a anvil: do not double initialize surfaces with multiple matching encoders 2020-05-23 00:29:32 +02:00
Victor Brekenfeld 64a57a4cc8 downgrade some recoverable errors to warnings 2020-05-12 20:03:03 +02:00
Victor Brekenfeld f1c40f7306 lint: fmt & clippy 2020-05-12 20:03:03 +02:00
Victor Brekenfeld 7518f8c0f7 anvil: retry initial renderings 2020-05-12 19:47:10 +02:00
Victor Berger b708f88da6 anvil: Fuse InputHandler into AnvilState 2020-05-12 08:46:34 +02:00
Victor Berger 8f543eb597 backend.input: rework libinput as a calloop source 2020-05-12 08:46:34 +02:00
Victor Berger 5552c81a32 anvil: Introduce InputInitData to simplify function prototypes 2020-05-02 13:27:35 +02:00
Victor Berger 35d8cea547 anvil: Introduce RenderTextureSpec to simplify render_texture 2020-05-02 13:27:35 +02:00
Victor Berger 64aedce01f anvil: Introduce ShellHandle type to simply return values 2020-05-02 13:27:35 +02:00
Victor Berger 743a80c004 anvil: remove unused imports 2020-05-02 13:27:35 +02:00
Victor Brekenfeld 28166ce002
Merge pull request #206 from Smithay/fix/drm_connector
Fix drm mode and connector handling
2020-05-01 16:46:36 +02:00
Victor Brekenfeld 9300e35093 lint: fmt 2020-04-30 19:03:02 +02:00
Victor Brekenfeld 31b6d84442 WIP: Rework egl and glium errors 2020-04-30 00:24:35 +02:00
Victor Berger 31f1f4f9e0 backend.udev: rework as an event source 2020-04-28 11:13:25 +02:00
Victor Berger 104774eeb0 Minor clippy fixed 2020-04-28 11:13:25 +02:00
Victor Berger b3aae074e4 Update calloop to 0.6 2020-04-28 11:13:25 +02:00
Victor Berger eddbe3c708 Update wayland-rs to 0.26 2020-04-28 11:13:25 +02:00
Victor Berger d2e77dca31 Alphabetically sort dependencies 2020-04-28 11:13:25 +02:00
Victor Brekenfeld d6fa2e96cf drm: Require all surfaces to always have a mode set 2020-04-27 00:45:58 +02:00
Victor Brekenfeld a4203bd216 examples/anvil: add disable_connectors for device creation 2020-04-27 00:45:58 +02:00
Victor Berger d48c04fd7b anvil: Implement subsurface state caching 2020-04-22 12:12:57 +02:00
Victor Berger 315797ff43 anvil: bulk-send frame events after each page flip 2020-04-22 12:12:57 +02:00
Victor Berger 59f7167702 anvil: move common logic into AnvilState 2020-04-22 12:12:57 +02:00
Victor Berger cd6e148143 anvil: restore correct dispatching of wayland clients 2020-04-22 12:12:57 +02:00
Victor Berger 548a929d1c wayland.compositor: Correct frame callback handling 2020-04-22 12:12:57 +02:00
Victor Berger 1736db27b4 anvil: set saner values for key repeat rate 2020-04-21 23:04:23 +02:00
Victor Brekenfeld 24a51f721d anvil: use fallback-device for atomic/legacy 2020-04-21 20:18:35 +02:00
Victor Brekenfeld d30bd4555e anvil: use atomic modesetting 2020-04-21 20:18:34 +02:00
Victor Brekenfeld 8ba33f2473 anvil: Report errors of failed device initializations 2020-04-21 20:18:34 +02:00
Victor Berger 61fecb44cf anvil: disable clippy lint for glium macros 2020-04-21 15:00:00 +02:00
Victor Brekenfeld bcb2aa3864 Fix egl_to_texture check 2020-04-18 15:03:20 +02:00
Chandler Newman f7c05fa064 Rename WaylandEGLDisplay to EGLBufferReader 2020-04-15 21:19:20 +01:00
Chandler Newman a684f5d8d6 Refactor EGL backend 2020-04-15 12:01:01 +01:00
Victor Berger 8ab34f0081 Update dependencies. 2020-04-15 11:24:50 +02:00
Victor Berger b54d95c15d
Fix most clippy warnings (#185)
* Add missing documentation

* Fix most clippy warnings
2020-04-15 09:28:22 +02:00
Victor Brekenfeld b43c0db115 Update to udev 0.4 2020-04-13 17:07:08 +02:00
Victor Brekenfeld 2b5c0448eb anvil: Fix udev build without egl 2020-04-11 13:47:01 +02:00
Victor Brekenfeld f6b3d630ce rustfmt 2020-04-10 19:18:58 +02:00
Victor Brekenfeld e8e8667d89 Upgrade to the upcoming drm-rs 0.4 2020-04-10 16:58:49 +02:00
Victor Berger 1b5537d537 Restore logind as a default feature 2020-04-05 20:03:09 +02:00
Jonas Platte b8c20ebf30
Update wayland-rs to 0.25 (#171)
Update wayland-rs to 0.25 and calloop to 0.5

Co-authored-by: Victor Berger <victor.berger@m4x.org>
2020-04-05 19:01:08 +02:00
Victor Berger a60e1cd7fd
Merge pull request #156 from YaLTeR/resize
anvil: implement the Resize request
2020-02-12 22:57:32 +01:00
Ivan Molodetskikh e1396d2e1a
anvil.shell: add our own ResizeEdge
It mirrors the one in wl_shell_surface and lets us not depend on it.
2020-02-11 11:06:36 +03:00
Ivan Molodetskikh c0d0d0d2b8
anvil.shell: respect min and max size in resize 2020-02-08 18:36:09 +03:00
Ivan Molodetskikh e76f9f14ed
anvil.shell: store min_size and max_size 2020-02-08 13:51:12 +03:00
Ivan Molodetskikh adbab32bd8
anvil.shell: update location on top-left resizing 2020-02-08 13:51:11 +03:00
Ivan Molodetskikh 60ca2f9c88
anvil.shell: don't send first configure to WlShell
It doesn't need it, and it also takes the (0, 0) size literally, which
makes everything try to be the smallest size possible initially.
2020-02-08 09:53:50 +03:00
Ivan Molodetskikh 09d7f597d4
anvil.shell: refresh toplevels on commit
This updates the toplevel state in the WindowMap as soon as it's
committed. It will be used to update the toplevel location on top-left
resize, but this is a better approach in general than the current
update-every-drawn-frame. I think we should update the WindowMap state
as soon as possible, and only when necessary.
2020-02-08 08:47:14 +03:00
Ivan Molodetskikh ab45cdecdc
anvil.window_map: add refresh_toplevel 2020-02-08 08:47:14 +03:00
Ivan Molodetskikh 223b523f80
anvil.window_map: add WindowMap::find 2020-02-08 08:47:14 +03:00
Ivan Molodetskikh 6d36375f27
anvil.window_map: implement Clone for Kind 2020-02-08 08:47:14 +03:00
Ivan Molodetskikh ca7e91a98c
anvil.shell: implement the Resize request
Currently doesn't move the window when resizing left or top.
2020-02-08 08:47:13 +03:00
Ivan Molodetskikh 546ff48af5
anvil.window_map: add WindowMap::geometry 2020-02-03 16:54:11 +03:00
Ivan Molodetskikh 9fd9db82ae
anvil.shell: store geometry in SurfaceData 2020-02-03 16:54:11 +03:00
Ivan Molodetskikh ebb3a05502
anvil: make get_size and contains_point methods
This removes the need to store them as generic members, and will ease
the addition of new methods.
2020-02-03 16:54:11 +03:00
Ivan Molodetskikh 533a006bd1
anvil.window_map: fix bbox computation
It said max_y = y + w instead of y + h.
2020-02-03 16:54:11 +03:00
Ivan Molodetskikh 5814626dbe
anvil.window_map: rename input_bbox to bbox
Since this value turns out to be more useful than for just input fast
path.
2020-02-03 16:54:10 +03:00
Victor Berger 7fa7fe03be
Merge pull request #155 from YaLTeR/fix-dimensions
anvil: retrieve buffer dimensions on commit
2020-02-03 14:53:35 +01:00
Ivan Molodetskikh a224f774ee
anvil: store buffer dimensions separately
Before this change, the texture size was used for the dimensions.
However, the texture is not created until the next rendered frame, which
means that frequently size was returned as zero, resulting in pointer
focus artifacts. With this change, the dimensions are retrieved
immediately on surface commit.
2020-02-03 12:56:59 +03:00
Ivan Molodetskikh 825995687a
anvil: add BufferUtils
A helper struct which currently contains only a method for retrieving
buffer dimensions. Will be used for getting the buffer dimensions early,
before rendering, to always have up-to-date size which is not zero.
2020-02-03 12:56:59 +03:00
Ivan Molodetskikh 32613f3cd6
anvil.shell: check that grab is correct in Move
Check that the grab had a focus and it was the same client as this
surface.
2020-02-03 12:31:39 +03:00
Ivan Molodetskikh d8495d81f2
anvil.shell: check that there's a grab before Move
If there's no click grab then the request is invalid.
2020-02-03 12:31:38 +03:00
Ivan Molodetskikh 03392bf7d1
seat: add GrabStartData to PointerGrab
Stores the data about the event that started the grab. Will be useful
for things like move and resize requests.
2020-02-03 12:31:38 +03:00
Ivan Molodetskikh 24af494cbf
anvil.shell: implement the Move request 2020-02-03 07:51:05 +03:00
Ivan Molodetskikh 0ea4ec9abe
anvil.window_map: add WindowMap::set_location 2020-02-02 15:37:06 +03:00
Ivan Molodetskikh a51e421c19
anvil.window_map: add WindowMap::location 2020-02-02 15:37:06 +03:00
Ivan Molodetskikh 69b1c1870e
anvil.window_map: add Kind::equals 2020-02-02 15:37:06 +03:00
Ivan Molodetskikh 13cac4f693
anvil.shell: use correct region in contains_point
The one in SurfaceAttributes has potentially not been committed yet, and
the one in SurfaceData is the most up-to-date committed one.
2020-02-02 12:45:35 +03:00
Ivan Molodetskikh fac4ca260e
anvil.shell: store input_region in SurfaceData
This is the most up-to-date committed input region.
2020-02-02 12:45:35 +03:00
Ivan Molodetskikh fd50b45e61
anvil: implement input region check 2020-01-22 08:06:15 +03:00
Ivan Molodetskikh d30567512c
anvil.window_map: use Rectangle::default 2020-01-22 07:47:10 +03:00
Ivan Molodetskikh aa65f3608d
anvil: add a contains_point fn for Window.matching
Currently implemented to be equivalent to the previous size-based check.
This will allow implementing an input-region-aware check.
2020-01-22 07:46:26 +03:00
Ivan Molodetskikh 9bfa85efc9
anvil.window_map: add some comments 2020-01-22 06:58:41 +03:00
Ivan Molodetskikh 09908d8de8
anvil.window_map: rename surface to input_bbox
Much clearer what it does.
2020-01-22 06:57:45 +03:00
nycex 0140de89fb fix some clippy warnings (#147)
This commit removes some clippy warnings (to advance #45) by doing the following:
- replace usage of `mem::uninitialized()` with `MaybeUninit`
- replace usage of `nix::libc::{uint64_t, int32_t}` with `{u64, i32}`
- replace functions inside of `Option::ok_or` with `Option::ok_or_else`
- replace functions inside of `Result::unwrap_or` with `Result::unwrap_or_else`
- replace occurrences of pass-by-reference with pass-by-value when
  appropriate
- replace unused variables in pattern-matching with wildcards
- replace `match` expressions that have only one case with `if let`
  expressions
- replace UpperCamelCase names of consts with SCREAMING_SNAKE_CASE
- remove `clone()` on types that implement Copy
- remove redundant imports
- remove `fn main()` from doctests
- remove let binding for variables that are returned afterwards
2020-01-01 11:43:16 +01:00
Wesley Moore ac0566ca88 Make winit backend exit on Super-Q 2019-08-23 16:55:51 +02:00
Victor Brekenfeld f8f4f461c7
Merge pull request #144 from Smithay/pr/fix/anvil_buffer_leak
anvil: release old buffers on commit
2019-08-23 16:50:14 +02:00
Victor Brekenfeld 056a86ad30 anvil: release old buffers on commit 2019-08-23 15:16:18 +02:00
Victor Berger e4f1872a43 anvil: properly document logind support 2019-06-19 15:07:01 +02:00
Victor Berger d62fb4c8b5 wayland.shell.xdg: use UserDataMap 2019-04-27 21:38:24 +02:00
Victor Berger c604a48dce wayland.compositor: user UserDataMap to store per-surface data 2019-04-27 21:38:24 +02:00
Victor Berger 0712bdefec anvil.glium_drawer: fix buffer release order 2019-04-22 17:20:46 +02:00
Victor Berger 9f9e6d4329 wayland.compositor: rework the subsurface tree
Rework the subsurface tree by:

- forbidding subsurface loops
- storing the relative depth of a parent to its children,
  finally respecting the wl_subsurface specification.

closes #23
2019-04-22 17:20:46 +02:00
Victor Berger 5768e1fd87 Upgrade dependencies 2019-02-24 11:23:11 +01:00
Jonas Platte f34cf4b068 Upgrade anvil to wayland-server 0.23 2019-02-24 08:23:51 +01:00
Victor Berger 3f2857fbf3 Update smithay to wayland-server 0.23 2019-02-24 08:23:51 +01:00
Victor Berger 89dce178c8 Make wayland support optional 2019-02-06 09:29:56 +01:00
Victor Brekenfeld cc5d55f535 rustfmt fixes 2018-12-17 16:58:49 +01:00
Victor Brekenfeld e5f8c351c7 Check for rust_2018_idioms 2018-12-16 19:31:38 +01:00
Victor Brekenfeld 71bd64a6bf Fix source code for 2018 edition 2018-12-16 19:31:38 +01:00
Victor Brekenfeld 90c0112cd3 Let all anvil features compile standalone 2018-12-15 20:18:38 +01:00
Victor Brekenfeld dc97e0ad03 Add reexports module 2018-12-14 14:26:50 +01:00
Victor Berger d1d608ab2b anvil: draw custom cursors and dnd icons 2018-12-11 10:21:59 +01:00
Victor Berger 280decf863 data_device: support for custom DnD icons 2018-12-11 10:21:59 +01:00
Victor Berger f3a68fb1af seat: support for curstom cursor images 2018-12-11 10:21:59 +01:00
Victor Brekenfeld a3acd48cc3 fmt: rust 1.31 2018-12-08 18:31:08 +01:00
Victor Brekenfeld 14d2e6e373 anvil: explain the implementation a bit more 2018-12-05 22:48:12 +01:00
Victor Brekenfeld b160a91f8a drm: remove mode & connector arguments of create_surface 2018-12-03 23:29:30 +01:00
Victor Brekenfeld 99f9156f64 anvil: clear window map on drop 2018-12-03 23:29:30 +01:00
Victor Brekenfeld f8a5e8bfde anvil: allow for non-egl builds 2018-12-03 23:29:30 +01:00
Victor Brekenfeld f2466c5c50 drm: Fix drop order 2018-12-03 23:29:30 +01:00
Victor Brekenfeld a745eace15 anvil: fix tty swap 2018-12-02 22:01:45 +01:00
Victor Brekenfeld 0ed69bf2da session: Add multiplexer 2018-12-02 22:01:45 +01:00
Victor Brekenfeld 9428853ad6 anvil: fix for drm backend changes 2018-11-29 19:41:15 +01:00
Victor Brekenfeld 91e237f697 anvil: remove raw_tty backend 2018-11-29 16:13:07 +01:00
Victor Berger ed00fb1d47 data_device: move default_action_chooser into smithay 2018-11-22 15:37:31 +01:00
Victor Berger d41517f85b data_device: let the compositor interact with the selection 2018-11-21 22:24:18 +01:00
Victor Berger 35645596a8 data_device: let the compositor decide the action choice strategy 2018-11-21 16:01:34 +01:00
Victor Berger 81956c8fd0 data_device: basic DnD support 2018-11-21 15:28:41 +01:00
Victor Berger 0434cbb90d data_device: basic selection support 2018-11-20 11:56:04 +01:00
Victor Berger 5e9ad96b0f seat: add a keyboard focus hook 2018-11-18 23:04:30 +01:00
Colin Benner 734d2ce996 Fmt, spelling and capitalisation fixes (#113)
* Rename priviledged to privileged in backend/drm/mod.rs

* Fix a number of typos in comments

* Fix typos in string literals

* Wrap identifiers with backticks in doc comments

* Spelling and capitalisation in doc comments

* Use XWayland in comments

This seems to be the standard capitalisation, even though the executable
is called `Xwayland`.

* Use Glium instead of glium in comments

* Use DRM and API in comments

* Fix remaining occurrence of 'priviledged'

* Reformat code to appease Travis' rustfmt
2018-10-30 13:56:30 +01:00