Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run example #79

Closed
oOBoomberOo opened this issue Nov 27, 2019 · 6 comments
Closed

Can't run example #79

oOBoomberOo opened this issue Nov 27, 2019 · 6 comments
Labels
bug Something isn't working
Milestone

Comments

@oOBoomberOo
Copy link

This error popup on every example project and even on my own iced project.

thread 'main' panicked at 'Unable to enumerate instance extensions: ERROR_INITIALIZATION_FAILED', src\libcore\result.rs:1189:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Also, when I try to import module in VS code it doesn't seem to provide import suggestion for component (i.e. iced::button, iced::Element) but it does provide import to settings, Sandbox and Settings

System:
OS: Windows 10
GPU: Nvidia GeForce GTX 1080 (Up to date driver)
Version: iced = 0.1.0-beta
Rust: stable-x86_64-pc-windows-msvc

@rhzs
Copy link

rhzs commented Nov 27, 2019

Got similar error with MacOS pulled from latest master branch.

Here is the stacktrace:

➜ RUST_BACKTRACE=1 cargo run --example todos
   Compiling iced v0.1.0-beta (/iced)
    Finished dev [unoptimized + debuginfo] target(s) in 11.70s
     Running `/iced/target/debug/examples/todos`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Compiler encountered an internal error"', src/libcore/result.rs:1165:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:464
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:373
  12: rust_begin_unwind
             at src/libstd/panicking.rs:302
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:139
  14: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  15: core::result::Result<T,E>::unwrap
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/result.rs:933
  16: gfx_backend_metal::internal::ServicePipes::create_copy_buffer
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-metal-0.4.1/src/internal.rs:496
  17: gfx_backend_metal::internal::ServicePipes::new
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-metal-0.4.1/src/internal.rs:461
  18: gfx_backend_metal::Shared::new
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-metal-0.4.1/src/lib.rs:191
  19: <gfx_backend_metal::Instance as gfx_hal::Instance<gfx_backend_metal::Backend>>::enumerate_adapters::{{closure}}
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-metal-0.4.1/src/lib.rs:229
  20: core::iter::adapters::map_fold::{{closure}}
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/adapters/mod.rs:694
  21: core::iter::traits::iterator::Iterator::fold::ok::{{closure}}
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/traits/iterator.rs:1828
  22: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/traits/iterator.rs:1709
  23: core::iter::traits::iterator::Iterator::fold
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/traits/iterator.rs:1831
  24: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/adapters/mod.rs:727
  25: core::iter::traits::iterator::Iterator::for_each
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/traits/iterator.rs:631
  26: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/liballoc/vec.rs:2031
  27: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/liballoc/vec.rs:2014
  28: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/liballoc/vec.rs:1901
  29: core::iter::traits::iterator::Iterator::collect
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libcore/iter/traits/iterator.rs:1493
  30: <gfx_backend_metal::Instance as gfx_hal::Instance<gfx_backend_metal::Backend>>::enumerate_adapters
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-metal-0.4.1/src/lib.rs:225
  31: wgpu_native::instance::request_adapter
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.0/src/instance.rs:347
  32: wgpu_request_adapter
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-native-0.4.0/src/instance.rs:474
  33: wgpu::Adapter::request
             at /.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.4.0/src/lib.rs:545
  34: iced_wgpu::renderer::Renderer::new
             at wgpu/src/renderer.rs:51
  35: <iced_wgpu::renderer::Renderer as iced_native::renderer::windowed::Windowed>::new
             at wgpu/src/renderer.rs:417
  36: iced_winit::application::Application::run
             at /iced/winit/src/application.rs:115
  37: iced::application::Application::run
             at /iced/src/application.rs:140
  38: todos::main
             at examples/todos.rs:9
  39: std::rt::lang_start::{{closure}}
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libstd/rt.rs:61
  40: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:48
  41: std::panicking::try::do_call
             at src/libstd/panicking.rs:287
  42: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:83
  43: std::panicking::try
             at src/libstd/panicking.rs:265
  44: std::panic::catch_unwind
             at src/libstd/panic.rs:396
  45: std::rt::lang_start_internal
             at src/libstd/rt.rs:47
  46: std::rt::lang_start
             at /rustc/c553e8e8812c19809e70523064989e66c5cfd3f1/src/libstd/rt.rs:61
  47: <todos::SaveError as core::clone::Clone>::clone
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@hecrj
Copy link
Member

