pop-os / cosmic-text

Pure Rust multi-line text handling

Home Page:https://pop-os.github.io/cosmic-text/cosmic_text/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while compiling editor-libcosmic example

wiiznokes opened this issue · comments

cargo run
   Compiling iced_winit v0.9.1 (https://github.com/pop-os/libcosmic?rev=e3f30a1#e3f30a1b)
   Compiling iced_widget v0.1.0 (https://github.com/pop-os/libcosmic?rev=e3f30a1#e3f30a1b)
error[E0308]: mismatched types
   --> C:\Users\wiiz\.cargo\git\checkouts\libcosmic-b367e32ffc370f4f\e3f30a1\iced\winit\src\settings.rs:175:41
    |
175 |                     .with_parent_window(self.platform_specific.parent);
    |                      ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `Option<RawWindowHandle>`
    |                      |
    |                      arguments to this method are incorrect
    |
    = note: expected type `isize`
               found enum `Option<RawWindowHandle>`
note: method defined here
   --> C:\Users\wiiz\.cargo\git\checkouts\winit-40d7deb2b0c08730\d35712b\src\platform\windows.rs:187:8
    |
187 |     fn with_parent_window(self, parent: HWND) -> WindowBuilder;
    |        ^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `iced_winit` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...

platform: Windows 10

I'm trying to get all of the examples to work for my multi-size text PR, and I've encountered this issue compiling on Windows 10.

I've done some investigation:

  1. libcosmic pins a forked version of iced (containing iced_winit).
  2. The forked version of iced_winit also separately pins a forked version of winit.
  3. These versions are not compatible on Windows.
  4. The pinned version of iced_winit expects a winit = "0.28"-like API
    // essentially:
    winit::window::WindowBuilder::with_parent_window(self, parent: Option<RawWindowHandle>)

    https://github.com/pop-os/iced/blob/d36f1e98f5e6e6cb7da49bf52b21c4aa08666b16/winit/src/settings/windows.rs#L8

  5. but the pinned version of winit is a winit = "0.27"-like API
    // essentially:
    type HWND = isize;
    <winit::window::WindowBuilder as winit::platform::windows::WindowBuilderExtWindows>::with_parent_window(self, parent: HWND)

    https://github.com/pop-os/winit/blob/iced/src/platform/windows.rs#L15

I tried to get the example running on Windows 10. The commit that is currently used for libcosmic is e3f30a1 which is from August 16th. I used the latest revision and am now getting a different error:

error[E0433]: failed to resolve: use of undeclared crate or module `freedesktop_icons`
  --> C:\Users\asdf\.cargo\git\checkouts\libcosmic-b367e32ffc370f4f\470b966\src\widget\icon\named.rs:51:34
   |
51 |                 let mut lookup = freedesktop_icons::lookup(name)
   |                                  ^^^^^^^^^^^^^^^^^ use of undeclared crate or module `freedesktop_icons`

freedesktop-icons is listed as a Unix dependency in Cargo.toml. I tried compiling it on windows but got this error:

error[E0432]: unresolved import `xdg::BaseDirectories`
 --> C:\Users\asdf\.cargo\registry\src\index.crates.io-6f17d22bba15001f\freedesktop-icons-0.2.4\src\theme\paths.rs:7:5
  |
7 | use xdg::BaseDirectories;
  |     ^^^^^^^^^^^^^^^^^^^^ no `BaseDirectories` in the root

That's as far down the rabbit hole I went, as xdg looks to be another Unix-specific crate. This issue created by another Windows user also mentions xdg::BaseDirectories.