1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! Closes a dialog that is holding up the process.
//!
//! The engine raises some dialogs before a caller can configure anything away.
//! The clearest case is the warning that sequence files were left unreleased
//! when the engine was last destroyed: it appears while the engine object is
//! being created, so it is already on screen by the time the first line of
//! caller code runs, and no station option suppresses it. On a station with
//! somebody sitting at it that is a click. On a headless host it is a hang that
//! ends in the engine being killed and reinitialised.
//!
//! Closing is done with a posted `WM_CLOSE`, never a synthesised click. Posting
//! returns immediately, so the thread doing the closing cannot itself be stuck
//! behind the modal loop, and the message goes to the window rather than to
//! whatever happens to be under the cursor. A dialog whose only button is *OK*
//! treats closing as that button.
//!
//! This is a blunt instrument by nature: it answers a question without reading
//! it. That is why it is never the default, why the text is captured first so
//! the caller can log what was dismissed, and why it is scoped to a short window
//! around a call known to raise one of these.
use ;
use UI;
use ;
/// What happened to a dialog that was dismissed.
/// Asks the first visible dialog owned by this process to close.
///
/// Returns `None` when there is nothing to close.
/// How long to wait for a window to go away, in total.
const CONFIRM_ATTEMPTS: u8 = 20;
/// Gap between checks.
const CONFIRM_INTERVAL: Duration = from_millis;
/// Posts `WM_CLOSE` and reports whether the window went away.