|
@@ -423,6 +423,7 @@ enum WindowMessage {
|
|
|
SetMaxSize(Option<Size>),
|
|
|
SetPosition(Position),
|
|
|
SetFullscreen(bool),
|
|
|
+ SetFocus,
|
|
|
SetIcon(WindowIcon),
|
|
|
DragWindow,
|
|
|
}
|
|
@@ -763,6 +764,14 @@ impl Dispatch for WryDispatcher {
|
|
|
.map_err(|_| Error::FailedToSendMessage)
|
|
|
}
|
|
|
|
|
|
+ fn set_focus(&self) -> Result<()> {
|
|
|
+ self
|
|
|
+ .context
|
|
|
+ .proxy
|
|
|
+ .send_event(Message::Window(self.window_id, WindowMessage::SetFocus))
|
|
|
+ .map_err(|_| Error::FailedToSendMessage)
|
|
|
+ }
|
|
|
+
|
|
|
fn set_icon(&self, icon: Icon) -> Result<()> {
|
|
|
self
|
|
|
.context
|
|
@@ -1193,6 +1202,9 @@ fn handle_event_loop(
|
|
|
window.set_fullscreen(None)
|
|
|
}
|
|
|
}
|
|
|
+ WindowMessage::SetFocus => {
|
|
|
+ window.set_focus();
|
|
|
+ }
|
|
|
WindowMessage::SetIcon(icon) => {
|
|
|
window.set_window_icon(Some(icon));
|
|
|
}
|