Skip to content

egui_glow's winit feature should be enabled on wasm #4420

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

Closed
simon-frankau opened this issue Apr 26, 2024 · 0 comments · Fixed by #4421
Closed

egui_glow's winit feature should be enabled on wasm #4420

simon-frankau opened this issue Apr 26, 2024 · 0 comments · Fixed by #4421

Comments

@simon-frankau
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I'm writing a program that pulls in egui for the GUI, and isn't a pure egui app, so I'm using egui_glow rather than eframe. I want it to work on both native and web, with minimal differences between the code paths. winit supports both. As such, I'd like to use the winit feature of egui_glow, but it's disabled for wasm.

Describe the solution you'd like

I'd like the winit feature enabled in egui_glow when wasm is selected.

I don't think this will cause problems for people who don't expect this, since to see a change you need to be pulling in egui_glow with the winit feature while compiling for wasm, and then you just get a few extra functions compiling which presumably get dead code elimination if not used.

It looks like this disabling was added in #1303, and is no longer required?

Describe alternatives you've considered

Currently I'm just using a hacked local fork of egui_glow. I guess I could just not use egui_glow::winit on any platform, but that rather defeats the point of it existing.

Additional context

Using egui_glow and winit on wasm is, TBH, much messier than eframe. If you don't get the canvas.{width,height} and canvas.style.{width,height} set correctly for the devicepixelratio, egui renders incorrectly, and by default it doesn't cope with the browser zoom changing.

There are probably other known shortcomings compared to eframe, but I've not tried doing anything fancy, so haven't encountered them yet.

It might be that we want to fix these before enabling egui_glow::winit on wasm. Or it might be good enough right now and better than nothing (certainly the case for me).

I could also rustle up a demo for this, probably by adding some conditional compilation code to pure_glow.rs, if that's helpful?

simon-frankau added a commit to simon-frankau/egui that referenced this issue Apr 26, 2024
Reverts change in emilk#1303, enabling the egui_glow::winit module when
using wasm.
emilk pushed a commit that referenced this issue Apr 29, 2024
Reverts change in #1303, enabling the egui_glow::winit module when using
wasm.

* Closes <#4420>
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
Reverts change in emilk#1303, enabling the egui_glow::winit module when using
wasm.

* Closes <emilk#4420>
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 a pull request may close this issue.

1 participant