Follow craft-libs main: winit at 3fd7ae64, the unsaved-changes question as HostedUnsavedChangesDialog

craft-libs main pins winit 3fd7ae64, which adds WindowExtWayland::activate_with_token;
egui 399fc6e0's windowless root calls it on Linux. The KDE blur protocol moved behind
an opt-in feature there, so wayland-protocols-plasma leaves the lock.

craft-libs 154650a42 made UnsavedChangesDialog a builder that takes an opened binding;
the dialog host now holds a HostedUnsavedChangesDialog, which reports the same
UnsavedAnswer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-12-03 23:19:57 +01:00
1 parent 44bab155cb
commit c76161d1e0
5 files changed
+12 -26

No files matched your search

Generated
+1 -15
View File
@@ -10296,19 +10296,6 @@ dependencies = [
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-plasma"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91"
dependencies = [
"bitflags 2.13.2",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-wlr"
version = "0.3.12"
@@ -11032,7 +11019,7 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
name = "winit"
version = "0.30.13"
source = "git+https://github.com/storytold/winit.git?rev=f8b490f135ea439dd31aae100bb5591c63cb076f#f8b490f135ea439dd31aae100bb5591c63cb076f"
source = "git+https://github.com/storytold/winit.git?rev=3fd7ae64762f82a73b78bd24f453f82c4291067d#3fd7ae64762f82a73b78bd24f453f82c4291067d"
dependencies = [
"ahash",
"android-activity",
@@ -11071,7 +11058,6 @@ dependencies = [
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-protocols-plasma",
"web-sys",
"web-time",
"windows-sys 0.52.0",
+1 -1
View File
@@ -376,4 +376,4 @@ egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev
eframe = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" }
winit = { git = "https://github.com/storytold/winit.git", rev = "f8b490f135ea439dd31aae100bb5591c63cb076f" }
winit = { git = "https://github.com/storytold/winit.git", rev = "3fd7ae64762f82a73b78bd24f453f82c4291067d" }
+1 -1
View File
@@ -149,7 +149,7 @@ fn is_prompt<T: std::any::Any>(app: &PhotocraftApp, id: DialogId) -> bool {
}
fn is_unsaved(app: &PhotocraftApp, id: DialogId) -> bool {
host(app).get_by_id::<craft::ui::dialog::UnsavedChangesDialog>(id).is_some()
host(app).get_by_id::<craft::ui::dialog::HostedUnsavedChangesDialog>(id).is_some()
}
/// Whether confirming dialog `id` answers the unsaved-changes prompt with Save.
+8 -8
View File
@@ -6,7 +6,7 @@
//! tracked by id, not tab index, so closing one elsewhere while the prompt is up can't retarget it.
use craft::quit::{CloseAnswer, CloseScope};
use craft::ui::dialog::{DialogResult, UnsavedAnswer, UnsavedChangesDialog};
use craft::ui::dialog::{DialogResult, HostedUnsavedChangesDialog, UnsavedAnswer, UnsavedChangesDialog};
use craft::ui::shell::embed::CloseDecision;
use photocraft_doc::DocId;
use serde_json::{Value, json};
@@ -306,7 +306,7 @@ pub(crate) fn take(app: &mut PhotocraftApp, ctx: &egui::Context) {
}
// The answer of the open question. The host reports `Cancel` only for a question it closed from
// outside (a control client's cancel): the client wants the prompt dropped like Esc would.
let result = match app.framework.dialogs.take::<UnsavedChangesDialog>() {
let result = match app.framework.dialogs.take::<HostedUnsavedChangesDialog>() {
Some(DialogResult::Ok(given)) => Some((answer_choice(given), given.apply_to_all)),
Some(_) => Some((Answer::Cancel, false)),
None => None,
@@ -328,11 +328,11 @@ pub(crate) fn take(app: &mut PhotocraftApp, ctx: &egui::Context) {
}
return;
}
if !app.framework.dialogs.is_open::<UnsavedChangesDialog>() {
if !app.framework.dialogs.is_open::<HostedUnsavedChangesDialog>() {
let remaining = app.discard.as_ref().map_or(1, |p| p.docs.len());
// Apply to All is offered only while several documents are left, and never for a revert:
// the dialog decides from `remaining` and the scope.
app.framework.dialogs.open(UnsavedChangesDialog::new(scope, name).remaining(remaining));
app.framework.dialogs.open(HostedUnsavedChangesDialog::new(UnsavedChangesDialog::new(scope, name).remaining(remaining)));
if let Some(p) = app.discard.as_mut() {
p.asked = Some(doc);
}
@@ -353,14 +353,14 @@ fn scope_of(id: &str) -> CloseScope {
/// quitting replaced it, or its front document moved on. The result the host keeps for it is
/// dropped here so it is not taken as an answer.
fn close_stale_question(app: &mut PhotocraftApp, ctx: &egui::Context) {
if !app.framework.dialogs.is_open::<UnsavedChangesDialog>() {
if !app.framework.dialogs.is_open::<HostedUnsavedChangesDialog>() {
return;
}
let front = app.discard.as_ref().and_then(|p| p.docs.first().copied());
let asked = app.discard.as_ref().and_then(|p| p.asked);
if front.is_none() || front != asked {
app.framework.dialogs.cancel::<UnsavedChangesDialog>(ctx);
let _ = app.framework.dialogs.take::<UnsavedChangesDialog>();
app.framework.dialogs.cancel::<HostedUnsavedChangesDialog>(ctx);
let _ = app.framework.dialogs.take::<HostedUnsavedChangesDialog>();
}
}
@@ -424,7 +424,7 @@ pub const CONTROL_ID: &str = "discard";
/// The host's id of the open question, for a control request naming [`CONTROL_ID`].
pub(crate) fn host_id(app: &PhotocraftApp) -> Option<craft::ui::dialog::DialogId> {
app.framework.dialogs.get::<UnsavedChangesDialog>().map(craft::ui::dialog::StackDialog::id)
app.framework.dialogs.get::<HostedUnsavedChangesDialog>().map(craft::ui::dialog::StackDialog::id)
}
/// Lists the open question in `dialogs` (the host's `ui.inspect` entries) under [`CONTROL_ID`], its fields adding the
@@ -228,7 +228,7 @@ fn docs_left(h: &Prompted) -> Option<usize> {
/// Whether the question is on the dialog host.
fn question_open(h: &Prompted) -> bool {
h.state().framework.dialogs.is_open::<UnsavedChangesDialog>()
h.state().framework.dialogs.is_open::<HostedUnsavedChangesDialog>()
}
/// The open question's host id.