Merge pull request #271 from lytico/lytico/webkit2

Webkit2 -Support
This commit is contained in:
lytico 2021-07-20 01:31:41 +02:00 committed by GitHub
commit b56ef3b246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 6121 additions and 2 deletions

View file

@ -38,6 +38,11 @@ class Settings
new GAssembly("GtkSourceSharp") new GAssembly("GtkSourceSharp")
{ {
Deps = new[] { "GLibSharp", "GtkSharp", "GioSharp", "CairoSharp", "PangoSharp", "GdkSharp" }, Deps = new[] { "GLibSharp", "GtkSharp", "GioSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
},
new GAssembly("WebkitGtkSharp")
{
Deps = new[] { "GtkSharp","GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
ExtraArgs = "--abi-cs-usings=Webkit,Gtk,GLib,Gdk,Atk,Pango,Cairo"
} }
}; };
} }

View file

@ -22,6 +22,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples", "Samples\Samples.
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GtkSourceSharp", "Libs\GtkSourceSharp\GtkSourceSharp.csproj", "{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GtkSourceSharp", "Libs\GtkSourceSharp\GtkSourceSharp.csproj", "{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebkitGtkSharp", "Libs\WebkitGtkSharp\WebkitGtkSharp.csproj", "{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -140,6 +142,18 @@ Global
{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x64.Build.0 = Release|Any CPU {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x64.Build.0 = Release|Any CPU
{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.ActiveCfg = Release|Any CPU {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.ActiveCfg = Release|Any CPU
{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.Build.0 = Release|Any CPU {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.Build.0 = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|x64.ActiveCfg = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|x64.Build.0 = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|x86.ActiveCfg = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Debug|x86.Build.0 = Debug|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|Any CPU.Build.0 = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|x64.ActiveCfg = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|x64.Build.0 = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|x86.ActiveCfg = Release|Any CPU
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -153,6 +167,7 @@ Global
{B4B26375-BED5-4000-A38F-899FF1672B47} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} {B4B26375-BED5-4000-A38F-899FF1672B47} = {CCEA1235-D75F-4919-83F6-16793B11BEF5}
{04597E0B-375D-4E08-A16C-EE5FF3937B73} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} {04597E0B-375D-4E08-A16C-EE5FF3937B73} = {CCEA1235-D75F-4919-83F6-16793B11BEF5}
{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8} = {CCEA1235-D75F-4919-83F6-16793B11BEF5}
{60E31DAD-B6E8-4074-B2ED-53FCDFCB0F4D} = {CCEA1235-D75F-4919-83F6-16793B11BEF5}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DA4DD75D-B6C8-4836-AF84-B5FF538D9D86} SolutionGuid = {DA4DD75D-B6C8-4836-AF84-B5FF538D9D86}

View file

@ -28,6 +28,8 @@ class GLibrary
_libraryDefinitions[Library.Gtk] = new[] { "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib", "gtk-3.dll" }; _libraryDefinitions[Library.Gtk] = new[] { "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib", "gtk-3.dll" };
_libraryDefinitions[Library.PangoCairo] = new[] { "libpangocairo-1.0-0.dll", "libpangocairo-1.0.so.0", "libpangocairo-1.0.0.dylib", "pangocairo-1.dll" }; _libraryDefinitions[Library.PangoCairo] = new[] { "libpangocairo-1.0-0.dll", "libpangocairo-1.0.so.0", "libpangocairo-1.0.0.dylib", "pangocairo-1.dll" };
_libraryDefinitions[Library.GtkSource] = new[] { "libgtksourceview-4-0.dll", "libgtksourceview-4.so.0", "libgtksourceview-4.0.dylib", "gtksourceview-4.dll" }; _libraryDefinitions[Library.GtkSource] = new[] { "libgtksourceview-4-0.dll", "libgtksourceview-4.so.0", "libgtksourceview-4.0.dylib", "gtksourceview-4.dll" };
_libraryDefinitions[Library.Webkit] = new[] { "libwebkit2gtk-4.0.dll", "libwebkit2gtk-4.0.so.37", "libwebkit2gtk-4.0.dylib", "libwebkit2gtk-4.0.0.dll" };
} }
public static IntPtr Load(Library library) public static IntPtr Load(Library library)

View file

@ -11,5 +11,6 @@ enum Library
Gdk, Gdk,
GdkPixbuf, GdkPixbuf,
Gtk, Gtk,
GtkSource GtkSource,
Webkit
} }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PackageProjectUrl>https://github.com/GtkSharp/GtkSharp</PackageProjectUrl>
<RepositoryUrl>https://github.com/GtkSharp/GtkSharp</RepositoryUrl>
<Description>GtkWebkitSharp is a C# wrapper for the Gtk-Webkit library.</Description>
<PackageTags>webkitgtk;webkitgtksharp;webkit-sharp;wrapper</PackageTags>
<RootNamespace>GtkWebkitSharp</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\BuildOutput\Debug</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GtkSharp\GtkSharp.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<metadata>
<attr path="/api/namespace/object[@cname='WebKitAuthenticationRequest']/method[@name='CanSaveCredentials']" name="name">GetCanSaveCredentials</attr>
<attr path="/api/namespace/object[@cname='WebKitFormSubmissionRequest']/method[@name='ListTextFields']" name="hidden">true</attr>
</metadata>

View file

@ -28,5 +28,6 @@
<ProjectReference Include="..\Libs\GtkSharp\GtkSharp.csproj" /> <ProjectReference Include="..\Libs\GtkSharp\GtkSharp.csproj" />
<ProjectReference Include="..\Libs\PangoSharp\PangoSharp.csproj" /> <ProjectReference Include="..\Libs\PangoSharp\PangoSharp.csproj" />
<ProjectReference Include="..\Libs\GtkSourceSharp\GtkSourceSharp.csproj" /> <ProjectReference Include="..\Libs\GtkSourceSharp\GtkSourceSharp.csproj" />
<ProjectReference Include="..\Libs\WebkitGtkSharp\WebkitGtkSharp.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -0,0 +1,52 @@
// This is free and unencumbered software released into the public domain.
// Happy coding!!! - GtkSharp Team
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Atk;
using Gdk;
using Gtk;
using WebKit;
namespace Samples
{
[Section(ContentType = typeof(WebView), Category = Category.Widgets)]
class WebviewSection : ListSection
{
public WebviewSection()
{
AddItem(ShowHtml());
AddItem(ShowUri());
}
public (string, Widget) ShowHtml()
{
var webView = new WebView {
HeightRequest = 100,
Hexpand = true
};
webView.LoadHtml($"This is a <b>{nameof(WebView)}</b> showing html text");
return ($"{nameof(WebView)} show html text:", webView);
}
public (string, Widget) ShowUri()
{
var webView = new WebView {
Vexpand = true,
Hexpand = true,
};
webView.LoadUri("https://github.com/GtkSharp/GtkSharp#readme");
return ($"{nameof(WebView)} show uri:", webView);
}
}
}