hecrj commented Nov 27, 2019

Thank you for reporting!

Just to discard an issue upstream, I'd appreciate it if you could try any of the examples in wgpu and see if the same issue happens there.

@hecrj hecrj added the bug Something isn't working label Nov 27, 2019
@oOBoomberOo
Copy link
Author

Tested, seem to be wgpu problem.
It displays the exact same error.

@oOBoomberOo
Copy link
Author

oOBoomberOo commented Nov 27, 2019

Actually, after following down the rabbit hole. The problem seem to come from the Vulkan itself.
I'll try updating/reinstalling the graphics driver and see if the problem go away.

@FuGangqiang
Copy link

I also got this error, The problem seem to come from the Vulkan itself,
archlinux wiki has some doc

@oOBoomberOo
Copy link
Author

The issue is fixed after reinstalling graphic driver.

@hecrj hecrj added this to the 0.1.0 milestone Nov 27, 2019
ids1024 added a commit to ids1024/iced that referenced this issue Feb 9, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 28, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Jul 29, 2024
This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 1, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 2, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 3, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 7, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Add FromIterator for Row and Column

Revert "Add FromIterator for Row and Column"

This reverts commit 06c80c5.

Add FromIterator for Row and Column

format

stuff

Revert "format"

This reverts commit 97fa6a70e5bb269ad4b253b49dcdecba6767579c.

Revert "Add FromIterator for Row and Column"

This reverts commit efa9a1e2e96658ba7193fd3da7701924c9f0983a.

s

s

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 22, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

svg: fix building with wayland feature enabled
Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx added a commit to ryanabx-contrib/iced that referenced this issue Aug 29, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Nov 4, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>

fix(column): handle keys len change

fix: iced-sctk a11y

wip: winit single window updates

tokio feature hangs even without a11y feature

fix: multiwindow a11y fixes

fix: component

update winit

wip: sctk integration to winit shell

refactor: remove accesskit_unix

fix: svg

fix: remove wayland default feature

feat: derive Hash for image Handle

fix: cleanup 0.13 rebase errors

fix: remove path dependencies

conversion for Radius

conversion for Padding

setter for Svg border radius

re-export Limits

fix: connect clipboard if disconnected on layer surface or popup creation

fix: connect clipboard if disconnected on session lock surface creation

fix: update size of layer surface after configure

fix: insert user interfaces for popup and lock surfaces on creation

fix: svg scaling

feat: popups on winit windows

fix: default text shaping to advanced

fix: fallback to renderer icon style if svg is symbolic

fixes

fix: sctk frame handling

feat: autosize handling

fix: better autosize handling

fix: avoid duplicate window events from sctk

fix: better handling of popups

fix: refactor redraw handling for sctk

fix: include id in frames

fix: image

fix: scrollable delta direction

sctk: unregister clipboard when surface is done

set min / max size when size is requested

fix: popups

filter pointer events

feat: add Hide variant to mouse Interaction

dnd fixes

fix: use physical width for DnD surface

fix: tiny-skia svg quality

refactor: peek_dnd try to parse data

cleanup text conversion

cleanup

svg scaling fixes

background color fix

Introduce consecutive_click_distance like other toolkits do such as gtk,qt,imgui.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Nov 4, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>

fix(column): handle keys len change

fix: iced-sctk a11y

wip: winit single window updates

tokio feature hangs even without a11y feature

fix: multiwindow a11y fixes

fix: component

update winit

wip: sctk integration to winit shell

refactor: remove accesskit_unix

fix: svg

fix: remove wayland default feature

feat: derive Hash for image Handle

fix: cleanup 0.13 rebase errors

fix: remove path dependencies

conversion for Radius

conversion for Padding

setter for Svg border radius

re-export Limits

fix: connect clipboard if disconnected on layer surface or popup creation

fix: connect clipboard if disconnected on session lock surface creation

fix: update size of layer surface after configure

fix: insert user interfaces for popup and lock surfaces on creation

fix: svg scaling

feat: popups on winit windows

fix: default text shaping to advanced

fix: fallback to renderer icon style if svg is symbolic

fixes

fix: sctk frame handling

feat: autosize handling

fix: better autosize handling

fix: avoid duplicate window events from sctk

fix: better handling of popups

fix: refactor redraw handling for sctk

fix: include id in frames

fix: image

fix: scrollable delta direction

sctk: unregister clipboard when surface is done

set min / max size when size is requested

fix: popups

filter pointer events

feat: add Hide variant to mouse Interaction

dnd fixes

fix: use physical width for DnD surface

fix: tiny-skia svg quality

refactor: peek_dnd try to parse data

cleanup text conversion

cleanup

svg scaling fixes

background color fix

Introduce consecutive_click_distance like other toolkits do such as gtk,qt,imgui.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Nov 4, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>

fix(column): handle keys len change

fix: iced-sctk a11y

wip: winit single window updates

tokio feature hangs even without a11y feature

fix: multiwindow a11y fixes

fix: component

update winit

wip: sctk integration to winit shell

refactor: remove accesskit_unix

fix: svg

fix: remove wayland default feature

feat: derive Hash for image Handle

fix: cleanup 0.13 rebase errors

fix: remove path dependencies

conversion for Radius

conversion for Padding

setter for Svg border radius

re-export Limits

fix: connect clipboard if disconnected on layer surface or popup creation

fix: connect clipboard if disconnected on session lock surface creation

fix: update size of layer surface after configure

fix: insert user interfaces for popup and lock surfaces on creation

fix: svg scaling

feat: popups on winit windows

fix: default text shaping to advanced

fix: fallback to renderer icon style if svg is symbolic

fixes

fix: sctk frame handling

feat: autosize handling

fix: better autosize handling

fix: avoid duplicate window events from sctk

fix: better handling of popups

fix: refactor redraw handling for sctk

fix: include id in frames

fix: image

fix: scrollable delta direction

sctk: unregister clipboard when surface is done

set min / max size when size is requested

fix: popups

filter pointer events

feat: add Hide variant to mouse Interaction

dnd fixes

fix: use physical width for DnD surface

fix: tiny-skia svg quality

refactor: peek_dnd try to parse data

cleanup text conversion

cleanup

svg scaling fixes

background color fix

Introduce consecutive_click_distance like other toolkits do such as gtk,qt,imgui.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Nov 4, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>

fix(column): handle keys len change

fix: iced-sctk a11y

wip: winit single window updates

tokio feature hangs even without a11y feature

fix: multiwindow a11y fixes

fix: component

update winit

wip: sctk integration to winit shell

refactor: remove accesskit_unix

fix: svg

fix: remove wayland default feature

feat: derive Hash for image Handle

fix: cleanup 0.13 rebase errors

fix: remove path dependencies

conversion for Radius

conversion for Padding

setter for Svg border radius

re-export Limits

fix: connect clipboard if disconnected on layer surface or popup creation

fix: connect clipboard if disconnected on session lock surface creation

fix: update size of layer surface after configure

fix: insert user interfaces for popup and lock surfaces on creation

fix: svg scaling

feat: popups on winit windows

fix: default text shaping to advanced

fix: fallback to renderer icon style if svg is symbolic

fixes

fix: sctk frame handling

feat: autosize handling

fix: better autosize handling

fix: avoid duplicate window events from sctk

fix: better handling of popups

fix: refactor redraw handling for sctk

fix: include id in frames

fix: image

fix: scrollable delta direction

sctk: unregister clipboard when surface is done

set min / max size when size is requested

fix: popups

filter pointer events

feat: add Hide variant to mouse Interaction

dnd fixes

fix: use physical width for DnD surface

fix: tiny-skia svg quality

refactor: peek_dnd try to parse data

cleanup text conversion

cleanup

svg scaling fixes

background color fix

Introduce consecutive_click_distance like other toolkits do such as gtk,qt,imgui.
ryanabx pushed a commit to ryanabx-contrib/iced that referenced this issue Nov 4, 2024
x11: Workaround nvidia driver lacking DRI

feat(mouse area): add double click

mouse area: add double click

compositor: Add code to extract adapter from x11

refactor: Extract ids_from_dev from wayland specific code

wayland: Don't crash if libwayland isn't available

feat(sctk): support for overflow widget

sctk: Fixes for cursor icon

* With multiple windows, `SetCursor` is only sent for the focused
  window. Fixing a flicker between icons when two windows are using
  different cursors.
