Commit graph

69 commits

Author SHA1 Message Date
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
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
Azriel Hoh
80b45a9a68 Add rust syntax to readme snippet 2022-12-21 13:55:00 -07: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
Jeremy Soller
7351d68814
Add Redox/Orbital support 2022-12-20 07:11:09 -07:00
Jeremy Soller
939bcc44d8
Fork to swbuf 2022-12-20 07:07:57 -07:00
David Johnson
d30d3255c2 Updated winit to 0.27.2 for examples and raw-window-handle to 0.5.0 2022-08-24 00:16:20 -05:00
David Johnson
bef3c52706
Merge pull request #21 from Liamolucko/winapi-features
Enable needed features of winapi
2022-08-23 21:05:29 -05:00
David Johnson
745c2d44dc
Merge pull request #6 from kpreid/asref
Add `impl AsRef<W> for GraphicsContext<W>`.
2022-08-23 21:03:59 -05:00
Kevin Reid
3529b2054b #[inline] for the AsRef implementation.
This may be redundant since the function is generic and generic
functions are, in the current Rust compiler, always inlinable, but it
follows the general recommended practice of making trivial accessor
functions inlinable.
2022-08-23 19:00:00 -07:00
David Johnson
1745323549
Merge pull request #12 from i509VCB/wayland/damage-hack
wayland: temporary horrible fix for damage
2022-08-23 20:54:00 -05:00
David Johnson
e217b5c7c5
Merge pull request #5 from kpreid/mut
Make `GraphicsContext::window_mut()` an `unsafe fn`.
2022-08-23 20:35:53 -05:00
Liam Murphy
ea6f97e15e Enable needed features of winapi
Previously, `softbuffer` wouldn't successfully build on its own on Windows; the examples only worked because dependencies happened to enable the needed features.
2022-07-01 17:49:40 +10:00
i509VCB
d0fed096b6
wayland: temporary horrible fix for damage 2022-06-02 18:20:13 -05:00
Kevin Reid
1c0683c88d Make GraphicsContext::window_mut() an unsafe fn.
As documented in the new safety comment, providing `&mut` access to an
inner component about which there are consistency invariants is unsafe,
because `&mut` is sufficient for a caller to completely replace the
value (using assignment or `std::mem::swap()`).

Luckily, when `softbuffer` is used with `winit`, no `&mut` access is
needed. However, other windowing libraries such as `glfw` and `sdl2` do
have `&mut` methods, so this method can't simply be removed.

This is a breaking change since it makes a previously safe function
unsafe, and should not be published without a major version bump
(i.e. to `0.2.0` or higher).
2022-05-26 08:37:37 -07:00
Kevin Reid
cfbde6073c Add impl AsRef<W> for GraphicsContext<W>.
This will allow code which works with windows generically (such as an
event loop which can work with `softbuffer` or another graphics library)
to be able to access the underlying window without knowing about
`softbuffer` in particular.
2022-05-26 08:37:11 -07:00
David Johnson
08883d76c5 Bumped version to 0.1.1, updated README.md, added changelog to README.md 2022-05-22 18:20:40 -05:00
David Johnson
dac367138e
Merge pull request #3 from lunixbochs/calayer
use CALayer for macOS backend
2022-05-17 00:14:15 -05:00
Ryan Hileman
112e777179 macOS: use a subview, improve image handling 2022-05-16 10:16:50 -07:00
Ryan Hileman
44d1ababf0 CALayer: place buffer in top left instead of scaling to window 2022-05-16 09:15:21 -07:00
Ryan Hileman
ba3b823e1c use CALayer for macOS backend 2022-04-24 07:31:19 -07:00
David Johnson
75216061b7
Merge pull request #2 from Liamolucko/web
Add web support
2022-02-27 22:36:09 -06:00
Liam Murphy
62529c4069 Show web as supported in README 2022-02-23 20:08:16 +11:00