For pure-Rust connections, there is no XCB connection that can be passed into
the display constructor. Thus, this PR enables the display to be created without
needing an XCB or Xlib handle, by providing `None` in the constructor.
cc rust-windowing/raw-window-handle#120
Signed-off-by: John Nunley <dev@notgull.net>
This function takes `Into<RawFdContainer>`. So it accepts an owned fd,
and closes it. So as long as the API is like this, we need to dup a new
fd it can close when calling it.
`Into<RawFdContainer>` is implemented for anything implementing `IntoRawFd`,
so passing `OwnedFd` works.
Fixes https://github.com/rust-windowing/softbuffer/issues/168. Should be
backported to 0.3.x.
The X11 backend used System-V shared memory to communicate shared
buffers to the server, but rustix does not support SysV SHM so we had to
use libc in this backend. However, there is an alternate X11 API which
uses POSIX shared memory, which rustix does support. This PR switches
the X11 backend to POSIX shared memory and purges the previous
usages of libc.
The goal is to remove libc totally. Therefore this PR also removes the
default libc dependency from rustix.
Signed-off-by: John Nunley <dev@notgull.net>
Partly addresses
https://github.com/rust-windowing/softbuffer/issues/147, though it would
still be desirable to have a good safe API for SYSV shm in Rustix. But
using `libc` directly for now is no worse than using the `nix::libc`
re-export, so we don't lose anything.
Softbuffer is broken on recent builds of Redox without the fix here, so
it's helpful to have a new release that fixes it. We seem to have
accumulated a few non-breaking fixes, so it seems like a good enough
time to do a release anyway.
Disabling `fetch` on Windows could be considered breaking, but it
doesn't change the API, was broken anyway, and is likely unused. So I
don't think that's an issue.
They are currently failing due to what we believe is a bug in the
Windows bindings for Rust. For now, disable these until this bug is
resolved.
Closes#142
Signed-off-by: John Nunley <dev@notgull.net>
This adds a DRM/KMS based backend to the system, as per #42. This system finds a CRTC and a connector, then uses that to create a frame buffer and a DUMB buffer that it can render to.
There's much more to do, and is left as an exercise for anyone with a significant DRM-based use case to pick up and fix.
Signed-off-by: John Nunley <dev@notgull.net>
This fetch function has been broken and is probably unsound. This also
fixes the flakey Windows CI that we've been dealing with.
Signed-off-by: John Nunley <dev@notgull.net>
My new tiny-xlib crate takes up a fraction of the space that the x11-dl crate uses, supports
feature-based static linking and involves less of Xlib's ridiculous surface.
* On MacOS, the contents scale is updated when set_buffer() is called, to adapt when the window is on a new screen (#68).
* **Breaking:** Split the `GraphicsContext` type into `Context` and `Surface` (#64).
* On Web, cache the document in the `Context` type (#66).
* **Breaking:** Introduce a new "owned buffer" for no-copy presentation (#65).
* Enable support for multi-threaded WASM (#77).
* Fix buffer resizing on X11 (#69).
* Add a set of functions for handling buffer damage (#99).
* Add a `fetch()` function for getting the window contents (#104).
* Bump MSRV to 1.64 (#81).
This function is useful for testing the window contents in certain cases. In addition,
this means that we can now have reliable tests for softbuffer's actual functionality.
Signed-off-by: John Nunley <jtnunley01@gmail.com>
Co-authored-by: dAxpeDDa <daxpedda@gmail.com>