@@ -6,8 +6,9 @@ use bevy_math::{IVec2, Vec2};
6
6
/// A window event that is sent whenever a window's logical size has changed.
7
7
#[ derive( Debug , Clone ) ]
8
8
pub struct WindowResized {
9
- pub entity : Entity ,
10
- /// The new logical width of the window
9
+ /// Window that has changed.
10
+ pub window : Entity ,
11
+ /// The new logical width of the window.
11
12
pub width : f64 ,
12
13
/// The new logical height of the window.
13
14
pub height : f64 ,
@@ -25,31 +26,35 @@ pub struct RequestRedraw;
25
26
/// event will be sent in the handler for that event.
26
27
#[ derive( Debug , Clone ) ]
27
28
pub struct WindowCreated {
28
- pub entity : Entity ,
29
+ /// Window that has been created.
30
+ pub window : Entity ,
29
31
}
30
32
31
33
/// An event that is sent whenever the operating systems requests that a window
32
34
/// be closed. This will be sent when the close button of the window is pressed.
33
35
///
34
36
/// If the default [`WindowPlugin`] is used, these events are handled
35
- /// by [ closing] the corresponding [`Window`].
37
+ /// by closing the corresponding [`Window`].
36
38
/// To disable this behaviour, set `close_when_requested` on the [`WindowPlugin`]
37
39
/// to `false`.
38
40
///
39
41
/// [`WindowPlugin`]: crate::WindowPlugin
40
42
/// [`Window`]: crate::Window
41
43
#[ derive( Debug , Clone ) ]
42
44
pub struct WindowCloseRequested {
43
- pub entity : Entity ,
45
+ /// Window to close.
46
+ pub window : Entity ,
44
47
}
45
48
46
49
/// An event that is sent whenever a window is closed. This will be sent by the
47
50
/// handler for [`WindowCloseRequested`] or similar.
48
51
#[ derive( Debug , Clone ) ]
49
52
pub struct WindowClosed {
50
- pub entity : Entity ,
53
+ /// Window that has been closed.
54
+ /// TODO: Does this entity actually exist anymore?
55
+ pub window : Entity ,
51
56
}
52
- /// An event reporting that the mouse cursor has moved on a window.
57
+ /// An event reporting that the mouse cursor has moved inside a window.
53
58
///
54
59
/// The event is sent only if the cursor is over one of the application's windows.
55
60
/// It is the translated version of [`WindowEvent::CursorMoved`] from the `winit` crate.
@@ -61,7 +66,7 @@ pub struct WindowClosed {
61
66
#[ derive( Debug , Clone ) ]
62
67
pub struct CursorMoved {
63
68
/// Window that the cursor moved inside.
64
- pub entity : Entity ,
69
+ pub window : Entity ,
65
70
/// The cursor position in logical pixels.
66
71
pub position : Vec2 ,
67
72
}
@@ -70,29 +75,30 @@ pub struct CursorMoved {
70
75
#[ derive( Debug , Clone ) ]
71
76
pub struct CursorEntered {
72
77
/// Window that the cursor entered.
73
- pub entity : Entity ,
78
+ pub window : Entity ,
74
79
}
75
80
76
81
/// An event that is sent whenever the user's cursor leaves a window.
77
82
#[ derive( Debug , Clone ) ]
78
83
pub struct CursorLeft {
79
84
/// Window that the cursor left.
80
- pub entity : Entity ,
85
+ pub window : Entity ,
81
86
}
82
87
83
88
/// An event that is sent whenever a window receives a character from the OS or underlying system.
84
89
#[ derive( Debug , Clone ) ]
85
90
pub struct ReceivedCharacter {
86
91
/// Window that received the character.
87
- pub entity : Entity ,
92
+ pub window : Entity ,
93
+ /// Received character.
88
94
pub char : char ,
89
95
}
90
96
91
97
/// An event that indicates a window has received or lost focus.
92
98
#[ derive( Debug , Clone ) ]
93
99
pub struct WindowFocused {
94
100
/// Window that changed focus.
95
- pub entity : Entity ,
101
+ pub window : Entity ,
96
102
/// Whether it was focused (true) or lost focused (false).
97
103
pub focused : bool ,
98
104
}
@@ -101,38 +107,43 @@ pub struct WindowFocused {
101
107
#[ derive( Debug , Clone ) ]
102
108
pub struct WindowScaleFactorChanged {
103
109
/// Window that had it's scale factor changed.
104
- pub entity : Entity ,
110
+ pub window : Entity ,
105
111
/// The new scale factor.
106
112
pub scale_factor : f64 ,
107
113
}
108
114
109
115
/// An event that indicates a window's OS-reported scale factor has changed.
110
116
#[ derive( Debug , Clone ) ]
111
117
pub struct WindowBackendScaleFactorChanged {
112
- pub entity : Entity ,
118
+ /// Window that had it's scale factor changed by the backend.
119
+ pub window : Entity ,
120
+ /// The new scale factor.
113
121
pub scale_factor : f64 ,
114
122
}
115
123
116
124
/// Events related to files being dragged and dropped on a window.
117
125
#[ derive( Debug , Clone ) ]
118
126
pub enum FileDragAndDrop {
127
+ /// File is being dropped into a window.
119
128
DroppedFile {
120
129
/// Window the file was dropped into.
121
- entity : Entity ,
130
+ window : Entity ,
122
131
/// Path to the file that was dropped in.
123
132
path_buf : PathBuf ,
124
133
} ,
125
134
135
+ /// File is currently being hovered over a window.
126
136
HoveredFile {
127
137
/// Window a file is possibly going to be dropped into.
128
- entity : Entity ,
138
+ window : Entity ,
129
139
/// Path to the file that might be dropped in.
130
140
path_buf : PathBuf ,
131
141
} ,
132
142
143
+ /// File hovering was cancelled.
133
144
HoveredFileCancelled {
134
145
/// Window that had a cancelled file drop.
135
- entity : Entity ,
146
+ window : Entity ,
136
147
} ,
137
148
}
138
149
0 commit comments