PistonDevelopers / conrod

An easy-to-use, 2D GUI library written entirely in Rust.
Other
3.35k stars 296 forks source link

screen dislocation (OSX) #1134

Closed Jeff-Castles closed 6 years ago

Jeff-Castles commented 6 years ago

My Mac version: 10.13.3

When I execute cargo run --release --features "winit glium" --example all_winit_glium, it was successfully compiled.

However ,as shown in Fig. below, it is not as expected.

1518444409370

mitchmindtree commented 6 years ago

If you resize the window after it has initialised does it fix the issue? I've also noticed this problem appear on mac recently.

Either way, this issue likely comes from a problem in an upstream crate (perhaps glium?), or perhaps it has been fixed upstream and we haven't yet updated to the fixed version. I don't currently have access to a macos machine but perhaps you could try running the glium examples to test this?

syssecfsu commented 6 years ago

I have the same problem with Conrod on the Mac OS X.

I just quickly tested the examples in glium. It seems that the problem is indeed caused by glium. The following is the screenshot of tutorial 7. The teapot is supposed to be centered in a correct rendition.

screen shot 2018-02-12 at 10 12 19 am
harvath commented 6 years ago

Apparently this is a problem with the winit library. (glium depends on glutin, which depends on winit)

I built conrod with winit from this PR, and it worked perfectly. Not sure when this PR will be merged, but this is a serious bug that makes the library virtually unusable for OSX users so I had to share this

Haven't tried this yet, but another way to evade this error seems to be to build with glium v0.19.0.

mitchmindtree commented 6 years ago

Thanks @harvath, if you could comment in tomaka/winit#359 letting tomaka know that you've tested the PR on macos and that it fixes a few issues it will likely allow him to go ahead with merging it. The biggest blocker for mac PRs on winit is that tomaka doesn't have a mac to test on so he normally has to rely on another mac user testing and approving the PR before he can merge :+1: I no longer have access to a mac otherwise I'd do this myself!

quatrezoneilles commented 6 years ago

That problem is now fixed in winit 0.12 but there's an incompatible change somewhere in event conversion.

error[E0308]: mismatched types
  --> examples/text.rs:73:76
   |
73 |                 if let Some(event) = conrod::backend::winit::convert_event(event.clone(), &display) {
   |                                                                            ^^^^^^^^^^^^^ expected enum `winit::events::Event`, found enum `conrod::<unnamed>::<unnamed>::Event`
   |
   = note: expected type `winit::events::Event`
              found type `conrod::<unnamed>::<unnamed>::Event`
note: Perhaps two different versions of crate `winit` are being used?
mitchmindtree commented 6 years ago

@quatrezoneilles this is due to the requirement of our winit dependency to have the same version as glutin's winit dependency and glium's winit dependency (I have a PR for updating glutin here) - if these are different, rustc will presume they are different types or traits altogether.

While we wait for glutin and glium to update, I have a branch here that should work fine (just remember to cargo update before running it).

I'll leave this open until the fix actually makes it to master and gets published.

quatrezoneilles commented 6 years ago

Yes, it works now! Thanks! All the examples work (except for file_navigator.)