* If there is a drag surface, let that surface set the cursor. And not
  any other.
* Set cursor on `enter`, and when switching between CSDs and app area.

Fixes pop-os/libcosmic#533.

improv(sctk): per-surface cursor position tracking

feat(sctk): support ShowWindowMenu

Make text wrap configurable

fix(core): state order and handling of new trees

fix: settings.decorations enables SSD

refactor(sctk): convert window actions

fix: enable the tokio feature for accesskit_unix

fix: only try to connect to clipboard if on linux

iced_wgpu: don't query Wayland on macos

Update `window_clipboard`

sctk: Unmap subsurfaces instead of immediately destroying them

Destroying a surface is immediate, rather than synchronized with
commits.

This fixes a flickering behavior with drag and drop in
cosmic-workspaces.

sctk: Add alpha setting to `Subsurface` widget

sctk: Update `sctk`, `wayland-protocols`

Update for cosmic-text undefined buffer size

Adapt to cosmic-text undefined width change

fix: unset VK_LOADER_DRIVERS_DISABLE after enumeration

Allows applications to be launched on the NVIDIA GPU with Vulkan support

Adapt to new cosmic-text

wgpu: Fix wayland device id conversion

wgpu: Fix querying adapter, even if we already have one

wgpu: fix nvidia gpu powering up in hybrid setups

cargo fmt

fix: refactor dnd impl to support responsive widget

fix: update read and write methods so they don't recurse

fix(core): replace debug_assert in diff

fix: avoid with_borrow_mut

fix: better handling of state tree

This persists widget state associated with widgets assigned custom IDs even when the tree structure changes, but resets state if the custom ID is not found.

fix: emit Event::Resized to fix nav bar in cosmic-settings

fix(image): guess the image format before decoding

iced_wgpu: Query wayland for the device to use, if possible

sctk: Support `start_drag` with drags started from touch events

sctk: Add touch support

fix: update widnow-clipboard tag

fix: clean up dnd surfaces when a window is removed

Adjust to line ending needing to be specified as part of cosmic_text::BufferLine

sctk: Add support for drag-and-drop surface offsets

This adds an offset `Vector` as an argument to `on_drag`, and allows
passing an offset to `start_drag`.

Some applications using drag and drop want the top left corner of the
drag surface (as happens without an offset). But others want the drag
surface to be offset based on where the cursor is on the widget when
starting the drag. This can just be `-1 * offset`, but may be scaled if
the drag surface is a different size from the original widget.

fix(sctk): nested popup parent

feat(mouseare): mouse enter and exit

fix(tiny_skia): damage

fix(scrollable): filter scroll events in the wrong direction

sctk: Use empty input region for subsurfaces

This seems to work, and is a better way to deal with subsurface input if
there aren't any problems. This way, input events simply go to the
parent surface, so we don't have to deal with various edge cases related
to that. (Though for compositor-side issues, we still need to fix those
for other clients.)

This helps with an issue with drag-and-drop and subsurfaces on Smithay,
and a different issue on Kwin (in KDE 5.27, at least).

Send `DataSource` events to all surfaces

Previously these events are directed to the first surface, then removed
from `sctk_events`. Which is definitely not right.

slider & toggler roundness

Update window_clipboard to pop-dnd-4

fix(tiny-skia): non-simple border scaling

the issue can be seen with sharp corners when using the screenshot portal with scaling

Add read_primary/write_primary

chore: update tag

fix: translate offer positions in scrollable

fix(winit multi-window): handle exit_on_close request

fix(scrollable): pass child layout when calculating drag destinations

fix(container): id and set_id should use content

Clean up after lock surfaces are destroyed

Call unlock on session lock

chore: update tag

fixes for dnd

