Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/SharpWebview/Bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,20 @@ internal extern static void webview_return(IntPtr webview,
RPCResult result,
[MarshalAs(UnmanagedType.LPUTF8Str)] string resultJson);

/*
Not mapped:

// Returns a native window handle pointer. When using GTK backend the pointer
// is GtkWindow pointer, when using Cocoa backend the pointer is NSWindow
// pointer, when using Win32 backend the pointer is HWND pointer.
WEBVIEW_API void *webview_get_window(webview_t w);
*/
/// <summary>
/// <para>
/// Returns a native window handle pointer. When using GTK backend the pointer
/// is GtkWindow pointer, when using Cocoa backend the pointer is NSWindow
/// pointer, when using Win32 backend the pointer is HWND pointer.
/// </para>
/// <para>
/// Binding for:
/// WEBVIEW_API void *webview_get_window(webview_t w);
/// </para>
/// </summary>
/// <param name="webview">The webview to get the handle.</param>
/// <returns></returns>
[DllImport(DllFile, CallingConvention = CallingConvention.Cdecl)]
internal extern static IntPtr webview_get_window(IntPtr webview);
}
}
9 changes: 9 additions & 0 deletions src/SharpWebview/Webview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ public void Dispatch(Action dispatchFunc)
Bindings.webview_dispatch(_nativeWebview, dispatchFuncInstance, IntPtr.Zero);
}

/// <summary>
/// Get the native window of the webview.
/// </summary>
/// <returns>Native window handle.</returns>
public IntPtr GetWindow()
{
return Bindings.webview_get_window(_nativeWebview);
}

/// <summary>
/// Disposes the current webview.
/// </summary>
Expand Down