Keep the approval dialog inside the window

This commit is contained in:
raucao committed 2026-11-13 20:51:40 +04:00
1 parent 69f82249f4
commit 30de699da5
1 file changed
+11 -2
+11 -2
View File
@@ -49,7 +49,10 @@ async fn present(widget: &gtk::Widget, question: &ApprovalRequest) -> Decision {
.body_use_markup(false)
.heading(heading(&question.request))
.body(story(&question.request))
.content_width(460)
// Narrower than the 420px default window: a floating `AdwDialog` is
// part of the window and is clipped by it, so it must be able to shrink
// to fit rather than poke out of the sides.
.content_width(360)
.extra_child(&details(question))
.build();
@@ -223,14 +226,20 @@ fn note(text: &str) -> gtk::Label {
}
/// The one way client-supplied text reaches the screen.
///
/// `WordChar` wrapping matters: the values include long tokens with no spaces
/// (an `npub`, a URL). With the default `Word` mode a long token cannot be
/// broken, so the label's *minimum* width becomes the whole token — which makes
/// the whole dialog wider than the window, and the floating dialog gets clipped.
fn plain(text: &str) -> gtk::Label {
gtk::Label::builder()
.label(text)
.use_markup(false)
.selectable(true)
.wrap(true)
.wrap_mode(gtk::pango::WrapMode::WordChar)
.xalign(0.0)
.max_width_chars(56)
.max_width_chars(48)
.halign(gtk::Align::Start)
.build()
}