mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 09:05:51 +00:00
Merge upstream/main into cache-defaults-3298
This commit is contained in:
commit
6bea5fa6ae
66 files changed
+2992
-883
No files matched your search
@@ -441,6 +441,8 @@ fn run_desktop(reporter: &crash_report::Shutdown) -> eframe::Result {
|
||||
#[cfg(target_os = "macos")]
|
||||
menu: native_menu::NativeBar::new(&cc.egui_ctx),
|
||||
#[cfg(target_os = "macos")]
|
||||
menu_sync: Default::default(),
|
||||
#[cfg(target_os = "macos")]
|
||||
apple_events: apple_events.connect(&cc.egui_ctx),
|
||||
app,
|
||||
file_dialogs,
|
||||
@@ -531,6 +533,8 @@ struct Desktop {
|
||||
dialog_errors: std::sync::mpsc::Receiver<String>,
|
||||
#[cfg(target_os = "macos")]
|
||||
menu: native_menu::NativeBar,
|
||||
#[cfg(target_os = "macos")]
|
||||
menu_sync: effectcraft_ui_egui::native_menu::MenuSync,
|
||||
/// Documents opened from Finder, the Dock or `open` (macOS).
|
||||
#[cfg(target_os = "macos")]
|
||||
apple_events: apple_events::Opened,
|
||||
@@ -547,7 +551,7 @@ impl eframe::App for Desktop {
|
||||
/// file dialogs asked for and, last, hand a close to the platform quit.
|
||||
fn logic(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
#[cfg(target_os = "macos")]
|
||||
self.menu.update(&mut self.app, ctx);
|
||||
self.menu_sync.before(&mut self.app, |app| self.menu.update(app, ctx));
|
||||
self.app.tick(ctx, frame);
|
||||
self.app.finish_ime_logic(ctx);
|
||||
while let Ok(e) = self.dialog_errors.try_recv() {
|
||||
@@ -561,6 +565,9 @@ impl eframe::App for Desktop {
|
||||
|
||||
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {
|
||||
self.app.ui(ui, frame);
|
||||
// A file dialog this frame's commands opened (or one that closed) syncs the menu again.
|
||||
#[cfg(target_os = "macos")]
|
||||
self.menu_sync.after(&mut self.app, |app| self.menu.update(app, ui.ctx()));
|
||||
if let Some(asked) = &self.file_dialogs {
|
||||
file_dialogs::show_asked(asked, frame, ui.ctx());
|
||||
}
|
||||
|
||||
@@ -118,6 +118,12 @@ impl NativeBar {
|
||||
Role::Hide => PredefinedMenuItem::hide(Some(label)),
|
||||
Role::HideOthers => PredefinedMenuItem::hide_others(Some(label)),
|
||||
Role::ShowAll => PredefinedMenuItem::show_all(Some(label)),
|
||||
Role::SelectAll => PredefinedMenuItem::select_all(Some(label)),
|
||||
Role::Cut => PredefinedMenuItem::cut(Some(label)),
|
||||
Role::Copy => PredefinedMenuItem::copy(Some(label)),
|
||||
Role::Paste => PredefinedMenuItem::paste(Some(label)),
|
||||
Role::Undo => PredefinedMenuItem::undo(Some(label)),
|
||||
Role::Redo => PredefinedMenuItem::redo(Some(label)),
|
||||
};
|
||||
parent.append(&item)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user