Commit graph

138 commits

Author SHA1 Message Date
Ian Douglas Scott
a90c7bca04 Use cfg_aliases crate to make Wayland/X #[cfg(..)] less redundant 2023-01-03 12:45:18 -08:00
Ian Douglas Scott
4f6542ceaa Add support and CI tests for BSDs
This adds a fallback using `shm_open`/`shm_unlink` for platforms where
`memfd_create` doesn't exist. This seems to be how this is normally
handled, though it's a bit ugly.

This also builds the wayland/x11 code for NetBSD/OpenBSD/DragonFlyBSD.

Add CI builds for FreeBSD and NetBSD. We would need some kind of
virtualisation though to actually run tests on such targets.

I've tested the `shm_open` logic on Linux, but haven't run it on any
BSDs.
2023-01-03 12:45:15 -08:00
David Johnson
afe6da235b
Merge pull request #56 from i509VCB/doc-wayland-set-buffer
detail platform specific behavior of set_buffer on Wayland
2023-01-03 00:11:02 -06:00
i509VCB
4aac1d2860
detail platform specific behavior of set_buffer on Wayland 2023-01-01 13:52:47 -06:00
Ian Douglas Scott
aad40343bc wayland: Block dispatching if back buffer isn't released
https://github.com/rust-windowing/softbuffer/issues/41

If `set_buffer` can just be called in a loop without waiting for buffers
to be released or a frame callback, but can also be called in other
ways, I don't know if there's a better solution than blocking.

Should fix https://github.com/rust-windowing/softbuffer/issues/48. The
animation example could probably be implemented better, but this is at
least better.

I guess it should be documented that `set_buffer` may block? I don't
know how this compares to other backends.
2022-12-27 15:42:28 -08:00
Ian Douglas Scott
a800ca457d
Merge pull request #53 from ids1024/update
Update to stable wayland-rs 0.30, specify `rust-version`, rename `SwBufError` back to `SoftBufferError`
2022-12-27 13:30:05 -08:00
Ian Douglas Scott
fc1bba64ab Rename SwBufError back to SoftBufferError
This seems to be the last thing left over from the `swbuf` rename.
2022-12-27 12:57:26 -08:00
Ian Douglas Scott
0109b1538a Specify rust-version in Cargo.toml 2022-12-27 12:20:07 -08:00
Ian Douglas Scott
ca3988a2f7 Use stable 0.30 release of wayland-client 2022-12-27 12:18:14 -08:00
John Nunley
3eeafad834
x11: Add XCB support to the X11 backend (#52) 2022-12-27 09:14:54 -08:00
David Johnson
d5bb2c1c78
Merge pull request #51 from rust-windowing/jackpot51/readme-fork-notice
Remove notice about fork
2022-12-23 09:47:29 -06:00
Jeremy Soller
11fdcfacd0
Remove notice about fork 2022-12-23 08:24:26 -07:00
Mads Marquart
f754bdaf37
Merge pull request #47 from rust-windowing/clarify-maintainership
Clarify maintainership
2022-12-23 06:34:06 +01:00
Mads Marquart
3b155497af
Merge pull request #50 from rust-windowing/better-unsafe
Safer `unsafe` usage
2022-12-23 06:33:41 +01:00
Mads Marquart
ff5824b6a5 Avoid a bit of unsafe in Windows backend 2022-12-23 04:20:01 +01:00
Mads Marquart
89bd260fd8 Use #![deny(unsafe_op_in_unsafe_fn)] 2022-12-23 04:19:41 +01:00
Mads Marquart
c9e3652d13 Fix typo 2022-12-23 04:16:55 +01:00
David Johnson
9023b096d7 Updated rest of the code to use softbuffer name instead of swbuf 2022-12-22 18:43:54 -06:00
David Johnson
ddb1b9bfeb Updated Cargo.toml to reflect swbuf+softbuffer merge 2022-12-22 18:39:56 -06:00
Mads Marquart
4d1a7a1216 Add @john01dav as core maintainer 2022-12-23 01:12:01 +01:00
John Nunley
cf0b435790
Add rustfmt/clippy to the CI (#22) 2022-12-22 14:15:09 -08:00
John Nunley
5674886dfa
Add reformat to the CI (#21) 2022-12-22 12:35:18 -08:00
John Nunley
df091d59dd
Merge pull request #4 from notgull/static-dispatch
Use static dispatch
2022-12-22 11:10:48 -08:00
jtnunley
319ff565a5 Use static dispatch 2022-12-22 10:09:47 -08:00
Ian Douglas Scott
58d4fd41b7 Add Github Actions CI, based on winit 2022-12-21 19:45:27 -07:00
Ian Douglas Scott
b0d6ffbf17 Fix clippy lints 2022-12-21 19:45:27 -07:00
Ian Douglas Scott
f193f10ec0 Add wayland-dlopen feature, like winit 2022-12-21 19:45:27 -07:00
Ian Douglas Scott
d95919c32e x11: Fix compiling; window is not a pointer 2022-12-21 19:45:27 -07:00
notgull
300a4d819a chore: Clean up win32 and x11 2022-12-21 19:07:16 -07:00
Ian Douglas Scott
abfb2ac4f9
Merge pull request #18 from rust-windowing/x11-wayland-features
Add feature flags for `x11` and `wayland`
2022-12-21 16:42:23 -08:00
Ian Douglas Scott
c73bd4b836 Add feature flags for x11 and wayland
Winit has features for these, so it makes sense to offer the same.
2022-12-21 16:20:15 -08:00
Mads Marquart
24fd9ed77a Add @ids1024 as Wayland maintainer 2022-12-22 00:01:48 +01:00
Mads Marquart
fe80194d69 Add @notgull as Windows and X11 maintainer 2022-12-22 00:01:46 +01:00
Azriel Hoh
80b45a9a68 Add rust syntax to readme snippet 2022-12-21 13:55:00 -07:00
Mads Marquart
b8e8437345 Add @jackpot51 as Redox/Orbital maintainer 2022-12-21 14:44:41 +01:00
Mads Marquart
3e42b0589b Add myself as Core Graphics maintainer 2022-12-21 14:43:46 +01:00
Mads Marquart
e5d8bcf03b Add CODEOWNERS file 2022-12-21 14:43:34 +01:00
Simon Hausmann
254d33caf6 Fix rustdoc warning about unresolved links
The referenced functions and the described ownership concept don't exist
anymore.
2022-12-21 06:40:07 -07:00
Mads Marquart
25afc6e563
Merge pull request #6 from slint-ui/simon/macos-scale-fix
Fix scaling of the buffer on macOS
2022-12-21 14:34:09 +01:00
Simon Hausmann
b74047ae86 Fix scaling of the buffer on macOS
Currently the size of the buffer on macOS is interpreted in logical pixels, which
is inconsistent with the other platforms. Instead,
we should apply the same scale factor that applies to regular rendering.
2022-12-21 07:40:47 +01:00
Simon Hausmann
fbc48512ef Modify the fruit example to show any logical vs. physical pixel mismatches
Resize the window to the physical size of the image.
If softbuffer scales the contents incorrectly, only parts
of the fruit basket will be visible.
2022-12-21 07:40:47 +01:00
Ian Douglas Scott
dbd4e796f1 wayland: Avoid allocating more than 2 buffers 2022-12-20 16:14:10 -07:00
Ian Douglas Scott
cdfae58510 wayland: Reuse buffers and pools; check buffer release
Also updates `winit` example to redraw on resize, which seems to be
necessary.

With this resizing seems to be entirely smooth, without visual
corruption from it overwriting the buffer the server is displaying.
2022-12-20 16:14:10 -07:00
Jeremy Soller
9b8641fc07 Make new function take both a HasRawWindowHandle and a HasRawDisplayHandle object 2022-12-20 13:40:54 -07:00
Jeremy Soller
e781cd8cab Add from_raw function for direct use of raw handles 2022-12-20 13:40:54 -07:00
Jeremy Soller
99d63063b6 Take a reference to a window in GraphicsContext::new, like glutin and wgpu 2022-12-20 13:40:54 -07:00
jtnunley
85b4f189bd Port to win32 2022-12-20 09:11:45 -07:00
Jeremy Soller
95e8d05902
Rename SoftBufferError to SwBufError 2022-12-20 07:11:11 -07:00
Ian Douglas Scott
33fe3ae3c7
Enable Wayland and x11 code on FreeBSD 2022-12-20 07:11:10 -07:00
Ian Douglas Scott
3dc11f75c1
Improvements to wayland backend
- Use wayland-client `0.30.0-beta.14`
- Use `memfd` instead of temporary file
- Make sure buffer and buffer pool objects are destroyed
2022-12-20 07:11:10 -07:00