Skip to content

Commit

Permalink
Fix up the WPF browser implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jan 17, 2012
1 parent ba21b86 commit d0938ea
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CefSharp.WpfExample/CefSharp.WpfExample.csproj
Expand Up @@ -10,14 +10,15 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CefSharp.WpfExample</RootNamespace>
<AssemblyName>CefSharp.WpfExample</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -42,6 +43,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand Down Expand Up @@ -94,6 +96,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
12 changes: 12 additions & 0 deletions CefSharp.sln
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.Tests", "CefSharp.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.Example", "CefSharp.Example\CefSharp.Example.csproj", "{C043FFF7-5F71-4FFC-989A-E09E18548589}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.WpfExample", "CefSharp.WpfExample\CefSharp.WpfExample.csproj", "{4828DAEC-EF99-4553-B674-4374F77C6D66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -59,6 +61,16 @@ Global
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C043FFF7-5F71-4FFC-989A-E09E18548589}.Release|Win32.ActiveCfg = Release|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Debug|Win32.ActiveCfg = Debug|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Any CPU.Build.0 = Release|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4828DAEC-EF99-4553-B674-4374F77C6D66}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion CefSharp/CefFormsWebBrowser.cpp
Expand Up @@ -130,7 +130,6 @@ namespace CefSharp
GetClientRect(hWnd, &rect);
windowInfo.SetAsChild(hWnd, rect);


CefBrowser::CreateBrowser(windowInfo, static_cast<CefRefPtr<CefClient>>(ptr), urlStr, *_settings->_browserSettings);
}
}
Expand Down
4 changes: 4 additions & 0 deletions CefSharp/CefSharp.vcxproj
Expand Up @@ -131,6 +131,7 @@
<ClCompile Include="BindingHandler.cpp" />
<ClCompile Include="CefFormsWebBrowser.cpp" />
<ClCompile Include="CefSharp.cpp" />
<ClCompile Include="CefWpfWebBrowser.cpp" />
<ClCompile Include="ClientAdapter.cpp" />
<ClCompile Include="JsTask.cpp" />
<ClCompile Include="Request.cpp" />
Expand All @@ -144,12 +145,14 @@
</ClCompile>
<ClCompile Include="StreamAdapter.cpp" />
<ClCompile Include="Utils.cpp" />
<ClCompile Include="WpfClientAdapter.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BindingHandler.h" />
<ClInclude Include="BrowserSettings.h" />
<ClInclude Include="CefFormsWebBrowser.h" />
<ClInclude Include="CefSharp.h" />
<ClInclude Include="CefWpfWebBrowser.h" />
<ClInclude Include="ClientAdapter.h" />
<ClInclude Include="IAfterResponse.h" />
<ClInclude Include="IBeforeMenu.h" />
Expand All @@ -168,6 +171,7 @@
<ClInclude Include="Stdafx.h" />
<ClInclude Include="StreamAdapter.h" />
<ClInclude Include="Utils.h" />
<ClInclude Include="WpfClientAdapter.h" />
</ItemGroup>
<ItemGroup>
<None Include="app.ico" />
Expand Down
7 changes: 5 additions & 2 deletions CefSharp/WpfClientAdapter.cpp
Expand Up @@ -19,12 +19,15 @@ namespace CefSharp
return false;
}

void WpfClientAdapter::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const CefRect& dirtyRect, const void* buffer)
void WpfClientAdapter::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const void* buffer)
{
int width, height;
browser->GetSize(type, width, height);
CefRect dummy;

_wpfBrowserControl->SetBuffer(width, height, dirtyRect, buffer);
// NB: We don't actually use dirtyRect, we rerender the entire buffer
// in the SetBuffer call regardless
_wpfBrowserControl->SetBuffer(width, height, dummy, buffer);
}

void WpfClientAdapter::OnCursorChange(CefRefPtr<CefBrowser> browser, CefCursorHandle cursor)
Expand Down
2 changes: 1 addition & 1 deletion CefSharp/WpfClientAdapter.h
Expand Up @@ -31,7 +31,7 @@ namespace CefSharp
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser, int viewX, int viewY, int& screenX, int& screenY) OVERRIDE;
//virtual void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) OVERRIDE;
//virtual void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) OVERRIDE;
virtual void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const CefRect& dirtyRect, const void* buffer) OVERRIDE;
virtual void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const void* buffer) OVERRIDE;
virtual void OnCursorChange(CefRefPtr<CefBrowser> browser, CefCursorHandle cursor) OVERRIDE;

IMPLEMENT_LOCKING(WpfClientAdapter);
Expand Down

0 comments on commit d0938ea

Please sign in to comment.