sctk: Fix handling of DnD with subsurfaces (iced-rs#122)

Map subsurface to parent and add offset.

refactor: remove Sync bound for Message

fix: pass correct state and layout for container widgets

fix: docs

feat: update advertised drag destinations after rebuilding an interface

fix: color format & multi-window

fix: doc

feat: winit dnd

fix: ambiguous import

chore: reexport mime from window_clipboard

chore: use tag

clippy

feat: add actions and commands for new clipboard methods

cleanup docs

feat: custom mime types for Clipboard

sctk: Fix handling of layer surface `pointer_interactivity` (#115)

A null `region` represents an infinite region (the default). To set an
empty region, we need to create a `wl_region`.

fix(tiny_skia): disable shadows due to rendering glitch

fix(winit): add static lifetimes to multi-window application update

fix(winit): add static lifetimes to application update

Use `TypeId` to identify `subscription::Map`

(cherry picked from commit f39a5fd)

fix(sctk): destroy drag icon and send event after cancel action

fix: clipboard cleanup

fix(sctk): clipboard dummy impl typo

refactor(sctk): optional clipboard

fix(sctk): broadcast events after update

when broadcasting events for no specific surface, it should be done after update so that the runtime subscription is current

fix(multi_window): enable drag resize

sctk: Map subsurface pointer events to parent surface, with offset

sctk_subsurface: Use two surfaces, handle button presses

Useful for testing pointer input to subsurfaces.

sctk: Add `subsurface_ids` mapping subsurface to parent and offset

sctk_subsurface_gst: NV12 surface suppport; disabled

Whether or not this works seems to depend on driver, or gstreamer
version...

Handle frame callbacks for subsurfaces, and `commit` parent surface

If the main surface is occluded completely by opaque subsurfaces, it may
not receive `frame` events. So we need to request frame events for all
subsurfaces as well.

Additionally, with "synchronized" subsurfaces, we need to `commit` the
parent surface for subsurface changes to take effect.

Fixes issues with subsurfaces updating slowly, or only when mouse moved
under some circumstances.

examples/sctk_subsurface_gst: Cache `BufferSource` in `BufferRef` qdata

Similar to `waylandsink`. Allows us to avoid creating a buffer source
(and ultimately `wl_buffer`) for every buffer swap.

sctk/subsurface: Cache `wl_buffer`s

Creating a new `wl_buffer` each frame seems to perform poorly. We can
instead keep a cache of `wl_buffer`s we have created from a
`BufferSource`.

sctk/subsurface: Avoid unnecessary subsurface commits if unchanged

feat(slider): add breakpoints

fix: autosize surface layout

Autosized surfaces perform the layout step to get the size and then again when building the interface, but sometimes the calculated size is not enough space when used as a bound, so we need to add a tiny amount to the calculated size. This also makes the event loop timeout duration configurable. Viewport physical size is calculated directly from the logical size now as well in iced-sctk to avoid inconsistencies that resulted from recalculating the logical size after using it to calculate the physical size.

fix(sctk): send close event instead of close requested when a window is closed

sctk: add command to set maximize state

Add `show_window_menu` action

Winit currently supports this only on Windows and Wayland.

This requests that a context menu is shown at the cursor position,
like the menu normally triggered by right clicking the title bar. This
is important for implementing client side decorations with Iced widgets.

Remove unnecessary redraw request

This was particularly visible on Redox where there is no vsync, but also
causes unnecessary redraws on Linux

chore: update accesskit

Disable broken rustdoc links

sctk: Add `Subsurface` widget (iced-rs#79)

This adds a widget that attaches an shm or dma buffer to a subsurface,
scaled with `wp_viewporter`.

By exposing this as a widget, rather than as a type of window, it can be
positioned and scaled like any other iced widget. It provides an API
that's similar to an iced image.

The initial version of this just took a `wl_buffer`. But this makes
buffer re-use problematic. In particular, the docs for `wl_surface::attach`
note that `wl_buffer::release` events become unreliable if a buffer is
attached to multiple surfaces. And indicates that a client should create
multiple `wl_buffer` instances, or use `wp_linux_buffer_release`.

So we store information about the buffer, and create `wl_buffer`s as
needed. `SubsurfaceBuffer::new` also returns a future that's signaled
when all references are destroyed, both `wl_buffer`s and any instance of
the `SubsurfaceBuffer` that might still be used in the `view`.

So this seems like the best solution for now, within the
model-view-update architecture.

This has two examples: `sctk_subsurface`, showing a single-color shm
buffer, and `sctk_subsurface_gst`, which plays an h264 video to a
subsurface with vaapi decoding.

chore: use pop-os fork of winit

chore: unpin cosmic-text

Update wgpu to a commit that fixes use on Nvidia drivers

This can be tested with something like
`VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json cargo run -p tour
--features iced/wgpu`.

On Nvidia I'm seeing a flood of `Suboptimal present of frame` warnings.
So some improvement may still be needed here. But if it doesn't regress
behavior on other hardware, that seems like an improvement over
freezing.

fix(winit): pass text with modifiers in event

chore: update cosmic-text and glyphon

fix: distinguish between the key character and the utf8 of a key event

feat(wgpu): use alpha modes for compositing if available

chore: use updated softbuffer

fix: typo

fix: downgrade resvg

fix: core/serde

chore: remove default features

typo: add rev to glyphon

Update to cosmic-text refactor

Fix docs error

Add function to fill a Raw

Fixes for last commit

fix: broadcast surface events

dnd_listener: Fix behavior when there are multiple listeners (iced-rs#87)

A `dnd_listener` widget shouldn't handle a DnD event when the dnd drag
isn't within the widget's bounds. So add a few more checks for this.

Enter/leave events generated by `DndOfferEvent::Motion` also don't
behave as one might expect, since the enter may occur before the leave
depending on the order it calls `on_event` on the widget. Not sure how
to address that, but cosmic-workspaces can just ignore the leave events
for now.

Otherwise, this seems to be working fine, after these changes.

chore: fix sctk multi-window dependency

cleanup: formatting and clippy

fix(example): sctk_drag id

fix: translate the wayland event position for content inside a scrollable

fix: set web-sys to =0.3.64

fix: clip mask checks

chore: use advanced text shaping for pick list

fix: dnd widget layout

fix: ambiguous palette import

chore: remove artifacts job

fix: CI tests

fix: add back the window id to the frames subscription

fix: tooltip children and diff

refactor: udpate gradient angles for slider

reexport limits

fix: editor and sctk_todos examples

cleanup: clippy

cleanup git workflows

chore: cleanup iced_widget

refactor

Update mod.rs

chore: update softbuffer

Hack to remove image blur

iced_core: feature for serde serialization of KeyCode

fix(wgpu): handle border_radius property with image raster

feat: add border radius to image rendering

feat: Add side mouse button events

cleanup: clippy fixes and formatting

Part of this is a refactor of the ID

cleanup: clippy and fmt

fix: test workflow

fix: add note in CHANGELOG

fix: clippy

refactor: restore default style of slider

feat: allow setting the width and height of a rule

fix: slider gradient angle

feat: gradient backgground for the slider rail

feat(mouse-area): added on_drag method

fix(widget): container inherited wrong icon color from renderer

fix(button): inherit icon color if set to none

feat(renderer): define default icon color

By default, this is the same as the text color for best visibility.

feat(winit): client-side resize drag support

feat(winit): client-side resize drag support

Make vertical scroll properties optional

fix: quad rendering including border only inside of the bounds

Move `Screenshot` inside `window` module

Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.

Provide access to font from each crate

Use nested for lazy widgets

Use layout with children for nesting

Introduce internal `overlay::Nested` for `UserInterface`

fix: reset button state if the cursor leaves

runtime: Handle widget operations in `program::State` helper (iced-rs#46)

chore: default line height, text size, and shaping for cosmic

feat: sctk shell

fix: quad rendering including border only inside of the bounds

fix: better slider drawing (it allows just the border part of the handle quad outside of the layout bouds, which isn't great, but is ok for our purposes due to being transparent)

cleanup: fix & format

fix: use iced_core::Font

cleanup

fix: allow leaving out winit & iced-sctk

fix: settings

fix: slider draw improvements

fix: websocket example

fix: modal example

fix: scrollable example

fix: toast example

fix: avoid panicking in iced_sctk with lazy widgets in auto-size surfaces

fix: todos panic

fix: only diff auto-sized surfaces in iced_sctk build_user_interface & improve sctk examples

wip (iced-sctk): window resize with icons

feat (iced-sctk): support for setting cursor

refactor: default decorations to client

fix: set window geometry after receiving configure

fix: size limits with no max bound must be cut off

fix: send size update when autosized surface resizes

fix: use ceil size for positioner

cleanup: remove dbg statement

fix: remove a destroyed surface from compositor surfaces

fix errors after rebase and wip scaling support

fix: handling of scale factor in set_logical_size

fix (sctk_drag example): add .into for border radius

fix: fractional scaling

sctk: Fire RedrawRequests

wip: animations via frame event

fix / refactor iced-sctk redraw & frame event handling

cleanup: note about frame request in iced-sctk

fix: send resize when necessary for layer surface and popups too

fix: always request redraw for a new surface

fix: scaling and autosize surface improvements

refactor: sctk_lazy keyboard interactivity

feat(sctk): configurable natural_scroll property

feat: send state and capabilities events when there are changes

fix: redraw when an update is needed and clean up the logic

Update sctk to latest commit

Fix compilation of sctk drag example

fix(sctk): update interface before checking if it has a redraw request

refactor: after autosize surface resize wait to redraw until the resize has been applied

refactor: better handling of autosize surfaces

chore: update sctk

chore: update sctk

fixes sctk_drag example

fix: default to ControlFlow::Wait for applications with no surface

this seems to help CPU usage for app library and launcher

default to 250ms timeout in the event loop

Update sctk

sctk: Implement xdg-activation support

fix: don't require Flags to be clone for settings on wayland

chore: error if neither winit or wayland feature is set

chore: Allow compiling without windowing system (iced-rs#65)

fix(iced-sctk): handle exit_on_close_request

fix: make sure that each widget operation operates on every interface

This should be ok even for widget actions like focus next because there can only ever be a single focused widget

cargo fmt

cleanup: dbg statement

fix(iced-sctk): replace panic with handling for remaining enum variants

refactor: use iced clipboard for interacting with the selection

refactor: allow passing an activation token when creating a window

sctk: Add support for `ext-session-lock` protocol

fix(sctk): build and use tree for layout of autosize surfaces

Update winit to latest commit used by upstream iced

fix(sctk): send key characters

fix(sctk): check if key is a named key first

refactor(sctk): keep compositor surface in state

feat: accessibility with some widget impls

feat: stable ids

a11y: Don't unconditionally pull winit (iced-rs#43)

Update conversion.rs

integration fixes

integration

integration

integration

integration

s

integration

some integration work

more integration

Update Cargo.toml

Update mod.rs

Update multi_window.rs

s

more integration

more integration (ryanabx wip #100000)

more integration!!

integration 2

integration

more integration (rbx)

s

integration

integration work

integration

Update Cargo.toml

integration

simple integration things

int

integration to 175

integration(170)

Co-Authored-By: Ashley Wulber <48420062+wash2@users.noreply.github.com>
Co-Authored-By: Victoria Brekenfeld <4404502+Drakulix@users.noreply.github.com>
Co-Authored-By: Eduardo Flores <edfloreshz@gmail.com>
Co-Authored-By: Michael Murphy <michael@mmurphy.dev>
Co-Authored-By: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
Co-Authored-By: Jeremy Soller <jeremy@system76.com>
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>

fix(column): handle keys len change

fix: iced-sctk a11y

wip: winit single window updates

tokio feature hangs even without a11y feature

fix: multiwindow a11y fixes

fix: component

update winit

wip: sctk integration to winit shell

refactor: remove accesskit_unix

fix: svg

fix: remove wayland default feature

feat: derive Hash for image Handle

fix: cleanup 0.13 rebase errors

fix: remove path dependencies

conversion for Radius

conversion for Padding

setter for Svg border radius

re-export Limits

fix: connect clipboard if disconnected on layer surface or popup creation

fix: connect clipboard if disconnected on session lock surface creation

fix: update size of layer surface after configure

fix: insert user interfaces for popup and lock surfaces on creation

fix: svg scaling

feat: popups on winit windows

fix: default text shaping to advanced

fix: fallback to renderer icon style if svg is symbolic

fixes

fix: sctk frame handling

feat: autosize handling

fix: better autosize handling

fix: avoid duplicate window events from sctk

fix: better handling of popups

fix: refactor redraw handling for sctk

fix: include id in frames

fix: image

fix: scrollable delta direction

sctk: unregister clipboard when surface is done

set min / max size when size is requested

fix: popups

filter pointer events

feat: add Hide variant to mouse Interaction

dnd fixes

fix: use physical width for DnD surface

fix: tiny-skia svg quality

refactor: peek_dnd try to parse data

cleanup text conversion

cleanup

svg scaling fixes

background color fix

Introduce consecutive_click_distance like other toolkits do such as gtk,qt,imgui.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants