Skip to content

Commit

Permalink
handle webkit2gtk close signal (#1311)
Browse files Browse the repository at this point in the history
* handle webkit2gtk close signal

from docs: https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html#WebKitWebView-close

Emitted when closing a WebKitWebView is requested. This occurs when a call is made from JavaScript's window.close function. It is the owner's responsibility to handle this signal to hide or destroy the WebKitWebView, if necessary.

Signed-off-by: Mateusz Kurowski <[email protected]>

* chore: add changeset

Signed-off-by: Mateusz Kurowski <[email protected]>

---------

Signed-off-by: Mateusz Kurowski <[email protected]>
  • Loading branch information
bukowa authored Jul 15, 2024
1 parent d1f1e7e commit 03cdf93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/handle-webkit2gtk-close-signal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Handle `webkit2gtk` close signal (when `window.close` is called from js)
3 changes: 3 additions & 0 deletions src/webkitgtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ impl InnerWebView {
web_context: &mut WebContext,
attributes: &mut WebViewAttributes,
) {
// window.close()
webview.connect_close(move |webview| unsafe { webview.destroy() });

// Synthetic mouse events
synthetic_mouse_events::setup(webview);

Expand Down

0 comments on commit 03cdf93

Please sign in to comment.