Commit graph

140 commits

Author SHA1 Message Date
daxpedda
d7888ef806
Implement present_with_damage for Web (#101) 2023-04-27 10:19:29 -07:00
Ian Douglas Scott
29b3f4a978 Add a Buffer::age() method
Fixes https://github.com/rust-windowing/softbuffer/issues/90.
2023-04-26 15:04:20 -07:00
Ian Douglas Scott
c1d6716eec Add a Buffer::present_with_damage() method
Supported on Wayland, X11, and Win32.

Fixes https://github.com/rust-windowing/softbuffer/issues/39.

try_for_each
2023-04-26 11:58:11 -07:00
John Nunley
f12aa534e1
Merge pull request #100 from LunaWasFlaggedAgain/master
x11: Limit returned shm buffer size
2023-04-24 18:36:39 -07:00
Luna
5efa5d8898 x11: Assert that size >= buffer_size 2023-04-24 20:31:39 -03:00
Luna
c68f41bf10 x11: Limit returned shm buffer size 2023-04-24 19:37:41 -03:00
dependabot[bot]
a958a18346
Bump actions/cache from 1 to 3 (#93)
* Bump actions/cache from 1 to 3

Bumps [actions/cache](https://github.com/actions/cache) from 1 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Empty commit to re-run CI

That CI failure looks spurious to me.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jtnunley <jtnunley01@gmail.com>
2023-04-18 15:05:23 -07:00
Jeremy Soller
a0b9c5921e
Merge pull request #97 from rust-windowing/example-optimize
examples: Avoid dividing index to get x, y; calculate index from x, y
2023-04-12 07:58:56 -06:00
Ian Douglas Scott
edc5c76180 examples: Avoid dividing index to get x, y; calculate index from x, y
Division is more expensive than multiplication, and this doesn't seem to
be optimize away, so iterating over `(0..height)` and `(0..width)`
provides better performance.

It's good to have the example show the best way to write code using
softbuffer, and this helps when using examples as a benchmark. This will
also be needed if Softbuffer supports formats where `stride` isn't just
`width * pixel_size`, and needs alignment.
2023-04-11 12:21:50 -07:00
dependabot[bot]
6da649e8a1
Bump actions/checkout from 2 to 3 (#92)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-10 10:32:37 -07:00
John Nunley
027f944ece
Add dependabot support to this repo (#91) 2023-04-10 10:00:41 -07:00
John Nunley
92e8eb7d22
Don't use the borrowing trick under Windows (#89) 2023-04-07 17:31:21 -07:00
John Nunley
885c76bf02
m: Don't use the borrowing trick under X11 (#86) 2023-04-07 11:54:50 -07:00
John Nunley
a72e3b5062
Merge pull request #88 from rust-windowing/notgull/error-handling 2023-04-06 13:15:54 -07:00
John Nunley
61eb2472ff
Merge pull request #87 from daxpedda/atomic-ci
Fix atomic Wasm CI
2023-04-06 11:31:12 -07:00
dAxpeDDa
24db0ad453
Fix atomic Wasm CI 2023-04-06 20:21:42 +02:00
jtnunley
74a3357ce8 Use the SwResultExt trait in more places 2023-04-06 11:09:47 -07:00
John Nunley
379910cb8e
Merge pull request #77 from daxpedda/wasm-atomics
Fix multi-threaded Wasm
2023-04-06 10:40:23 -07:00
Ian Douglas Scott
7ba535c225
Merge pull request #85 from rust-windowing/bump-deps
Update `windows-sys` and `image`
2023-04-06 09:44:00 -07:00
Ian Douglas Scott
7a687105e3 Update windows-sys and image 2023-04-06 08:37:57 -07:00
dAxpeDDa
c0af587718
Fix multi-threaded Wasm 2023-04-06 17:35:14 +02:00
Ian Douglas Scott
a09e4cf679
Owned pixel buffer for no-copy presentation
This is based on the API that will be used for no-copy presentation. But
wraps it in `set_buffer`.

This also fixes the Wayland buffer code to set `self.width` and
`self.height` on resize, and set the length of the shared memory file
when the buffer is created.

Co-authored-by: jtnunley <jtnunley01@gmail.com>
2023-04-06 10:30:59 +03:00
John Nunley
e5d546ff9e
Update README.md to have a checkmark next to libxcb support (#84) 2023-04-05 11:41:37 -07:00
John Nunley
77f9f68f45
Bump MSRV to 1.64 (#81)
raw-window-handle bumped MSRV, so should we
2023-03-17 19:56:10 -07:00
Ian Douglas Scott
1381217fe5
Merge pull request #72 from rust-windowing/run-wasm
Add `run-wasm` workspace member, as used in `winit`
2023-02-23 10:58:57 -08:00
Ian Douglas Scott
3b9976685c Add run-wasm workspace member, as used in winit
This makes it easy to run examples with the web backend, in the same way
that winit examples are run.
2023-02-23 08:49:36 -08:00
Jeremy Soller
83c0f92dc5
Merge pull request #71 from rust-windowing/dependencies
Update dependencies
2023-02-21 09:44:20 -07:00
Ian Douglas Scott
dce6cbc111 Update windows-sys dependency, and winit dev dependency
Using the latest `winit` version in examples fixes resizing behavior on
Wayland, so the workaround for that in the `winit` example is also
removed here.
2023-02-20 10:22:34 -08:00
David Johnson
fec8decc43
Merge pull request #70 from AngelOnFira/patch-1
Fix changelog link
2023-01-26 16:19:42 -06:00
Forest Anderson
f98b8c4e25
Fix changelog link 2023-01-26 17:15:14 -05:00
Jeremy Soller
31c06ac394
Merge pull request #69 from pop-os/buffer-resize
fix: update width and height when resizing buffer
2023-01-23 06:39:18 -07:00
Ashley Wulber
0bdbf1a752
fix: update width and height when resizing buffer 2023-01-22 22:23:44 -05:00
Mads Marquart
787958b2a6
Merge pull request #68 from slint-ui/simon/macos-scale-on-setbuffer
mac: Fix layer scale not being updated when contents is updated and window is on a new screen
2023-01-15 18:12:03 +01:00
Simon Hausmann
7ca503cafe add ChangeLog entry for the contents scale update change 2023-01-15 17:35:52 +01:00
Simon Hausmann
4c6631c764 mac: retain the NSWindow to ensure that the call to retrieving the backing scale factor in set_buffer works 2023-01-15 17:04:57 +01:00
Simon Hausmann
2832a6e42b mac: Fix layer scale not being updated when contents is updated and window is on a new screen
cc #67
2023-01-15 09:12:28 +01:00
John Nunley
33a4c3741b
m: Cache document in web frontend (#66) 2023-01-14 05:48:44 +00:00
Ian Douglas Scott
125ad070c2
Merge pull request #64 from rust-windowing/display-window-split
Split display/window wrappers
2023-01-10 16:05:46 -08:00
Ian Douglas Scott
129069996e Split GraphicsContext into Context and Surface
A `Context` is created with a display handle, and a `Surface` is created
with a `&Context` and a window handle. Thus multiple windows can be
created from the same context without duplicating anything that can be
shared. This API is broadly similar to `wgpu` or `glutin`.

On Wayland, the `Context` contains the `EventQueue`, which is shared
between windows, and the `WlShm` global. On X11, `Context::new` checks
for the availability of XShm, and contains a bool representing that as
well as the `XCBConnection`. The shared context data is stored within
the window in an `Arc`.

On other platforms, the display isn't used and `Context` is empty. This
does however test that the display handle has the right type on those
platforms and fail otherwise. Previously the code didn't test that.

Closes https://github.com/rust-windowing/softbuffer/issues/37.
2023-01-06 21:36:53 -08:00
Jeremy Soller
3b33bbb0f5
Merge pull request #63 from rust-windowing/0.2.0
0.2.0
2023-01-06 09:20:43 -07:00
Jeremy Soller
02da341d51
0.2.0 2023-01-06 09:07:11 -07:00
Jeremy Soller
c0142e9faf
Merge pull request #59 from thedjinn/disable-calayer-actions
Disable CALayer fade action when setting buffers
2023-01-06 09:06:51 -07:00
Jeremy Soller
ee3e6e8870
Merge pull request #62 from rust-windowing/seal-shrink
wayland: Seal memfd to prevent shrinking
2023-01-06 09:01:55 -07:00
Ian Douglas Scott
165a15e92c wayland: Seal memfd to prevent shrinking
I believe this should be possible wherever `memfd_create` is available.

Sealing isn't required, but Wayland doesn't allow a client to shrink an
shm pool, so there's no reason we should shrink the file. And if we mmap
the file, this prevents a `SIGBUS` if the compositor (incorrectly)
shrunk it.

So we might as well do this.
2023-01-06 07:52:59 -08:00
Jeremy Soller
2cdbb48b8c
Merge pull request #61 from rust-windowing/notgull/changelog
chore: Create changelog for past few weeks of changes
2023-01-06 08:51:11 -07:00
jtnunley
32fc52ab9b Create changelog 2023-01-06 07:48:29 -08:00
John Nunley
a6042f664d
x11: Implement image transfer using the MIT-SHM extension (#46)
* Implement shared memory transfer for X11

* Change to x11rb

* Fix leak + review from psychon

* Add waits to prevent illegal writes to SHM

* @ids1024 code review
2023-01-05 19:27:54 -08:00
John Nunley
0f1effe958
chore: Alphabetize dependencies (#58) 2023-01-05 22:37:30 +00:00
Emil Loer
b72055d122
Disable CALayer fade action when setting buffers
This commit fixes a bug in the Core Graphics backend that causes a new
buffer not be shown immediately but instead use a quarter second fade
transition. This happens because the CALayer has a default action
associated with a change in the layer contents.

The problem was mitigated by wrapping the contents change in a
transaction and disabling all actions for the duration of this
transaction.
2023-01-05 22:17:10 +01:00
Emil Loer
a78becd316
Add rectangle toggle example
This commit adds a new example that shows a XOR pattern. A rectangle can
be superimposed on the background by pressing the space bar.

This example was created to demonstrate a bug in the Core Graphics
backend that causes the buffer to fade when calling set_buffer, instead
of applying it immediately.
2023-01-05 22:16:24 +01:00