You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using miniquad for graphics together with egui, plus the glue crate egui-miniquad. I've been using rfd to open a file dialog window with FileDialog::pick_file and it works perfectly on Linux, but when I tried this on MacOS the dialog window does not open. The program does not crash, the method returns None and I get this dump on the terminal:
I've tested rfd on miniquad by itself and on egui by itself and it works on both (even in MacOS), so the problem seems to be specific to egui-miniquad + rfd + MacOS. I've read on some of the other issue threads and noticed that there might be issues related to which thread the window is created, so I also printed the current thread both on the first line of main and before opening the window (but this example seems to be single threaded), and in both cases we get ThreadId(1).
The code I used is this (a smaller version of demo.rs on egui-miniquad):
use{egui_miniquad as egui_mq, miniquad as mq};structStage{egui_mq: egui_mq::EguiMq,show_egui_demo_windows:bool,egui_demo_windows: egui_demo_lib::DemoWindows,color_test: egui_demo_lib::ColorTest,pixels_per_point:f32,}implStage{fnnew(ctx:&mut mq::Context) -> Self{Self{egui_mq: egui_mq::EguiMq::new(ctx),show_egui_demo_windows:true,egui_demo_windows:Default::default(),color_test:Default::default(),pixels_per_point: ctx.dpi_scale(),}}}impl mq::EventHandlerforStage{fnupdate(&mutself,_ctx:&mut mq::Context){}fndraw(&mutself,mq_ctx:&mut mq::Context){
mq_ctx.clear(Some((1.,1.,1.,1.)),None,None);
mq_ctx.begin_default_pass(mq::PassAction::clear_color(0.0,0.0,0.0,1.0));
mq_ctx.end_render_pass();let dpi_scale = mq_ctx.dpi_scale();// Run the UI code:self.egui_mq.run(mq_ctx, |_mq_ctx, egui_ctx| {
egui::Window::new("egui ❤ miniquad").show(egui_ctx, |ui| {// ###################// RFD PARTif ui.button("RFD").clicked(){println!("{:?}", std::thread::current().id());let dialog = rfd::FileDialog::new();println!("dialog created");let res = rfd::FileDialog::new();dbg!(&res);ifletSome(f) = res {println!("chose: {f:?}");}}});});// Draw things behind egui hereself.egui_mq.draw(mq_ctx);// Draw things in front of egui here
mq_ctx.commit_frame();}fnmouse_motion_event(&mutself, _:&mut mq::Context,x:f32,y:f32){self.egui_mq.mouse_motion_event(x, y);}fnmouse_wheel_event(&mutself, _:&mut mq::Context,dx:f32,dy:f32){self.egui_mq.mouse_wheel_event(dx, dy);}fnmouse_button_down_event(&mutself,ctx:&mut mq::Context,mb: mq::MouseButton,x:f32,y:f32,){self.egui_mq.mouse_button_down_event(ctx, mb, x, y);}fnmouse_button_up_event(&mutself,ctx:&mut mq::Context,mb: mq::MouseButton,x:f32,y:f32,){self.egui_mq.mouse_button_up_event(ctx, mb, x, y);}fnchar_event(&mutself,_ctx:&mut mq::Context,character:char,_keymods: mq::KeyMods,_repeat:bool,){self.egui_mq.char_event(character);}fnkey_down_event(&mutself,ctx:&mut mq::Context,keycode: mq::KeyCode,keymods: mq::KeyMods,_repeat:bool,){self.egui_mq.key_down_event(ctx, keycode, keymods);}fnkey_up_event(&mutself,_ctx:&mut mq::Context,keycode: mq::KeyCode,keymods: mq::KeyMods){self.egui_mq.key_up_event(keycode, keymods);}}fnmain(){println!("{:?}", std::thread::current().id());#[cfg(not(target_arch = "wasm32"))]{// Log to stdout (if you run with `RUST_LOG=debug`).
tracing_subscriber::fmt::init();}let conf = mq::conf::Conf{high_dpi:true,window_width:1200,window_height:1024,
..Default::default()};
mq::start(conf, |mut ctx| Box::new(Stage::new(&mut ctx)));}
Same behaviour also happens with pick_folder.
Tested on MacOS Ventura 13.2.1.
Thanks for reading. Any feedback is appreciated.
The text was updated successfully, but these errors were encountered:
I'm using miniquad for graphics together with egui, plus the glue crate egui-miniquad. I've been using
rfd
to open a file dialog window withFileDialog::pick_file
and it works perfectly on Linux, but when I tried this on MacOS the dialog window does not open. The program does not crash, the method returnsNone
and I get this dump on the terminal:I've tested
rfd
on miniquad by itself and onegui
by itself and it works on both (even in MacOS), so the problem seems to be specific toegui-miniquad
+rfd
+ MacOS. I've read on some of the other issue threads and noticed that there might be issues related to which thread the window is created, so I also printed the current thread both on the first line ofmain
and before opening the window (but this example seems to be single threaded), and in both cases we getThreadId(1)
.The code I used is this (a smaller version of
demo.rs
onegui-miniquad
):Same behaviour also happens with
pick_folder
.Tested on MacOS Ventura 13.2.1.
Thanks for reading. Any feedback is appreciated.
The text was updated successfully, but these errors were encountered: