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

Fix cross-platform mudabar, wire up better CI #75

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

jkelleyrtp
Copy link
Member

@jkelleyrtp jkelleyrtp commented Jun 20, 2024

Needed to fix some issues regarding muda - looks like we never implemented some of it.

Had to allow deprecated on the closure approach for winit.

Stole our CI for multiplatform from dioxus

(todo) override opt-level for CI

@@ -0,0 +1,6 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committing this seems like a bad idea as it means that people won't be able to set their own settings. Maybe a "template" file with a different name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree here 👍 maybe .vscode.template or similar? This was really helpful for me (I didn't know about allTargets 👀) so other people might find that nice too

Comment on lines 297 to 300
// for now, forget the menu_bar so it doesn't get dropped
// there's a bug in muda that causes this to segfault
// todo: we should just store this somewhere
std::mem::forget(menu_bar);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this just be a field of View?

toolchain: "1.75.0",
cross: false,
command: "build",
args: "--package dioxus-mobile",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building dioxus-mobile in blitz CI probably doesn't make sense?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just skip on android/ios for the time being

- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
toolchain: "1.75.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 1.75?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does toolchain need to be specified per-platform. Could just make global?

@@ -23,7 +25,6 @@ use winit::platform::unix::WindowExtUnix;
use winit::platform::windows::WindowExtWindows;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like winit has wayland and x11 platforms rather than unix.

Comment on lines 327 to 336
#[cfg(target_os = "windows")]
{
use winit::platform::windows::WindowExtWindows;
use winit::raw_window_handle;
let id = window.window_handle_any_thread().unwrap();
if let raw_window_handle::RawWindowHandle::Win32(rwh) = rwh {
let hwnd = id.hwnd;
_ = menu.init_for_hwnd(hwnd as _);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it no longer compiles on Windows.

I just noticed my earlier change wasn't working either though, I think as long as we re-use the menu and make sure it isn't dropped we're OK.

Suggested change
#[cfg(target_os = "windows")]
{
use winit::platform::windows::WindowExtWindows;
use winit::raw_window_handle;
let id = window.window_handle_any_thread().unwrap();
if let raw_window_handle::RawWindowHandle::Win32(rwh) = rwh {
let hwnd = id.hwnd;
_ = menu.init_for_hwnd(hwnd as _);
}
}
#[cfg(target_os = "windows")]
{
use winit::raw_window_handle::*;
if let RawWindowHandle::Win32(handle) = window.window_handle().unwrap().as_raw() {
menu.init_for_hwnd(handle.hwnd.get()).unwrap();
}
}

* Fix menu on windows
* Refactor menu initialization
* Fix missing gtk in CI
* Create CONTRIBUTING.MD
* Add info text
@nicoburns nicoburns merged commit f5cecd7 into main Jun 20, 2024
8 checks passed
@nicoburns nicoburns deleted the jk/fix-winit-plus-cross branch June 20, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants