Browse Source
# Conflicts: # samples/RenderDemo/Pages/AnimationsPage.xaml # samples/RenderDemo/ViewModels/AnimationsPageViewModel.csxdatagrid-experiment
2302 changed files with 132588 additions and 26297 deletions
@ -0,0 +1,31 @@ |
|||
--- |
|||
name: Bug report |
|||
about: Create a report to help us improve |
|||
title: '' |
|||
labels: '' |
|||
assignees: '' |
|||
|
|||
--- |
|||
|
|||
**Describe the bug** |
|||
A clear and concise description of what the bug is. |
|||
|
|||
**To Reproduce** |
|||
Steps to reproduce the behavior: |
|||
1. Go to '...' |
|||
2. Click on '....' |
|||
3. Scroll down to '....' |
|||
4. See error |
|||
|
|||
**Expected behavior** |
|||
A clear and concise description of what you expected to happen. |
|||
|
|||
**Screenshots** |
|||
If applicable, add screenshots to help explain your problem. |
|||
|
|||
**Desktop (please complete the following information):** |
|||
- OS: [e.g. Windows, Mac, Linux (State distribution)] |
|||
- Version [e.g. 0.10.0-rc1 or 0.9.12] |
|||
|
|||
**Additional context** |
|||
Add any other context about the problem here. |
|||
@ -0,0 +1,20 @@ |
|||
--- |
|||
name: Feature request |
|||
about: Suggest an idea for this project |
|||
title: '' |
|||
labels: '' |
|||
assignees: '' |
|||
|
|||
--- |
|||
|
|||
**Is your feature request related to a problem? Please describe.** |
|||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] |
|||
|
|||
**Describe the solution you'd like** |
|||
A clear and concise description of what you want to happen. |
|||
|
|||
**Describe alternatives you've considered** |
|||
A clear and concise description of any alternative solutions or features you've considered. |
|||
|
|||
**Additional context** |
|||
Add any other context or screenshots about the feature request here. |
|||
@ -1,5 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -1,76 +1,130 @@ |
|||
|
|||
# Contributor Covenant Code of Conduct |
|||
|
|||
## Our Pledge |
|||
|
|||
In the interest of fostering an open and welcoming environment, we as |
|||
contributors and maintainers pledge to making participation in our project and |
|||
our community a harassment-free experience for everyone, regardless of age, body |
|||
size, disability, ethnicity, sex characteristics, gender identity and expression, |
|||
level of experience, education, socio-economic status, nationality, personal |
|||
appearance, race, religion, or sexual identity and orientation. |
|||
We as members, contributors, and leaders pledge to make participation in our |
|||
community a harassment-free experience for everyone, regardless of age, body |
|||
size, visible or invisible disability, ethnicity, sex characteristics, gender |
|||
identity and expression, level of experience, education, socio-economic status, |
|||
nationality, personal appearance, race, religion, or sexual identity |
|||
and orientation. |
|||
|
|||
We pledge to act and interact in ways that contribute to an open, welcoming, |
|||
diverse, inclusive, and healthy community. |
|||
|
|||
## Our Standards |
|||
|
|||
Examples of behavior that contributes to creating a positive environment |
|||
include: |
|||
Examples of behavior that contributes to a positive environment for our |
|||
community include: |
|||
|
|||
* Using welcoming and inclusive language |
|||
* Being respectful of differing viewpoints and experiences |
|||
* Gracefully accepting constructive criticism |
|||
* Focusing on what is best for the community |
|||
* Showing empathy towards other community members |
|||
* Demonstrating empathy and kindness toward other people |
|||
* Being respectful of differing opinions, viewpoints, and experiences |
|||
* Giving and gracefully accepting constructive feedback |
|||
* Accepting responsibility and apologizing to those affected by our mistakes, |
|||
and learning from the experience |
|||
* Focusing on what is best not just for us as individuals, but for the |
|||
overall community |
|||
|
|||
Examples of unacceptable behavior by participants include: |
|||
Examples of unacceptable behavior include: |
|||
|
|||
* The use of sexualized language or imagery and unwelcome sexual attention or |
|||
advances |
|||
* Trolling, insulting/derogatory comments, and personal or political attacks |
|||
* The use of sexualized language or imagery, and sexual attention or |
|||
advances of any kind |
|||
* Trolling, insulting or derogatory comments, and personal or political attacks |
|||
* Public or private harassment |
|||
* Publishing others' private information, such as a physical or electronic |
|||
address, without explicit permission |
|||
* Publishing others' private information, such as a physical or email |
|||
address, without their explicit permission |
|||
* Other conduct which could reasonably be considered inappropriate in a |
|||
professional setting |
|||
professional setting |
|||
|
|||
## Our Responsibilities |
|||
## Enforcement Responsibilities |
|||
|
|||
Project maintainers are responsible for clarifying the standards of acceptable |
|||
behavior and are expected to take appropriate and fair corrective action in |
|||
response to any instances of unacceptable behavior. |
|||
Community leaders are responsible for clarifying and enforcing our standards of |
|||
acceptable behavior and will take appropriate and fair corrective action in |
|||
response to any behavior that they deem inappropriate, threatening, offensive, |
|||
or harmful. |
|||
|
|||
Project maintainers have the right and responsibility to remove, edit, or |
|||
reject comments, commits, code, wiki edits, issues, and other contributions |
|||
that are not aligned to this Code of Conduct, or to ban temporarily or |
|||
permanently any contributor for other behaviors that they deem inappropriate, |
|||
threatening, offensive, or harmful. |
|||
Community leaders have the right and responsibility to remove, edit, or reject |
|||
comments, commits, code, wiki edits, issues, and other contributions that are |
|||
not aligned to this Code of Conduct, and will communicate reasons for moderation |
|||
decisions when appropriate. |
|||
|
|||
## Scope |
|||
|
|||
This Code of Conduct applies both within project spaces and in public spaces |
|||
when an individual is representing the project or its community. Examples of |
|||
representing a project or community include using an official project e-mail |
|||
address, posting via an official social media account, or acting as an appointed |
|||
representative at an online or offline event. Representation of a project may be |
|||
further defined and clarified by project maintainers. |
|||
This Code of Conduct applies within all community spaces, and also applies when |
|||
an individual is officially representing the community in public spaces. |
|||
Examples of representing our community include using an official e-mail address, |
|||
posting via an official social media account, or acting as an appointed |
|||
representative at an online or offline event. |
|||
|
|||
## Enforcement |
|||
|
|||
Instances of abusive, harassing, or otherwise unacceptable behavior may be |
|||
reported by contacting the project team at steven@avaloniaui.net. All |
|||
complaints will be reviewed and investigated and will result in a response that |
|||
is deemed necessary and appropriate to the circumstances. The project team is |
|||
obligated to maintain confidentiality with regard to the reporter of an incident. |
|||
Further details of specific enforcement policies may be posted separately. |
|||
reported to the community leaders responsible for enforcement at |
|||
steven@avaloniaui.net. |
|||
All complaints will be reviewed and investigated promptly and fairly. |
|||
|
|||
All community leaders are obligated to respect the privacy and security of the |
|||
reporter of any incident. |
|||
|
|||
## Enforcement Guidelines |
|||
|
|||
Community leaders will follow these Community Impact Guidelines in determining |
|||
the consequences for any action they deem in violation of this Code of Conduct: |
|||
|
|||
### 1. Correction |
|||
|
|||
**Community Impact**: Use of inappropriate language or other behavior deemed |
|||
unprofessional or unwelcome in the community. |
|||
|
|||
**Consequence**: A private, written warning from community leaders, providing |
|||
clarity around the nature of the violation and an explanation of why the |
|||
behavior was inappropriate. A public apology may be requested. |
|||
|
|||
### 2. Warning |
|||
|
|||
Project maintainers who do not follow or enforce the Code of Conduct in good |
|||
faith may face temporary or permanent repercussions as determined by other |
|||
members of the project's leadership. |
|||
**Community Impact**: A violation through a single incident or series |
|||
of actions. |
|||
|
|||
**Consequence**: A warning with consequences for continued behavior. No |
|||
interaction with the people involved, including unsolicited interaction with |
|||
those enforcing the Code of Conduct, for a specified period of time. This |
|||
includes avoiding interactions in community spaces as well as external channels |
|||
like social media. Violating these terms may lead to a temporary or |
|||
permanent ban. |
|||
|
|||
### 3. Temporary Ban |
|||
|
|||
**Community Impact**: A serious violation of community standards, including |
|||
sustained inappropriate behavior. |
|||
|
|||
**Consequence**: A temporary ban from any sort of interaction or public |
|||
communication with the community for a specified period of time. No public or |
|||
private interaction with the people involved, including unsolicited interaction |
|||
with those enforcing the Code of Conduct, is allowed during this period. |
|||
Violating these terms may lead to a permanent ban. |
|||
|
|||
### 4. Permanent Ban |
|||
|
|||
**Community Impact**: Demonstrating a pattern of violation of community |
|||
standards, including sustained inappropriate behavior, harassment of an |
|||
individual, or aggression toward or disparagement of classes of individuals. |
|||
|
|||
**Consequence**: A permanent ban from any sort of public interaction within |
|||
the community. |
|||
|
|||
## Attribution |
|||
|
|||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, |
|||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html |
|||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], |
|||
version 2.0, available at |
|||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. |
|||
|
|||
Community Impact Guidelines were inspired by [Mozilla's code of conduct |
|||
enforcement ladder](https://github.com/mozilla/diversity). |
|||
|
|||
[homepage]: https://www.contributor-covenant.org |
|||
|
|||
For answers to common questions about this code of conduct, see |
|||
https://www.contributor-covenant.org/faq |
|||
For answers to common questions about this code of conduct, see the FAQ at |
|||
https://www.contributor-covenant.org/faq. Translations are available at |
|||
https://www.contributor-covenant.org/translations. |
|||
|
|||
|
|||
@ -0,0 +1,69 @@ |
|||
# Contributing to Avalonia |
|||
|
|||
## Before You Start |
|||
|
|||
Drop into our [gitter chat room](https://gitter.im/AvaloniaUI/Avalonia) and let us know what you're thinking of doing. We might be able to give you guidance or let you know if someone else is already working on the feature. |
|||
|
|||
## Style |
|||
|
|||
The codebase uses [.net core](https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md) coding style. |
|||
|
|||
Try to keep lines of code around 100 characters in length or less, though this is not a hard limit. |
|||
If you're a few characters over then don't worry too much. |
|||
|
|||
**DO NOT USE #REGIONS** full stop. |
|||
|
|||
## Pull requests |
|||
|
|||
A single pull request should be submitted for each change. If you're making more than one change, |
|||
please submit separate pull requests for each change for easy review. Rebase your changes to make |
|||
sense, so a history that looks like: |
|||
|
|||
* Add class A |
|||
* Feature A didn't set Foo when Bar was set |
|||
* Fix spacing |
|||
* Add class B |
|||
* Sort using statements |
|||
|
|||
Should be rebased to read: |
|||
|
|||
* Add class A |
|||
* Add class B |
|||
|
|||
Again, this makes review much easier. |
|||
|
|||
Please try not to submit pull requests that don't add new features (e.g. moving stuff around) |
|||
unless you see something that is obviously wrong or that could be written in a more terse or |
|||
idiomatic style. It takes time to review each pull request - time that I'd prefer to spend writing |
|||
new features! |
|||
|
|||
Prefer terseness to verbosity but don't try to be too clever. |
|||
|
|||
## Tests |
|||
|
|||
There are two types of tests currently in the codebase; unit tests and render tests. |
|||
|
|||
Unit tests should be contained in a class name that mirrors the class being tested with the suffix |
|||
-Tests, e.g. |
|||
|
|||
Avalonia.Controls.UnitTests.Presenters.TextPresenterTests |
|||
|
|||
Where Avalonia.Controls.UnitTests is the name of the project. |
|||
|
|||
Unit test methods should be named in a sentence style, separated by underscores, that describes in |
|||
English what the test is testing, e.g. |
|||
|
|||
```csharp |
|||
void Calling_Foo_Should_Increment_Bar() |
|||
``` |
|||
|
|||
Render tests should describe what the produced image is: |
|||
|
|||
```csharp |
|||
void Rectangle_2px_Stroke_Filled() |
|||
``` |
|||
|
|||
## Code of Conduct |
|||
|
|||
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. |
|||
For more information see the [Contributor Covenant Code of Conduct](https://dotnetfoundation.org/code-of-conduct) |
|||
@ -1,5 +1,8 @@ |
|||
<Project> |
|||
<PropertyGroup> |
|||
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(MSBuildThisFileDirectory)build-intermediate/nuget</PackageOutputPath> |
|||
<AvaloniaPreviewerNetCoreToolPath>$(MSBuildThisFileDirectory)\src\tools\Avalonia.Designer.HostApp\bin\$(Configuration)\netcoreapp2.0\Avalonia.Designer.HostApp.dll</AvaloniaPreviewerNetCoreToolPath> |
|||
<!-- https://github.com/dotnet/msbuild/issues/2661 --> |
|||
<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies> |
|||
</PropertyGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,75 @@ |
|||
# Windows |
|||
|
|||
Avalonia requires at least Visual Studio 2019 and .NET Core SDK 3.1 to build on Windows. |
|||
|
|||
### Clone the Avalonia repository |
|||
|
|||
``` |
|||
git clone https://github.com/AvaloniaUI/Avalonia.git |
|||
git submodule update --init |
|||
``` |
|||
|
|||
### Open in Visual Studio |
|||
|
|||
Open the `Avalonia.sln` solution in Visual Studio 2019 or newer. The free Visual Studio Community |
|||
edition works fine. Run the `Samples\ControlCatalog.Desktop` project to see the sample application. |
|||
|
|||
# Linux/macOS |
|||
|
|||
It's *not* possible to build the *whole* project on Linux/macOS. You can only build the subset targeting .NET Standard and .NET Core (which is, however, sufficient to get UI working on Linux/macOS). If you want to something that involves changing platform-specific APIs you'll need a Windows machine. |
|||
|
|||
MonoDevelop, Xamarin Studio and Visual Studio for Mac aren't capable of properly opening our solution. You can use Rider (at least 2017.2 EAP) or VSCode instead. They will fail to load most of platform specific projects, but you don't need them to run on .NET Core. |
|||
|
|||
### Install the latest version of .NET Core |
|||
|
|||
Go to https://www.microsoft.com/net/core and follow instructions for your OS. You need SDK (not just "runtime") package. |
|||
|
|||
### Additional requirements for macOS |
|||
|
|||
The build process needs [Xcode](https://developer.apple.com/xcode/) to build the native library. Following the install instructions at the [Xcode](https://developer.apple.com/xcode/) website to properly install. |
|||
|
|||
Linux operating systems ship with their own respective package managers however we will use [Homebrew](https://brew.sh/) to manage packages on macOS. To install follow the instructions [here](https://docs.brew.sh/Installation). |
|||
|
|||
### Install CastXML (pre Nov 2020) |
|||
|
|||
Avalonia requires [CastXML](https://github.com/CastXML/CastXML) for XML processing during the build process. The easiest way to install this is via the operating system's package managers, such as below. |
|||
|
|||
On macOS: |
|||
``` |
|||
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8a004a91a7fcd3f6620d5b01b6541ff0a640ffba/Formula/castxml.rb |
|||
``` |
|||
|
|||
On Debian based Linux (Debian, Ubuntu, Mint, etc): |
|||
``` |
|||
sudo apt install castxml |
|||
``` |
|||
|
|||
On Red Hat based Linux (Fedora, CentOS, RHEL, etc) using `yum` (`dnf` takes same arguments though): |
|||
``` |
|||
sudo yum install castxml |
|||
``` |
|||
|
|||
|
|||
### Clone the Avalonia repository |
|||
|
|||
``` |
|||
git clone https://github.com/AvaloniaUI/Avalonia.git |
|||
cd Avalonia |
|||
git submodule update --init --recursive |
|||
``` |
|||
|
|||
### Build native libraries (macOS only) |
|||
|
|||
On macOS it is necessary to build and manually install the respective native libraries using [Xcode](https://developer.apple.com/xcode/). Execute the build script in the root project with the `CompileNative` task. It will build the headers, build the libraries, and place them in the appropriate place to allow .NET to find them at compilation and run time. |
|||
|
|||
```bash |
|||
./build.sh CompileNative |
|||
``` |
|||
|
|||
### Build and Run Avalonia |
|||
|
|||
``` |
|||
cd samples/ControlCatalog.NetCore |
|||
dotnet restore |
|||
dotnet run |
|||
``` |
|||
@ -0,0 +1,305 @@ |
|||
# WPF |
|||
|
|||
https://github.com/dotnet/wpf |
|||
|
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) .NET Foundation and Contributors |
|||
|
|||
All rights reserved. |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE. |
|||
|
|||
# SharpDX |
|||
|
|||
https://github.com/sharpdx/SharpDX |
|||
|
|||
Copyright (c) 2010-2014 SharpDX - Alexandre Mutel |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in |
|||
all copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|||
THE SOFTWARE. |
|||
|
|||
# Silverlight Toolkit |
|||
|
|||
https://github.com/microsoftarchive/SilverlightToolkit |
|||
|
|||
Microsoft Public License (MS-PL) |
|||
|
|||
This license governs use of the accompanying software. If you use the software, you |
|||
accept this license. If you do not accept the license, do not use the software. |
|||
|
|||
1. Definitions |
|||
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the |
|||
same meaning here as under U.S. copyright law. |
|||
A "contribution" is the original software, or any additions or changes to the software. |
|||
A "contributor" is any person that distributes its contribution under this license. |
|||
"Licensed patents" are a contributor's patent claims that read directly on its contribution. |
|||
|
|||
2. Grant of Rights |
|||
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. |
|||
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. |
|||
|
|||
3. Conditions and Limitations |
|||
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. |
|||
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. |
|||
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. |
|||
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. |
|||
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. |
|||
|
|||
# wayland-protocols |
|||
|
|||
https://github.com/wayland-project/wayland-protocols |
|||
|
|||
Copyright © 2008-2013 Kristian Høgsberg |
|||
Copyright © 2010-2013 Intel Corporation |
|||
Copyright © 2013 Rafael Antognolli |
|||
Copyright © 2013 Jasper St. Pierre |
|||
Copyright © 2014 Jonas Ådahl |
|||
Copyright © 2014 Jason Ekstrand |
|||
Copyright © 2014-2015 Collabora, Ltd. |
|||
Copyright © 2015 Red Hat Inc. |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a |
|||
copy of this software and associated documentation files (the "Software"), |
|||
to deal in the Software without restriction, including without limitation |
|||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|||
and/or sell copies of the Software, and to permit persons to whom the |
|||
Software is furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice (including the next |
|||
paragraph) shall be included in all copies or substantial portions of the |
|||
Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|||
DEALINGS IN THE SOFTWARE. |
|||
|
|||
# Metsys.Bson |
|||
|
|||
Copyright (c) 2010, Karl Seguin - http://www.openmymind.net/ |
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are met: |
|||
* Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
* Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
* Neither the name of the <organization> nor the |
|||
names of its contributors may be used to endorse or promote products |
|||
derived from this software without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY |
|||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
# RichTextKit |
|||
|
|||
https://github.com/toptensoftware/RichTextKit |
|||
|
|||
Copyright © 2019 Topten Software. All Rights Reserved. |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); you may |
|||
not use this product except in compliance with the License. You may obtain |
|||
a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|||
License for the specific language governing permissions and limitations |
|||
under the License. |
|||
|
|||
# Mono |
|||
|
|||
https://github.com/mono/mono |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining |
|||
a copy of this software and associated documentation files (the |
|||
"Software"), to deal in the Software without restriction, including |
|||
without limitation the rights to use, copy, modify, merge, publish, |
|||
distribute, sublicense, and/or sell copies of the Software, and to |
|||
permit persons to whom the Software is furnished to do so, subject to |
|||
the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be |
|||
included in all copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
|
|||
# Collections.Pooled |
|||
|
|||
https://github.com/jtmueller/Collections.Pooled |
|||
|
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Joel Mueller |
|||
|
|||
All rights reserved. |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE. |
|||
|
|||
# EllipticalArc.java |
|||
|
|||
http://www.spaceroots.org/documents/ellipse/EllipticalArc.java |
|||
http://www.spaceroots.org/documents/ellipse/elliptical-arc.pdf |
|||
|
|||
Copyright (c) 2003-2004, Luc Maisonobe |
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with |
|||
or without modification, are permitted provided that |
|||
the following conditions are met: |
|||
|
|||
Redistributions of source code must retain the |
|||
above copyright notice, this list of conditions and |
|||
the following disclaimer. |
|||
Redistributions in binary form must reproduce the |
|||
above copyright notice, this list of conditions and |
|||
the following disclaimer in the documentation |
|||
and/or other materials provided with the |
|||
distribution. |
|||
Neither the names of spaceroots.org, spaceroots.com |
|||
nor the names of their contributors may be used to |
|||
endorse or promote products derived from this |
|||
software without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
|||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |
|||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
|||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
|||
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY |
|||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
|||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
|||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|||
POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
# WinUI |
|||
|
|||
https://github.com/microsoft/microsoft-ui-xaml |
|||
|
|||
MIT License |
|||
|
|||
Copyright (c) Microsoft Corporation. All rights reserved. |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE |
|||
|
|||
# Chromium |
|||
|
|||
https://github.com/chromium/chromium |
|||
|
|||
// Copyright 2015 The Chromium Authors. All rights reserved. |
|||
// |
|||
// Redistribution and use in source and binary forms, with or without |
|||
// modification, are permitted provided that the following conditions are |
|||
// met: |
|||
// |
|||
// * Redistributions of source code must retain the above copyright |
|||
// notice, this list of conditions and the following disclaimer. |
|||
// * Redistributions in binary form must reproduce the above |
|||
// copyright notice, this list of conditions and the following disclaimer |
|||
// in the documentation and/or other materials provided with the |
|||
// distribution. |
|||
// * Neither the name of Google Inc. nor the names of its |
|||
// contributors may be used to endorse or promote products derived from |
|||
// this software without specific prior written permission. |
|||
// |
|||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
@ -1,7 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<configuration> |
|||
<packageSources> |
|||
<clear /> |
|||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" /> |
|||
<add key="dotnet-eng" value="https://nuget.avaloniaui.net/repository/avalonia-devdeps/index.json" protocolVersion="3" /> |
|||
</packageSources> |
|||
</configuration> |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<ApiContractPackageVersion>0.10.0-rc1</ApiContractPackageVersion> |
|||
<NugetPackageName Condition="'$(PackageId)' != ''">$(PackageId)</NugetPackageName> |
|||
<NugetPackageName Condition="'$(PackageId)' == ''">Avalonia</NugetPackageName> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<PackageDownload Include="$(NugetPackageName)" Version="[$(ApiContractPackageVersion)]" /> |
|||
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.20372.2" PrivateAssets="All" /> |
|||
<ResolvedMatchingContract Include="$(NuGetPackageRoot)\$(NugetPackageName.ToLowerInvariant())\$(ApiContractPackageVersion)\lib\$(TargetFramework)\$(AssemblyName).dll" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
After Width: | Height: | Size: 14 KiB |
@ -1,6 +1,6 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.6.1-rc.153" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.6.1-rc.153" /> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.6.1.6" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.6.1.6" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,33 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
|
|||
<!-- Ensure that code generator is actually built --> |
|||
<ItemGroup> |
|||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\src\tools\MicroComGenerator\MicroComGenerator.csproj"> |
|||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
|||
<ExcludeAssets>all</ExcludeAssets> |
|||
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
|
|||
<Target Name="GenerateAvaloniaNativeComInterop" |
|||
BeforeTargets="CoreCompile" |
|||
DependsOnTargets="ResolveReferences" |
|||
Inputs="@(AvnComIdl);$(MSBuildThisFileDirectory)../src/tools/MicroComGenerator/**/*.cs" |
|||
Outputs="%(AvnComIdl.OutputFile)"> |
|||
<Message Importance="high" Text="Generating file %(AvnComIdl.OutputFile) from @(AvnComIdl)" /> |
|||
<Exec Command="dotnet $(MSBuildThisFileDirectory)../src/tools/MicroComGenerator/bin/$(Configuration)/netcoreapp3.1/MicroComGenerator.dll -i @(AvnComIdl) --cs %(AvnComIdl.OutputFile)" LogStandardErrorAsError="true" /> |
|||
<ItemGroup> |
|||
<!-- Remove and re-add generated file, this is needed for the clean build --> |
|||
<Compile Remove="%(AvnComIdl.OutputFile)"/> |
|||
<Compile Include="%(AvnComIdl.OutputFile)"/> |
|||
</ItemGroup> |
|||
</Target> |
|||
<ItemGroup> |
|||
<UpToDateCheckInput Include="@(AvnComIdl)"/> |
|||
<UpToDateCheckInput Include="$(MSBuildThisFileDirectory)/../src/tools/MicroComGenerator/**/*.cs"/> |
|||
</ItemGroup> |
|||
<PropertyGroup> |
|||
<_AvaloniaPatchComInterop>true</_AvaloniaPatchComInterop> |
|||
</PropertyGroup> |
|||
<Import Project="$(MSBuildThisFileDirectory)/BuildTargets.targets" /> |
|||
</Project> |
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="Moq" Version="4.7.99" /> |
|||
<PackageReference Include="Moq" Version="4.14.1" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,7 +1,7 @@ |
|||
<Project> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" /> |
|||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="ReactiveUI" Version="10.3.6" /> |
|||
<PackageReference Include="ReactiveUI" Version="12.1.1" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="System.Reactive" Version="4.1.6" /> |
|||
<PackageReference Include="System.Reactive" Version="5.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,7 +0,0 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="Serilog" Version="2.5.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -1,6 +1,6 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="SkiaSharp" Version="1.68.1-rc.153" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="1.68.1-rc.153" /> |
|||
<PackageReference Include="SkiaSharp" Version="2.80.2" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,5 +1,5 @@ |
|||
<Project> |
|||
<ItemGroup> |
|||
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.0" PrivateAssets="All" /> |
|||
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
</Project> |
|||
|
|||
Binary file not shown.
@ -1,5 +0,0 @@ |
|||
<Project> |
|||
<PropertyGroup Condition="'$(iOSRoslynPathHackRequired)' == 'true'"> |
|||
<CscToolPath>$(MSBuildToolsPath)\..\Roslyn</CscToolPath> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -1,7 +1,10 @@ |
|||
{ |
|||
"sdk": { |
|||
"version": "3.1.401" |
|||
}, |
|||
"msbuild-sdks": { |
|||
"Microsoft.Build.Traversal": "1.0.43", |
|||
"MSBuild.Sdk.Extras": "2.0.46", |
|||
"MSBuild.Sdk.Extras": "2.0.54", |
|||
"AggregatePackage.NuGet.Sdk" : "0.1.12" |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1 @@ |
|||
avalonia-native.h |
|||
@ -1,5 +1,2 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
#define COM_GUIDS_MATERIALIZE |
|||
#include "avalonia-native.h" |
|||
|
|||
@ -1,401 +0,0 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
#include "com.h" |
|||
#include "key.h" |
|||
|
|||
#define AVNCOM(name, id) COMINTERFACE(name, 2e2cda0a, 9ae5, 4f1b, 8e, 20, 08, 1a, 04, 27, 9f, id) |
|||
|
|||
struct IAvnWindowEvents; |
|||
struct IAvnWindow; |
|||
struct IAvnPopup; |
|||
struct IAvnMacOptions; |
|||
struct IAvnPlatformThreadingInterface; |
|||
struct IAvnSystemDialogEvents; |
|||
struct IAvnSystemDialogs; |
|||
struct IAvnScreens; |
|||
struct IAvnClipboard; |
|||
struct IAvnCursor; |
|||
struct IAvnCursorFactory; |
|||
struct IAvnGlFeature; |
|||
struct IAvnGlContext; |
|||
struct IAvnGlDisplay; |
|||
struct IAvnGlSurfaceRenderTarget; |
|||
struct IAvnGlSurfaceRenderingSession; |
|||
struct IAvnAppMenu; |
|||
struct IAvnAppMenuItem; |
|||
|
|||
struct AvnSize |
|||
{ |
|||
double Width, Height; |
|||
}; |
|||
|
|||
struct AvnPixelSize |
|||
{ |
|||
int Width, Height; |
|||
}; |
|||
|
|||
struct AvnRect |
|||
{ |
|||
double X, Y, Width, Height; |
|||
}; |
|||
|
|||
struct AvnVector |
|||
{ |
|||
double X, Y; |
|||
}; |
|||
|
|||
struct AvnPoint |
|||
{ |
|||
double X, Y; |
|||
}; |
|||
|
|||
struct AvnScreen |
|||
{ |
|||
AvnRect Bounds; |
|||
AvnRect WorkingArea; |
|||
float PixelDensity; |
|||
bool Primary; |
|||
}; |
|||
|
|||
enum AvnPixelFormat |
|||
{ |
|||
kAvnRgb565, |
|||
kAvnRgba8888, |
|||
kAvnBgra8888 |
|||
}; |
|||
|
|||
struct AvnFramebuffer |
|||
{ |
|||
void* Data; |
|||
int Width; |
|||
int Height; |
|||
int Stride; |
|||
AvnVector Dpi; |
|||
AvnPixelFormat PixelFormat; |
|||
}; |
|||
|
|||
struct AvnColor |
|||
{ |
|||
unsigned char Alpha; |
|||
unsigned char Red; |
|||
unsigned char Green; |
|||
unsigned char Blue; |
|||
}; |
|||
|
|||
enum AvnRawMouseEventType |
|||
{ |
|||
LeaveWindow, |
|||
LeftButtonDown, |
|||
LeftButtonUp, |
|||
RightButtonDown, |
|||
RightButtonUp, |
|||
MiddleButtonDown, |
|||
MiddleButtonUp, |
|||
Move, |
|||
Wheel, |
|||
NonClientLeftButtonDown |
|||
}; |
|||
|
|||
enum AvnRawKeyEventType |
|||
{ |
|||
KeyDown, |
|||
KeyUp |
|||
}; |
|||
|
|||
enum AvnInputModifiers |
|||
{ |
|||
AvnInputModifiersNone = 0, |
|||
Alt = 1, |
|||
Control = 2, |
|||
Shift = 4, |
|||
Windows = 8, |
|||
LeftMouseButton = 16, |
|||
RightMouseButton = 32, |
|||
MiddleMouseButton = 64 |
|||
}; |
|||
|
|||
enum AvnWindowState |
|||
{ |
|||
Normal, |
|||
Minimized, |
|||
Maximized, |
|||
}; |
|||
|
|||
enum AvnStandardCursorType |
|||
{ |
|||
CursorArrow, |
|||
CursorIbeam, |
|||
CursorWait, |
|||
CursorCross, |
|||
CursorUpArrow, |
|||
CursorSizeWestEast, |
|||
CursorSizeNorthSouth, |
|||
CursorSizeAll, |
|||
CursorNo, |
|||
CursorHand, |
|||
CursorAppStarting, |
|||
CursorHelp, |
|||
CursorTopSide, |
|||
CursorBottomSize, |
|||
CursorLeftSide, |
|||
CursorRightSide, |
|||
CursorTopLeftCorner, |
|||
CursorTopRightCorner, |
|||
CursorBottomLeftCorner, |
|||
CursorBottomRightCorner, |
|||
CursorDragMove, |
|||
CursorDragCopy, |
|||
CursorDragLink, |
|||
CursorNone |
|||
}; |
|||
|
|||
enum AvnWindowEdge |
|||
{ |
|||
WindowEdgeNorthWest, |
|||
WindowEdgeNorth, |
|||
WindowEdgeNorthEast, |
|||
WindowEdgeWest, |
|||
WindowEdgeEast, |
|||
WindowEdgeSouthWest, |
|||
WindowEdgeSouth, |
|||
WindowEdgeSouthEast |
|||
}; |
|||
|
|||
AVNCOM(IAvaloniaNativeFactory, 01) : IUnknown |
|||
{ |
|||
public: |
|||
virtual HRESULT Initialize() = 0; |
|||
virtual IAvnMacOptions* GetMacOptions() = 0; |
|||
virtual HRESULT CreateWindow(IAvnWindowEvents* cb, IAvnWindow** ppv) = 0; |
|||
virtual HRESULT CreatePopup (IAvnWindowEvents* cb, IAvnPopup** ppv) = 0; |
|||
virtual HRESULT CreatePlatformThreadingInterface(IAvnPlatformThreadingInterface** ppv) = 0; |
|||
virtual HRESULT CreateSystemDialogs (IAvnSystemDialogs** ppv) = 0; |
|||
virtual HRESULT CreateScreens (IAvnScreens** ppv) = 0; |
|||
virtual HRESULT CreateClipboard(IAvnClipboard** ppv) = 0; |
|||
virtual HRESULT CreateCursorFactory(IAvnCursorFactory** ppv) = 0; |
|||
virtual HRESULT ObtainGlFeature(IAvnGlFeature** ppv) = 0; |
|||
virtual HRESULT ObtainAppMenu(IAvnAppMenu** retOut) = 0; |
|||
virtual HRESULT SetAppMenu(IAvnAppMenu* menu) = 0; |
|||
virtual HRESULT CreateMenu (IAvnAppMenu** ppv) = 0; |
|||
virtual HRESULT CreateMenuItem (IAvnAppMenuItem** ppv) = 0; |
|||
virtual HRESULT CreateMenuItemSeperator (IAvnAppMenuItem** ppv) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnString, 17) : IUnknown |
|||
{ |
|||
virtual HRESULT Pointer(void**retOut) = 0; |
|||
virtual HRESULT Length(int*ret) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnWindowBase, 02) : IUnknown |
|||
{ |
|||
virtual HRESULT Show() = 0; |
|||
virtual HRESULT Hide () = 0; |
|||
virtual HRESULT Close() = 0; |
|||
virtual HRESULT Activate () = 0; |
|||
virtual HRESULT GetClientSize(AvnSize*ret) = 0; |
|||
virtual HRESULT GetScaling(double*ret)=0; |
|||
virtual HRESULT SetMinMaxSize(AvnSize minSize, AvnSize maxSize) = 0; |
|||
virtual HRESULT Resize(double width, double height) = 0; |
|||
virtual HRESULT Invalidate (AvnRect rect) = 0; |
|||
virtual HRESULT BeginMoveDrag () = 0; |
|||
virtual HRESULT BeginResizeDrag (AvnWindowEdge edge) = 0; |
|||
virtual HRESULT GetPosition (AvnPoint*ret) = 0; |
|||
virtual HRESULT SetPosition (AvnPoint point) = 0; |
|||
virtual HRESULT PointToClient (AvnPoint point, AvnPoint*ret) = 0; |
|||
virtual HRESULT PointToScreen (AvnPoint point, AvnPoint*ret) = 0; |
|||
virtual HRESULT ThreadSafeSetSwRenderedFrame(AvnFramebuffer* fb, IUnknown* dispose) = 0; |
|||
virtual HRESULT SetTopMost (bool value) = 0; |
|||
virtual HRESULT SetCursor(IAvnCursor* cursor) = 0; |
|||
virtual HRESULT CreateGlRenderTarget(IAvnGlSurfaceRenderTarget** ret) = 0; |
|||
virtual HRESULT GetSoftwareFramebuffer(AvnFramebuffer*ret) = 0; |
|||
virtual HRESULT SetMainMenu(IAvnAppMenu* menu) = 0; |
|||
virtual HRESULT ObtainMainMenu(IAvnAppMenu** retOut) = 0; |
|||
virtual bool TryLock() = 0; |
|||
virtual void Unlock() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnPopup, 03) : virtual IAvnWindowBase |
|||
{ |
|||
|
|||
}; |
|||
|
|||
AVNCOM(IAvnWindow, 04) : virtual IAvnWindowBase |
|||
{ |
|||
virtual HRESULT ShowDialog (IAvnWindow* parent) = 0; |
|||
virtual HRESULT SetCanResize(bool value) = 0; |
|||
virtual HRESULT SetHasDecorations(bool value) = 0; |
|||
virtual HRESULT SetTitle (void* utf8Title) = 0; |
|||
virtual HRESULT SetTitleBarColor (AvnColor color) = 0; |
|||
virtual HRESULT SetWindowState(AvnWindowState state) = 0; |
|||
virtual HRESULT GetWindowState(AvnWindowState*ret) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnWindowBaseEvents, 05) : IUnknown |
|||
{ |
|||
virtual HRESULT Paint() = 0; |
|||
virtual void Closed() = 0; |
|||
virtual void Activated() = 0; |
|||
virtual void Deactivated() = 0; |
|||
virtual void Resized(const AvnSize& size) = 0; |
|||
virtual void PositionChanged (AvnPoint position) = 0; |
|||
virtual void RawMouseEvent (AvnRawMouseEventType type, |
|||
unsigned int timeStamp, |
|||
AvnInputModifiers modifiers, |
|||
AvnPoint point, |
|||
AvnVector delta) = 0; |
|||
virtual bool RawKeyEvent (AvnRawKeyEventType type, unsigned int timeStamp, AvnInputModifiers modifiers, unsigned int key) = 0; |
|||
virtual bool RawTextInputEvent (unsigned int timeStamp, const char* text) = 0; |
|||
virtual void ScalingChanged(double scaling) = 0; |
|||
virtual void RunRenderPriorityJobs() = 0; |
|||
}; |
|||
|
|||
|
|||
AVNCOM(IAvnWindowEvents, 06) : IAvnWindowBaseEvents |
|||
{ |
|||
/**
|
|||
* Closing Event |
|||
* Called when the user presses the OS window close button. |
|||
* return true to allow the close, return false to prevent close. |
|||
*/ |
|||
virtual bool Closing () = 0; |
|||
|
|||
virtual void WindowStateChanged (AvnWindowState state) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnMacOptions, 07) : IUnknown |
|||
{ |
|||
virtual HRESULT SetShowInDock(int show) = 0; |
|||
virtual HRESULT SetApplicationTitle (void* utf8string) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnActionCallback, 08) : IUnknown |
|||
{ |
|||
virtual void Run() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnSignaledCallback, 09) : IUnknown |
|||
{ |
|||
virtual void Signaled(int priority, bool priorityContainsMeaningfulValue) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnLoopCancellation, 0a) : IUnknown |
|||
{ |
|||
virtual void Cancel() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnPlatformThreadingInterface, 0b) : IUnknown |
|||
{ |
|||
virtual bool GetCurrentThreadIsLoopThread() = 0; |
|||
virtual void SetSignaledCallback(IAvnSignaledCallback* cb) = 0; |
|||
virtual IAvnLoopCancellation* CreateLoopCancellation() = 0; |
|||
virtual HRESULT RunLoop(IAvnLoopCancellation* cancel) = 0; |
|||
// Can't pass int* to sharpgentools for some reason
|
|||
virtual void Signal(int priority) = 0; |
|||
virtual IUnknown* StartTimer(int priority, int ms, IAvnActionCallback* callback) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnSystemDialogEvents, 0c) : IUnknown |
|||
{ |
|||
virtual void OnCompleted (int numResults, void* ptrFirstResult) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnSystemDialogs, 0d) : IUnknown |
|||
{ |
|||
virtual void SelectFolderDialog (IAvnWindow* parentWindowHandle, |
|||
IAvnSystemDialogEvents* events, |
|||
const char* title, |
|||
const char* initialPath) = 0; |
|||
|
|||
virtual void OpenFileDialog (IAvnWindow* parentWindowHandle, |
|||
IAvnSystemDialogEvents* events, |
|||
bool allowMultiple, |
|||
const char* title, |
|||
const char* initialDirectory, |
|||
const char* initialFile, |
|||
const char* filters) = 0; |
|||
|
|||
virtual void SaveFileDialog (IAvnWindow* parentWindowHandle, |
|||
IAvnSystemDialogEvents* events, |
|||
const char* title, |
|||
const char* initialDirectory, |
|||
const char* initialFile, |
|||
const char* filters) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnScreens, 0e) : IUnknown |
|||
{ |
|||
virtual HRESULT GetScreenCount (int* ret) = 0; |
|||
virtual HRESULT GetScreen (int index, AvnScreen* ret) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnClipboard, 0f) : IUnknown |
|||
{ |
|||
virtual HRESULT GetText (IAvnString**ppv) = 0; |
|||
virtual HRESULT SetText (void* utf8Text) = 0; |
|||
virtual HRESULT Clear() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnCursor, 10) : IUnknown |
|||
{ |
|||
}; |
|||
|
|||
AVNCOM(IAvnCursorFactory, 11) : IUnknown |
|||
{ |
|||
virtual HRESULT GetCursor (AvnStandardCursorType cursorType, IAvnCursor** retOut) = 0; |
|||
}; |
|||
|
|||
|
|||
AVNCOM(IAvnGlFeature, 12) : IUnknown |
|||
{ |
|||
virtual HRESULT ObtainDisplay(IAvnGlDisplay**retOut) = 0; |
|||
virtual HRESULT ObtainImmediateContext(IAvnGlContext**retOut) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnGlDisplay, 13) : IUnknown |
|||
{ |
|||
virtual HRESULT GetSampleCount(int* ret) = 0; |
|||
virtual HRESULT GetStencilSize(int* ret) = 0; |
|||
virtual HRESULT ClearContext() = 0; |
|||
virtual void* GetProcAddress(char* proc) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnGlContext, 14) : IUnknown |
|||
{ |
|||
virtual HRESULT MakeCurrent() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnGlSurfaceRenderTarget, 15) : IUnknown |
|||
{ |
|||
virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnGlSurfaceRenderingSession, 16) : IUnknown |
|||
{ |
|||
virtual HRESULT GetPixelSize(AvnPixelSize* ret) = 0; |
|||
virtual HRESULT GetScaling(double* ret) = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnAppMenu, 17) : IUnknown |
|||
{ |
|||
virtual HRESULT AddItem (IAvnAppMenuItem* item) = 0; |
|||
virtual HRESULT RemoveItem (IAvnAppMenuItem* item) = 0; |
|||
virtual HRESULT SetTitle (void* utf8String) = 0; |
|||
virtual HRESULT Clear () = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnPredicateCallback, 18) : IUnknown |
|||
{ |
|||
virtual bool Evaluate() = 0; |
|||
}; |
|||
|
|||
AVNCOM(IAvnAppMenuItem, 19) : IUnknown |
|||
{ |
|||
virtual HRESULT SetSubMenu (IAvnAppMenu* menu) = 0; |
|||
virtual HRESULT SetTitle (void* utf8String) = 0; |
|||
virtual HRESULT SetGesture (void* utf8String, AvnInputModifiers modifiers) = 0; |
|||
virtual HRESULT SetAction (IAvnPredicateCallback* predicate, IAvnActionCallback* callback) = 0; |
|||
}; |
|||
|
|||
extern "C" IAvaloniaNativeFactory* CreateAvaloniaNative(); |
|||
File diff suppressed because it is too large
@ -0,0 +1,12 @@ |
|||
|
|||
@protocol IRenderTarget |
|||
-(void) setNewLayer: (CALayer*) layer; |
|||
-(HRESULT) setSwFrame: (AvnFramebuffer*) fb; |
|||
-(void) resize: (AvnPixelSize) size withScale: (float) scale; |
|||
-(AvnPixelSize) pixelSize; |
|||
-(IAvnGlSurfaceRenderTarget*) createSurfaceRenderTarget; |
|||
@end |
|||
|
|||
@interface IOSurfaceRenderTarget : NSObject<IRenderTarget> |
|||
-(IOSurfaceRenderTarget*) initWithOpenGlContext: (IAvnGlContext*) context; |
|||
@end |
|||
@ -1,12 +1,14 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
#ifndef keytransform_h |
|||
#define keytransform_h |
|||
#include "common.h" |
|||
#include "key.h" |
|||
#include <map> |
|||
|
|||
extern std::map<int, AvnKey> s_KeyMap; |
|||
|
|||
extern std::map<AvnKey, int> s_AvnKeyMap; |
|||
|
|||
extern std::map<int, const char*> s_QwertyKeyMap; |
|||
|
|||
extern std::map<AvnKey, int> s_UnicodeKeyMap; |
|||
|
|||
#endif |
|||
|
|||
@ -1,24 +1,71 @@ |
|||
#include "common.h" |
|||
@interface AvnAppDelegate : NSObject<NSApplicationDelegate> |
|||
@end |
|||
extern NSApplicationActivationPolicy AvnDesiredActivationPolicy = NSApplicationActivationPolicyRegular; |
|||
|
|||
NSApplicationActivationPolicy AvnDesiredActivationPolicy = NSApplicationActivationPolicyRegular; |
|||
|
|||
@implementation AvnAppDelegate |
|||
- (void)applicationWillFinishLaunching:(NSNotification *)notification |
|||
{ |
|||
[[NSApplication sharedApplication] setActivationPolicy: AvnDesiredActivationPolicy]; |
|||
if([[NSApplication sharedApplication] activationPolicy] != AvnDesiredActivationPolicy) |
|||
{ |
|||
for (NSRunningApplication * app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) { |
|||
[app activateWithOptions:NSApplicationActivateIgnoringOtherApps]; |
|||
break; |
|||
} |
|||
|
|||
[[NSApplication sharedApplication] setActivationPolicy: AvnDesiredActivationPolicy]; |
|||
|
|||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"]; |
|||
|
|||
[[NSApplication sharedApplication] setHelpMenu: [[NSMenu new] initWithTitle:@""]]; |
|||
} |
|||
} |
|||
|
|||
- (void)applicationDidFinishLaunching:(NSNotification *)notification |
|||
{ |
|||
[NSApp activateIgnoringOtherApps:true]; |
|||
[[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps]; |
|||
} |
|||
|
|||
@end |
|||
|
|||
@interface AvnApplication : NSApplication |
|||
|
|||
|
|||
@end |
|||
|
|||
@implementation AvnApplication |
|||
{ |
|||
BOOL _isHandlingSendEvent; |
|||
} |
|||
|
|||
- (void)sendEvent:(NSEvent *)event |
|||
{ |
|||
bool oldHandling = _isHandlingSendEvent; |
|||
_isHandlingSendEvent = true; |
|||
@try { |
|||
[super sendEvent: event]; |
|||
} @finally { |
|||
_isHandlingSendEvent = oldHandling; |
|||
} |
|||
} |
|||
|
|||
// This is needed for certain embedded controls |
|||
- (BOOL) isHandlingSendEvent |
|||
{ |
|||
return _isHandlingSendEvent; |
|||
} |
|||
|
|||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent |
|||
{ |
|||
_isHandlingSendEvent = handlingSendEvent; |
|||
} |
|||
|
|||
@end |
|||
|
|||
extern void InitializeAvnApp() |
|||
{ |
|||
NSApplication* app = [NSApplication sharedApplication]; |
|||
NSApplication* app = [AvnApplication sharedApplication]; |
|||
id delegate = [AvnAppDelegate new]; |
|||
[app setDelegate:delegate]; |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,166 @@ |
|||
#include "common.h" |
|||
#include <dlfcn.h> |
|||
|
|||
static CGLContextObj CreateCglContext(CGLContextObj share) |
|||
{ |
|||
int attributes[] = { |
|||
kCGLPFAAccelerated, |
|||
kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core, |
|||
kCGLPFADepthSize, 8, |
|||
kCGLPFAStencilSize, 8, |
|||
kCGLPFAColorSize, 32, |
|||
0 |
|||
}; |
|||
|
|||
CGLPixelFormatObj pix; |
|||
CGLError errorCode; |
|||
GLint num; // stores the number of possible pixel formats |
|||
errorCode = CGLChoosePixelFormat( (CGLPixelFormatAttribute*)attributes, &pix, &num ); |
|||
if(errorCode != 0) |
|||
return nil; |
|||
CGLContextObj ctx = nil; |
|||
errorCode = CGLCreateContext(pix, share, &ctx ); |
|||
CGLDestroyPixelFormat( pix ); |
|||
if(errorCode != 0) |
|||
return nil; |
|||
return ctx; |
|||
}; |
|||
|
|||
|
|||
|
|||
class AvnGlContext : public virtual ComSingleObject<IAvnGlContext, &IID_IAvnGlContext> |
|||
{ |
|||
// Debug |
|||
int _usageCount = 0; |
|||
public: |
|||
CGLContextObj Context; |
|||
int SampleCount = 0, StencilBits = 0; |
|||
FORWARD_IUNKNOWN() |
|||
|
|||
class SavedGlContext : public virtual ComUnknownObject |
|||
{ |
|||
CGLContextObj _savedContext; |
|||
ComPtr<AvnGlContext> _parent; |
|||
public: |
|||
SavedGlContext(CGLContextObj saved, AvnGlContext* parent) |
|||
{ |
|||
_savedContext = saved; |
|||
_parent = parent; |
|||
_parent->_usageCount++; |
|||
} |
|||
|
|||
~SavedGlContext() |
|||
{ |
|||
if(_parent->Context == CGLGetCurrentContext()) |
|||
CGLSetCurrentContext(_savedContext); |
|||
_parent->_usageCount--; |
|||
CGLUnlockContext(_parent->Context); |
|||
} |
|||
}; |
|||
|
|||
AvnGlContext(CGLContextObj context) |
|||
{ |
|||
Context = context; |
|||
CGLPixelFormatObj fmt = CGLGetPixelFormat(context); |
|||
CGLDescribePixelFormat(fmt, 0, kCGLPFASamples, &SampleCount); |
|||
CGLDescribePixelFormat(fmt, 0, kCGLPFAStencilSize, &StencilBits); |
|||
|
|||
} |
|||
|
|||
virtual HRESULT LegacyMakeCurrent() override |
|||
{ |
|||
if(CGLSetCurrentContext(Context) != 0) |
|||
return E_FAIL; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual HRESULT MakeCurrent(IUnknown** ppv) override |
|||
{ |
|||
CGLContextObj saved = CGLGetCurrentContext(); |
|||
CGLLockContext(Context); |
|||
if(CGLSetCurrentContext(Context) != 0) |
|||
{ |
|||
CGLUnlockContext(Context); |
|||
return E_FAIL; |
|||
} |
|||
*ppv = new SavedGlContext(saved, this); |
|||
|
|||
return S_OK; |
|||
} |
|||
|
|||
virtual int GetSampleCount() override |
|||
{ |
|||
return SampleCount; |
|||
} |
|||
|
|||
virtual int GetStencilSize() override |
|||
{ |
|||
return StencilBits; |
|||
} |
|||
|
|||
virtual void* GetNativeHandle() override |
|||
{ |
|||
return Context; |
|||
} |
|||
|
|||
~AvnGlContext() |
|||
{ |
|||
CGLReleaseContext(Context); |
|||
} |
|||
}; |
|||
|
|||
class AvnGlDisplay : public virtual ComSingleObject<IAvnGlDisplay, &IID_IAvnGlDisplay> |
|||
{ |
|||
void* _libgl; |
|||
|
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
|
|||
AvnGlDisplay() |
|||
{ |
|||
_libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib", RTLD_LAZY); |
|||
} |
|||
|
|||
virtual void* GetProcAddress(char* proc) override |
|||
{ |
|||
return dlsym(_libgl, proc); |
|||
} |
|||
|
|||
virtual HRESULT CreateContext(IAvnGlContext* share, IAvnGlContext**ppv) override |
|||
{ |
|||
CGLContextObj shareContext = nil; |
|||
if(share != nil) |
|||
{ |
|||
AvnGlContext* shareCtx = dynamic_cast<AvnGlContext*>(share); |
|||
if(shareCtx != nil) |
|||
shareContext = shareCtx->Context; |
|||
} |
|||
CGLContextObj ctx = ::CreateCglContext(shareContext); |
|||
if(ctx == nil) |
|||
return E_FAIL; |
|||
*ppv = new AvnGlContext(ctx); |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual HRESULT WrapContext(void* native, IAvnGlContext**ppv) override |
|||
{ |
|||
if(native == nil) |
|||
return E_INVALIDARG; |
|||
*ppv = new AvnGlContext((CGLContextObj) native); |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual void LegacyClearCurrentContext() override |
|||
{ |
|||
CGLSetCurrentContext(nil); |
|||
} |
|||
}; |
|||
|
|||
static IAvnGlDisplay* GlDisplay = new AvnGlDisplay(); |
|||
|
|||
|
|||
extern IAvnGlDisplay* GetGlDisplay() |
|||
{ |
|||
return GlDisplay; |
|||
}; |
|||
|
|||
@ -0,0 +1,160 @@ |
|||
#include "common.h" |
|||
|
|||
|
|||
IAvnNativeControlHostTopLevelAttachment* CreateAttachment(); |
|||
|
|||
class AvnNativeControlHost : |
|||
public ComSingleObject<IAvnNativeControlHost, &IID_IAvnNativeControlHost> |
|||
{ |
|||
public: |
|||
FORWARD_IUNKNOWN(); |
|||
NSView* View; |
|||
AvnNativeControlHost(NSView* view) |
|||
{ |
|||
View = view; |
|||
} |
|||
|
|||
virtual HRESULT CreateDefaultChild(void* parent, void** retOut) override |
|||
{ |
|||
NSView* view = [NSView new]; |
|||
[view setWantsLayer: true]; |
|||
|
|||
*retOut = (__bridge_retained void*)view; |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual IAvnNativeControlHostTopLevelAttachment* CreateAttachment() override |
|||
{ |
|||
return ::CreateAttachment(); |
|||
}; |
|||
|
|||
virtual void DestroyDefaultChild(void* child) override |
|||
{ |
|||
// ARC will release the object for us |
|||
(__bridge_transfer NSView*) child; |
|||
} |
|||
}; |
|||
|
|||
class AvnNativeControlHostTopLevelAttachment : |
|||
public ComSingleObject<IAvnNativeControlHostTopLevelAttachment, &IID_IAvnNativeControlHostTopLevelAttachment> |
|||
{ |
|||
NSView* _holder; |
|||
NSView* _child; |
|||
public: |
|||
FORWARD_IUNKNOWN(); |
|||
|
|||
AvnNativeControlHostTopLevelAttachment() |
|||
{ |
|||
_holder = [NSView new]; |
|||
[_holder setWantsLayer:true]; |
|||
} |
|||
|
|||
virtual ~AvnNativeControlHostTopLevelAttachment() |
|||
{ |
|||
if(_child != nil && [_child superview] == _holder) |
|||
{ |
|||
[_child removeFromSuperview]; |
|||
} |
|||
|
|||
if([_holder superview] != nil) |
|||
{ |
|||
[_holder removeFromSuperview]; |
|||
} |
|||
} |
|||
|
|||
virtual void* GetParentHandle() override |
|||
{ |
|||
return (__bridge void*)_holder; |
|||
}; |
|||
|
|||
virtual HRESULT InitializeWithChildHandle(void* child) override |
|||
{ |
|||
if(_child != nil) |
|||
return E_FAIL; |
|||
_child = (__bridge NSView*)child; |
|||
if(_child == nil) |
|||
return E_FAIL; |
|||
[_holder addSubview:_child]; |
|||
[_child setHidden: false]; |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual HRESULT AttachTo(IAvnNativeControlHost* host) override |
|||
{ |
|||
if(host == nil) |
|||
{ |
|||
[_holder removeFromSuperview]; |
|||
[_holder setHidden: true]; |
|||
} |
|||
else |
|||
{ |
|||
AvnNativeControlHost* chost = dynamic_cast<AvnNativeControlHost*>(host); |
|||
if(chost == nil || chost->View == nil) |
|||
return E_FAIL; |
|||
[_holder setHidden:true]; |
|||
[chost->View addSubview:_holder]; |
|||
} |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual void ShowInBounds(float x, float y, float width, float height) override |
|||
{ |
|||
if(_child == nil) |
|||
return; |
|||
if(AvnInsidePotentialDeadlock::IsInside()) |
|||
{ |
|||
IAvnNativeControlHostTopLevelAttachment* slf = this; |
|||
slf->AddRef(); |
|||
dispatch_async(dispatch_get_main_queue(), ^{ |
|||
slf->ShowInBounds(x, y, width, height); |
|||
slf->Release(); |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
NSRect childFrame = {0, 0, width, height}; |
|||
NSRect holderFrame = {x, y, width, height}; |
|||
|
|||
[_child setFrame: childFrame]; |
|||
[_holder setFrame: holderFrame]; |
|||
[_holder setHidden: false]; |
|||
if([_holder superview] != nil) |
|||
[[_holder superview] setNeedsDisplay:true]; |
|||
} |
|||
|
|||
virtual void HideWithSize(float width, float height) override |
|||
{ |
|||
if(_child == nil) |
|||
return; |
|||
if(AvnInsidePotentialDeadlock::IsInside()) |
|||
{ |
|||
IAvnNativeControlHostTopLevelAttachment* slf = this; |
|||
slf->AddRef(); |
|||
dispatch_async(dispatch_get_main_queue(), ^{ |
|||
slf->HideWithSize(width, height); |
|||
slf->Release(); |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
NSRect frame = {0, 0, width, height}; |
|||
[_holder setHidden: true]; |
|||
[_child setFrame: frame]; |
|||
} |
|||
|
|||
virtual void ReleaseChild() override |
|||
{ |
|||
[_child removeFromSuperview]; |
|||
_child = nil; |
|||
} |
|||
}; |
|||
|
|||
IAvnNativeControlHostTopLevelAttachment* CreateAttachment() |
|||
{ |
|||
return new AvnNativeControlHostTopLevelAttachment(); |
|||
} |
|||
|
|||
extern IAvnNativeControlHost* CreateNativeControlHost(NSView* parent) |
|||
{ |
|||
return new AvnNativeControlHost(parent); |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
#include "common.h" |
|||
|
|||
static int Counter = 0; |
|||
AvnInsidePotentialDeadlock::AvnInsidePotentialDeadlock() |
|||
{ |
|||
Counter++; |
|||
} |
|||
|
|||
AvnInsidePotentialDeadlock::~AvnInsidePotentialDeadlock() |
|||
{ |
|||
Counter--; |
|||
} |
|||
|
|||
bool AvnInsidePotentialDeadlock::IsInside() |
|||
{ |
|||
return Counter!=0; |
|||
} |
|||
@ -0,0 +1,89 @@ |
|||
#include "common.h" |
|||
|
|||
extern AvnDragDropEffects ConvertDragDropEffects(NSDragOperation nsop) |
|||
{ |
|||
int effects = 0; |
|||
if((nsop & NSDragOperationCopy) != 0) |
|||
effects |= (int)AvnDragDropEffects::Copy; |
|||
if((nsop & NSDragOperationMove) != 0) |
|||
effects |= (int)AvnDragDropEffects::Move; |
|||
if((nsop & NSDragOperationLink) != 0) |
|||
effects |= (int)AvnDragDropEffects::Link; |
|||
return (AvnDragDropEffects)effects; |
|||
}; |
|||
|
|||
extern NSString* GetAvnCustomDataType() |
|||
{ |
|||
char buffer[256]; |
|||
sprintf(buffer, "net.avaloniaui.inproc.uti.n%in", getpid()); |
|||
return [NSString stringWithUTF8String:buffer]; |
|||
} |
|||
|
|||
@interface AvnDndSource : NSObject<NSDraggingSource> |
|||
|
|||
@end |
|||
|
|||
@implementation AvnDndSource |
|||
{ |
|||
NSDragOperation _operation; |
|||
ComPtr<IAvnDndResultCallback> _cb; |
|||
void* _sourceHandle; |
|||
}; |
|||
|
|||
- (NSDragOperation)draggingSession:(nonnull NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context |
|||
{ |
|||
return NSDragOperationCopy; |
|||
} |
|||
|
|||
- (AvnDndSource*) initWithOperation: (NSDragOperation)operation |
|||
andCallback: (IAvnDndResultCallback*) cb |
|||
andSourceHandle: (void*) handle |
|||
{ |
|||
self = [super init]; |
|||
_operation = operation; |
|||
_cb = cb; |
|||
_sourceHandle = handle; |
|||
return self; |
|||
} |
|||
|
|||
- (void)draggingSession:(NSDraggingSession *)session |
|||
endedAtPoint:(NSPoint)screenPoint |
|||
operation:(NSDragOperation)operation |
|||
{ |
|||
if(_cb != nil) |
|||
{ |
|||
auto cb = _cb; |
|||
_cb = nil; |
|||
cb->OnDragAndDropComplete(ConvertDragDropEffects(operation)); |
|||
} |
|||
if(_sourceHandle != nil) |
|||
{ |
|||
FreeAvnGCHandle(_sourceHandle); |
|||
_sourceHandle = nil; |
|||
} |
|||
} |
|||
|
|||
- (void*) gcHandle |
|||
{ |
|||
return _sourceHandle; |
|||
} |
|||
|
|||
@end |
|||
|
|||
extern NSObject<NSDraggingSource>* CreateDraggingSource(NSDragOperation op, IAvnDndResultCallback* cb, void* handle) |
|||
{ |
|||
return [[AvnDndSource alloc] initWithOperation:op andCallback:cb andSourceHandle:handle]; |
|||
}; |
|||
|
|||
extern void* GetAvnDataObjectHandleFromDraggingInfo(NSObject<NSDraggingInfo>* info) |
|||
{ |
|||
id obj = [info draggingSource]; |
|||
if(obj == nil) |
|||
return nil; |
|||
if([obj isKindOfClass: [AvnDndSource class]]) |
|||
{ |
|||
auto src = (AvnDndSource*)obj; |
|||
return [src gcHandle]; |
|||
} |
|||
return nil; |
|||
} |
|||
@ -1,253 +0,0 @@ |
|||
#include "common.h" |
|||
#include <OpenGL/gl.h> |
|||
#include <dlfcn.h> |
|||
|
|||
template <typename T, size_t N> char (&ArrayCounter(T (&a)[N]))[N]; |
|||
#define ARRAY_COUNT(a) (sizeof(ArrayCounter(a))) |
|||
|
|||
NSOpenGLPixelFormat* CreateFormat() |
|||
{ |
|||
NSOpenGLPixelFormatAttribute attribs[] = |
|||
{ |
|||
NSOpenGLPFADoubleBuffer, |
|||
NSOpenGLPFAColorSize, 32, |
|||
NSOpenGLPFAStencilSize, 8, |
|||
NSOpenGLPFADepthSize, 8, |
|||
0 |
|||
}; |
|||
return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; |
|||
} |
|||
|
|||
class AvnGlContext : public virtual ComSingleObject<IAvnGlContext, &IID_IAvnGlContext> |
|||
{ |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
NSOpenGLContext* GlContext; |
|||
GLuint Framebuffer, RenderBuffer, StencilBuffer; |
|||
AvnGlContext(NSOpenGLContext* gl, bool offscreen) |
|||
{ |
|||
Framebuffer = 0; |
|||
RenderBuffer = 0; |
|||
StencilBuffer = 0; |
|||
GlContext = gl; |
|||
if(offscreen) |
|||
{ |
|||
[GlContext makeCurrentContext]; |
|||
|
|||
glGenFramebuffersEXT(1, &Framebuffer); |
|||
glBindFramebufferEXT(GL_FRAMEBUFFER, Framebuffer); |
|||
glGenRenderbuffersEXT(1, &RenderBuffer); |
|||
glGenRenderbuffersEXT(1, &StencilBuffer); |
|||
|
|||
glBindRenderbufferEXT(GL_RENDERBUFFER, StencilBuffer); |
|||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, StencilBuffer); |
|||
glBindRenderbufferEXT(GL_RENDERBUFFER, RenderBuffer); |
|||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, RenderBuffer); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
virtual HRESULT MakeCurrent() override |
|||
{ |
|||
[GlContext makeCurrentContext];/* |
|||
glBindFramebufferEXT(GL_FRAMEBUFFER, Framebuffer); |
|||
glBindRenderbufferEXT(GL_RENDERBUFFER, RenderBuffer); |
|||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, RenderBuffer); |
|||
glBindRenderbufferEXT(GL_RENDERBUFFER, StencilBuffer); |
|||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, StencilBuffer);*/ |
|||
return S_OK; |
|||
} |
|||
}; |
|||
|
|||
class AvnGlDisplay : public virtual ComSingleObject<IAvnGlDisplay, &IID_IAvnGlDisplay> |
|||
{ |
|||
int _sampleCount, _stencilSize; |
|||
void* _libgl; |
|||
|
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
|
|||
AvnGlDisplay(int sampleCount, int stencilSize) |
|||
{ |
|||
_sampleCount = sampleCount; |
|||
_stencilSize = stencilSize; |
|||
_libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib", RTLD_LAZY); |
|||
} |
|||
|
|||
virtual HRESULT GetSampleCount(int* ret) override |
|||
{ |
|||
*ret = _sampleCount; |
|||
return S_OK; |
|||
} |
|||
virtual HRESULT GetStencilSize(int* ret) override |
|||
{ |
|||
*ret = _stencilSize; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual HRESULT ClearContext() override |
|||
{ |
|||
[NSOpenGLContext clearCurrentContext]; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual void* GetProcAddress(char* proc) override |
|||
{ |
|||
return dlsym(_libgl, proc); |
|||
} |
|||
}; |
|||
|
|||
|
|||
class GlFeature : public virtual ComSingleObject<IAvnGlFeature, &IID_IAvnGlFeature> |
|||
{ |
|||
IAvnGlDisplay* _display; |
|||
AvnGlContext *_immediate; |
|||
NSOpenGLContext* _shared; |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
NSOpenGLPixelFormat* _format; |
|||
GlFeature(IAvnGlDisplay* display, AvnGlContext* immediate, NSOpenGLPixelFormat* format) |
|||
{ |
|||
_display = display; |
|||
_immediate = immediate; |
|||
_format = format; |
|||
_shared = [[NSOpenGLContext alloc] initWithFormat:_format shareContext:_immediate->GlContext]; |
|||
} |
|||
|
|||
NSOpenGLContext* CreateContext() |
|||
{ |
|||
return _shared; |
|||
//return [[NSOpenGLContext alloc] initWithFormat:_format shareContext:nil]; |
|||
} |
|||
|
|||
virtual HRESULT ObtainDisplay(IAvnGlDisplay**retOut) override |
|||
{ |
|||
*retOut = _display; |
|||
_display->AddRef(); |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual HRESULT ObtainImmediateContext(IAvnGlContext**retOut) override |
|||
{ |
|||
*retOut = _immediate; |
|||
_immediate->AddRef(); |
|||
return S_OK; |
|||
} |
|||
}; |
|||
|
|||
static GlFeature* Feature; |
|||
|
|||
GlFeature* CreateGlFeature() |
|||
{ |
|||
auto format = CreateFormat(); |
|||
if(format == nil) |
|||
{ |
|||
NSLog(@"Unable to choose pixel format"); |
|||
return NULL; |
|||
} |
|||
|
|||
auto immediateContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil]; |
|||
if(immediateContext == nil) |
|||
{ |
|||
NSLog(@"Unable to create NSOpenGLContext"); |
|||
return NULL; |
|||
} |
|||
|
|||
int stencilBits = 0, sampleCount = 0; |
|||
|
|||
auto fmt = CGLGetPixelFormat([immediateContext CGLContextObj]); |
|||
CGLDescribePixelFormat(fmt, 0, kCGLPFASamples, &sampleCount); |
|||
CGLDescribePixelFormat(fmt, 0, kCGLPFAStencilSize, &stencilBits); |
|||
|
|||
auto offscreen = new AvnGlContext(immediateContext, true); |
|||
auto display = new AvnGlDisplay(sampleCount, stencilBits); |
|||
|
|||
return new GlFeature(display, offscreen, format); |
|||
} |
|||
|
|||
|
|||
static GlFeature* GetFeature() |
|||
{ |
|||
if(Feature == nil) |
|||
Feature = CreateGlFeature(); |
|||
return Feature; |
|||
} |
|||
|
|||
extern IAvnGlFeature* GetGlFeature() |
|||
{ |
|||
return GetFeature(); |
|||
} |
|||
|
|||
class AvnGlRenderingSession : public ComSingleObject<IAvnGlSurfaceRenderingSession, &IID_IAvnGlSurfaceRenderingSession> |
|||
{ |
|||
NSView* _view; |
|||
NSWindow* _window; |
|||
NSOpenGLContext* _context; |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
AvnGlRenderingSession(NSWindow*window, NSView* view, NSOpenGLContext* context) |
|||
{ |
|||
_context = context; |
|||
_window = window; |
|||
_view = view; |
|||
} |
|||
|
|||
virtual HRESULT GetPixelSize(AvnPixelSize* ret) override |
|||
{ |
|||
auto fsize = [_view convertSizeToBacking: [_view frame].size]; |
|||
ret->Width = (int)fsize.width; |
|||
ret->Height = (int)fsize.height; |
|||
return S_OK; |
|||
} |
|||
virtual HRESULT GetScaling(double* ret) override |
|||
{ |
|||
*ret = [_window backingScaleFactor]; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual ~AvnGlRenderingSession() |
|||
{ |
|||
[_context flushBuffer]; |
|||
[NSOpenGLContext clearCurrentContext]; |
|||
CGLUnlockContext([_context CGLContextObj]); |
|||
[_view unlockFocus]; |
|||
} |
|||
}; |
|||
|
|||
class AvnGlRenderTarget : public ComSingleObject<IAvnGlSurfaceRenderTarget, &IID_IAvnGlSurfaceRenderTarget> |
|||
{ |
|||
NSView* _view; |
|||
NSWindow* _window; |
|||
NSOpenGLContext* _context; |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
AvnGlRenderTarget(NSWindow* window, NSView*view) |
|||
{ |
|||
_window = window; |
|||
_view = view; |
|||
_context = GetFeature()->CreateContext(); |
|||
} |
|||
|
|||
virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) override |
|||
{ |
|||
auto f = GetFeature(); |
|||
if(f == NULL) |
|||
return E_FAIL; |
|||
if(![_view lockFocusIfCanDraw]) |
|||
return E_ABORT; |
|||
|
|||
auto gl = _context; |
|||
CGLLockContext([_context CGLContextObj]); |
|||
[gl setView: _view]; |
|||
[gl update]; |
|||
[gl makeCurrentContext]; |
|||
*ret = new AvnGlRenderingSession(_window, _view, gl); |
|||
return S_OK; |
|||
} |
|||
}; |
|||
|
|||
extern IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(NSWindow* window, NSView* view) |
|||
{ |
|||
return new AvnGlRenderTarget(window, view); |
|||
} |
|||
@ -0,0 +1,292 @@ |
|||
#include "common.h" |
|||
#include "rendertarget.h" |
|||
#import <IOSurface/IOSurface.h> |
|||
#import <IOSurface/IOSurfaceObjC.h> |
|||
#import <QuartzCore/QuartzCore.h> |
|||
|
|||
#include <OpenGL/CGLIOSurface.h> |
|||
#include <OpenGL/OpenGL.h> |
|||
#include <OpenGL/glext.h> |
|||
#include <OpenGL/gl3.h> |
|||
#include <OpenGL/gl3ext.h> |
|||
|
|||
@interface IOSurfaceHolder : NSObject |
|||
@end |
|||
|
|||
@implementation IOSurfaceHolder |
|||
{ |
|||
@public IOSurfaceRef surface; |
|||
@public AvnPixelSize size; |
|||
@public float scale; |
|||
ComPtr<IAvnGlContext> _context; |
|||
GLuint _framebuffer, _texture, _renderbuffer; |
|||
} |
|||
|
|||
- (IOSurfaceHolder*) initWithSize: (AvnPixelSize) size |
|||
withScale: (float)scale |
|||
withOpenGlContext: (IAvnGlContext*) context |
|||
{ |
|||
long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, size.Width * 4); |
|||
long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, size.Height * bytesPerRow); |
|||
NSDictionary* options = @{ |
|||
(id)kIOSurfaceWidth: @(size.Width), |
|||
(id)kIOSurfaceHeight: @(size.Height), |
|||
(id)kIOSurfacePixelFormat: @((uint)'BGRA'), |
|||
(id)kIOSurfaceBytesPerElement: @(4), |
|||
(id)kIOSurfaceBytesPerRow: @(bytesPerRow), |
|||
(id)kIOSurfaceAllocSize: @(allocSize), |
|||
|
|||
//(id)kIOSurfaceCacheMode: @(kIOMapWriteCombineCache), |
|||
(id)kIOSurfaceElementWidth: @(1), |
|||
(id)kIOSurfaceElementHeight: @(1) |
|||
}; |
|||
|
|||
surface = IOSurfaceCreate((CFDictionaryRef)options); |
|||
self->scale = scale; |
|||
self->size = size; |
|||
self->_context = context; |
|||
return self; |
|||
} |
|||
|
|||
-(HRESULT) prepareForGlRender |
|||
{ |
|||
if(_context == nil) |
|||
return E_FAIL; |
|||
if(CGLGetCurrentContext() != _context->GetNativeHandle()) |
|||
return E_FAIL; |
|||
if(_framebuffer == 0) |
|||
glGenFramebuffersEXT(1, &_framebuffer); |
|||
|
|||
|
|||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _framebuffer); |
|||
if(_texture == 0) |
|||
{ |
|||
glGenTextures(1, &_texture); |
|||
|
|||
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, _texture); |
|||
CGLError res = CGLTexImageIOSurface2D((CGLContextObj)_context->GetNativeHandle(), |
|||
GL_TEXTURE_RECTANGLE_EXT, GL_RGBA8, |
|||
size.Width, size.Height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, 0); |
|||
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 0); |
|||
|
|||
if(res != 0) |
|||
{ |
|||
glDeleteTextures(1, &_texture); |
|||
_texture = 0; |
|||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
|||
return E_FAIL; |
|||
} |
|||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, _texture, 0); |
|||
} |
|||
|
|||
if(_renderbuffer == 0) |
|||
{ |
|||
glGenRenderbuffers(1, &_renderbuffer); |
|||
glBindRenderbuffer(GL_RENDERBUFFER, _renderbuffer); |
|||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, size.Width, size.Height); |
|||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderbuffer); |
|||
} |
|||
|
|||
return S_OK; |
|||
} |
|||
|
|||
-(void) finishDraw |
|||
{ |
|||
ComPtr<IUnknown> release; |
|||
_context->MakeCurrent(release.getPPV()); |
|||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
|||
glFlush(); |
|||
} |
|||
|
|||
-(void) dealloc |
|||
{ |
|||
|
|||
if(_framebuffer != 0) |
|||
{ |
|||
ComPtr<IUnknown> release; |
|||
_context->MakeCurrent(release.getPPV()); |
|||
glDeleteFramebuffers(1, &_framebuffer); |
|||
if(_texture != 0) |
|||
glDeleteTextures(1, &_texture); |
|||
if(_renderbuffer != 0) |
|||
glDeleteRenderbuffers(1, &_renderbuffer); |
|||
} |
|||
CFRelease(surface); |
|||
} |
|||
@end |
|||
|
|||
static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* target); |
|||
|
|||
@implementation IOSurfaceRenderTarget |
|||
{ |
|||
CALayer* _layer; |
|||
@public IOSurfaceHolder* surface; |
|||
@public NSObject* lock; |
|||
ComPtr<IAvnGlContext> _glContext; |
|||
} |
|||
|
|||
- (IOSurfaceRenderTarget*) initWithOpenGlContext: (IAvnGlContext*) context; |
|||
{ |
|||
self = [super init]; |
|||
_glContext = context; |
|||
lock = [NSObject new]; |
|||
surface = nil; |
|||
[self resize:{1,1} withScale: 1]; |
|||
|
|||
return self; |
|||
} |
|||
|
|||
- (AvnPixelSize) pixelSize { |
|||
return {1, 1}; |
|||
} |
|||
|
|||
- (CALayer *)layer { |
|||
return _layer; |
|||
} |
|||
|
|||
- (void)resize:(AvnPixelSize)size withScale: (float) scale{ |
|||
@synchronized (lock) { |
|||
if(surface == nil |
|||
|| surface->size.Width != size.Width |
|||
|| surface->size.Height != size.Height |
|||
|| surface->scale != scale) |
|||
{ |
|||
surface = [[IOSurfaceHolder alloc] initWithSize:size withScale:scale withOpenGlContext:_glContext.getRaw()]; |
|||
|
|||
[self updateLayer]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
- (void)updateLayer { |
|||
if ([NSThread isMainThread]) |
|||
{ |
|||
@synchronized (lock) { |
|||
if(_layer == nil) |
|||
return; |
|||
[CATransaction begin]; |
|||
[_layer setContents: nil]; |
|||
if(surface != nil) |
|||
{ |
|||
[_layer setContentsScale: surface->scale]; |
|||
[_layer setContents: (__bridge IOSurface*) surface->surface]; |
|||
} |
|||
[CATransaction commit]; |
|||
[CATransaction flush]; |
|||
} |
|||
} |
|||
else |
|||
dispatch_async(dispatch_get_main_queue(), ^{ |
|||
[self updateLayer]; |
|||
}); |
|||
} |
|||
|
|||
- (void) setNewLayer:(CALayer *)layer { |
|||
_layer = layer; |
|||
[self updateLayer]; |
|||
} |
|||
|
|||
- (HRESULT)setSwFrame:(AvnFramebuffer *)fb { |
|||
@synchronized (lock) { |
|||
if(fb->PixelFormat == AvnPixelFormat::kAvnRgb565) |
|||
return E_INVALIDARG; |
|||
if(surface == nil) |
|||
return E_FAIL; |
|||
IOSurfaceRef surf = surface->surface; |
|||
if(IOSurfaceLock(surf, 0, nil)) |
|||
return E_FAIL; |
|||
size_t w = MIN(fb->Width, IOSurfaceGetWidth(surf)); |
|||
size_t h = MIN(fb->Height, IOSurfaceGetHeight(surf)); |
|||
size_t wbytes = w*4; |
|||
size_t sstride = IOSurfaceGetBytesPerRow(surf); |
|||
size_t fstride = fb->Stride; |
|||
char*pSurface = (char*)IOSurfaceGetBaseAddress(surf); |
|||
char*pFb = (char*)fb->Data; |
|||
for(size_t y = 0; y < h; y++) |
|||
{ |
|||
memcpy(pSurface + y*sstride, pFb + y*fstride, wbytes); |
|||
} |
|||
IOSurfaceUnlock(surf, 0, nil); |
|||
[self updateLayer]; |
|||
return S_OK; |
|||
} |
|||
} |
|||
|
|||
-(IAvnGlSurfaceRenderTarget*) createSurfaceRenderTarget |
|||
{ |
|||
return CreateGlRenderTarget(self); |
|||
} |
|||
|
|||
@end |
|||
|
|||
class AvnGlRenderingSession : public ComSingleObject<IAvnGlSurfaceRenderingSession, &IID_IAvnGlSurfaceRenderingSession> |
|||
{ |
|||
ComPtr<IUnknown> _releaseContext; |
|||
IOSurfaceRenderTarget* _target; |
|||
IOSurfaceHolder* _surface; |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
AvnGlRenderingSession(IOSurfaceRenderTarget* target, ComPtr<IUnknown> releaseContext) |
|||
{ |
|||
_target = target; |
|||
// This happens in a synchronized block set up by AvnRenderTarget, so we take the current surface for this |
|||
// particular render session |
|||
_surface = _target->surface; |
|||
_releaseContext = releaseContext; |
|||
} |
|||
|
|||
virtual HRESULT GetPixelSize(AvnPixelSize* ret) override |
|||
{ |
|||
if(!_surface) |
|||
return E_FAIL; |
|||
*ret = _surface->size; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual HRESULT GetScaling(double* ret) override |
|||
{ |
|||
if(!_surface) |
|||
return E_FAIL; |
|||
*ret = _surface->scale; |
|||
return S_OK; |
|||
} |
|||
|
|||
virtual ~AvnGlRenderingSession() |
|||
{ |
|||
[_surface finishDraw]; |
|||
[_target updateLayer]; |
|||
_releaseContext = nil; |
|||
} |
|||
}; |
|||
|
|||
class AvnGlRenderTarget : public ComSingleObject<IAvnGlSurfaceRenderTarget, &IID_IAvnGlSurfaceRenderTarget> |
|||
{ |
|||
IOSurfaceRenderTarget* _target; |
|||
public: |
|||
FORWARD_IUNKNOWN() |
|||
AvnGlRenderTarget(IOSurfaceRenderTarget* target) |
|||
{ |
|||
_target = target; |
|||
} |
|||
|
|||
virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) override |
|||
{ |
|||
ComPtr<IUnknown> releaseContext; |
|||
@synchronized (_target->lock) { |
|||
if(_target->surface == nil) |
|||
return E_FAIL; |
|||
_target->_glContext->MakeCurrent(releaseContext.getPPV()); |
|||
HRESULT res = [_target->surface prepareForGlRender]; |
|||
if(res) |
|||
return res; |
|||
*ret = new AvnGlRenderingSession(_target, releaseContext); |
|||
return S_OK; |
|||
} |
|||
} |
|||
}; |
|||
|
|||
|
|||
static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* target) |
|||
{ |
|||
return new AvnGlRenderTarget(target); |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,80 @@ |
|||
using System; |
|||
using System.IO; |
|||
using System.IO.Compression; |
|||
using System.Linq; |
|||
using ILRepacking; |
|||
using Mono.Cecil; |
|||
|
|||
public class BuildTasksPatcher |
|||
{ |
|||
public static void PatchBuildTasksInPackage(string packagePath) |
|||
{ |
|||
using (var archive = new ZipArchive(File.Open(packagePath, FileMode.Open, FileAccess.ReadWrite), |
|||
ZipArchiveMode.Update)) |
|||
{ |
|||
|
|||
foreach (var entry in archive.Entries.ToList()) |
|||
{ |
|||
if (entry.Name == "Avalonia.Build.Tasks.dll") |
|||
{ |
|||
var temp = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".dll"); |
|||
var output = temp + ".output"; |
|||
var patched = new MemoryStream(); |
|||
try |
|||
{ |
|||
entry.ExtractToFile(temp, true); |
|||
var repack = new ILRepacking.ILRepack(new RepackOptions() |
|||
{ |
|||
Internalize = true, |
|||
InputAssemblies = new[] |
|||
{ |
|||
temp, typeof(Mono.Cecil.AssemblyDefinition).Assembly.GetModules()[0] |
|||
.FullyQualifiedName, |
|||
typeof(Mono.Cecil.Rocks.MethodBodyRocks).Assembly.GetModules()[0].FullyQualifiedName, |
|||
typeof(Mono.Cecil.Pdb.PdbReaderProvider).Assembly.GetModules()[0].FullyQualifiedName, |
|||
typeof(Mono.Cecil.Mdb.MdbReaderProvider).Assembly.GetModules()[0].FullyQualifiedName |
|||
|
|||
}, |
|||
SearchDirectories = new string[0], |
|||
OutputFile = output |
|||
}); |
|||
repack.Repack(); |
|||
|
|||
|
|||
// 'hurr-durr assembly with the same name is already loaded' prevention
|
|||
using (var asm = AssemblyDefinition.ReadAssembly(output, |
|||
new ReaderParameters { ReadWrite = true, InMemory = true, })) |
|||
{ |
|||
asm.Name = new AssemblyNameDefinition( |
|||
"Avalonia.Build.Tasks." |
|||
+ Guid.NewGuid().ToString().Replace("-", ""), |
|||
new Version(0, 0, 0)); |
|||
asm.Write(patched); |
|||
patched.Position = 0; |
|||
} |
|||
} |
|||
finally |
|||
{ |
|||
try |
|||
{ |
|||
if (File.Exists(temp)) |
|||
File.Delete(temp); |
|||
if (File.Exists(output)) |
|||
File.Delete(output); |
|||
} |
|||
catch |
|||
{ |
|||
//ignore
|
|||
} |
|||
} |
|||
|
|||
var fn = entry.FullName; |
|||
entry.Delete(); |
|||
var newEntry = archive.CreateEntry(fn, CompressionLevel.Optimal); |
|||
using (var s = newEntry.Open()) |
|||
patched.CopyTo(s); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.IO; |
|||
using MicroComGenerator; |
|||
using Nuke.Common; |
|||
|
|||
partial class Build : NukeBuild |
|||
{ |
|||
Target GenerateCppHeaders => _ => _.Executes(() => |
|||
{ |
|||
var text = File.ReadAllText(RootDirectory / "src" / "Avalonia.Native" / "avn.idl"); |
|||
var ast = AstParser.Parse(text); |
|||
File.WriteAllText(RootDirectory / "native" / "Avalonia.Native" / "inc" / "avalonia-native.h", |
|||
CppGen.GenerateCpp(ast)); |
|||
}); |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 4464343aef5c8ab7a42fcb20a483a6058199f8b8 |
|||
Subproject commit aef10ae67dc55c95f49b52a505a0be33bfa297a5 |
|||
@ -1,3 +1,11 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
|
|||
<ItemGroup> |
|||
<AvailableItemName Include="AvaloniaXaml" /> |
|||
<AvailableItemName Include="AvaloniaResource" /> |
|||
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)AvaloniaItemSchema.xaml" /> |
|||
</ItemGroup> |
|||
<ItemGroup Condition="'$(EnableDefaultItems)'=='True'"> |
|||
<AvaloniaXaml Include="**\*.axaml" SubType="Designer" /> |
|||
<AvaloniaXaml Include="**\*.paml" SubType="Designer" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,18 @@ |
|||
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties"> |
|||
<ContentType |
|||
Name="AvaloniaXaml" |
|||
DisplayName="Avalonia XAML" |
|||
ItemType="AvaloniaXaml"> |
|||
<NameValuePair Name="DependentFileExtensions" Value=".cs" /> |
|||
<NameValuePair Name="DefaultMetadata_SubType" Value="Designer" /> |
|||
</ContentType> |
|||
|
|||
<ItemType Name="AvaloniaXaml" DisplayName="Avalonia XAML" /> |
|||
<FileExtension Name=".axaml" ContentType="AvaloniaXaml" /> |
|||
<FileExtension Name=".paml" ContentType="AvaloniaXaml" /> |
|||
<ContentType |
|||
Name="AvaloniaResource" |
|||
DisplayName="Avalonia Resource" |
|||
ItemType="AvaloniaResource" |
|||
/> |
|||
</ProjectSchemaDefinitions> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue