Skip to content

Commit

Permalink
rename hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jan 24, 2024
1 parent 9d3812e commit f692b5f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl<T: UserEvent> Context<T> {
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&self,
pending: PendingWindow<T, Wry<T>>,
before_window_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Wry<T>>> {
let label = pending.label.clone();
let context = self.clone();
Expand All @@ -248,7 +248,7 @@ impl<T: UserEvent> Context<T> {
event_loop,
&context,
pending,
before_window_creation,
after_window_creation,
)
}),
),
Expand Down Expand Up @@ -1532,9 +1532,9 @@ impl<T: UserEvent> WindowDispatch<T> for WryWindowDispatcher<T> {
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&mut self,
pending: PendingWindow<T, Self::Runtime>,
before_window_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>> {
self.context.create_window(pending, before_window_creation)
self.context.create_window(pending, after_window_creation)
}

// Creates a webview by dispatching a message to the event loop.
Expand Down Expand Up @@ -1974,9 +1974,9 @@ impl<T: UserEvent> RuntimeHandle<T> for WryHandle<T> {
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&self,
pending: PendingWindow<T, Self::Runtime>,
before_window_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>> {
self.context.create_window(pending, before_window_creation)
self.context.create_window(pending, after_window_creation)
}

// Creates a webview by dispatching a message to the event loop.
Expand Down Expand Up @@ -2141,7 +2141,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&self,
pending: PendingWindow<T, Self>,
before_window_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self>> {
let label = pending.label.clone();
let window_id = self.context.next_window_id();
Expand All @@ -2156,7 +2156,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
&self.event_loop,
&self.context,
pending,
before_window_creation,
after_window_creation,
)?;

let dispatcher = WryWindowDispatcher {
Expand Down Expand Up @@ -3078,7 +3078,7 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
event_loop: &EventLoopWindowTarget<Message<T>>,
context: &Context<T>,
pending: PendingWindow<T, Wry<T>>,
before_window_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<WindowWrapper> {
#[allow(unused_mut)]
let PendingWindow {
Expand Down Expand Up @@ -3132,7 +3132,7 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
let _ = center_window(&window, window.inner_size());
}

if let Some(handler) = before_window_creation {
if let Some(handler) = after_window_creation {
let raw = RawWindow {
#[cfg(windows)]
hwnd: window.hwnd(),
Expand Down
4 changes: 2 additions & 2 deletions core/tauri-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub trait Runtime<T: UserEvent>: Debug + Sized + 'static {
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&self,
pending: PendingWindow<T, Self>,
before_webview_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self>>;

/// Create a new webview.
Expand Down Expand Up @@ -538,7 +538,7 @@ pub trait WindowDispatch<T: UserEvent>: Debug + Clone + Send + Sync + Sized + 's
fn create_window<F: Fn(RawWindow) + Send + 'static>(
&mut self,
pending: PendingWindow<T, Self::Runtime>,
before_webview_creation: Option<F>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>>;

/// Create a new webview.
Expand Down
6 changes: 3 additions & 3 deletions core/tauri/src/test/mock_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<T: UserEvent> RuntimeHandle<T> for MockRuntimeHandle {
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self::Runtime>,
_before_webview_creation: Option<F>,
_after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>> {
let id = self.context.next_window_id();

Expand Down Expand Up @@ -641,7 +641,7 @@ impl<T: UserEvent> WindowDispatch<T> for MockWindowDispatcher {
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&mut self,
pending: PendingWindow<T, Self::Runtime>,
_before_webview_creation: Option<F>,
_after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>> {
let id = self.context.next_window_id();

Expand Down Expand Up @@ -902,7 +902,7 @@ impl<T: UserEvent> Runtime<T> for MockRuntime {
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self>,
_before_webview_creation: Option<F>,
_after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self>> {
let id = self.context.next_window_id();

Expand Down

0 comments on commit f692b5f

Please sign in to comment.