Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample.Gtk: build SourceGen separately #21

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
72f48c4
GitHubCI: add
aarani Dec 14, 2022
7a1e1b4
Controls.Sample.Gtk: fix build
aarani Dec 12, 2022
c32cd0c
GitHubCI: remove label-partner-issues (#3)
parhamsaremi Mar 7, 2023
fc9f862
Compatibility/Gtk: add FontNamedSizeService gtk
parhamsaremi Feb 2, 2023
32ec214
Platform/Gtk: set MainWindow for size
parhamsaremi Feb 15, 2023
0d20a97
Platform/Gtk: remove debug borders from Layouts
parhamsaremi Feb 16, 2023
8be2f14
Core: fix Label line break mode in Gtk
webwarrior-ws Feb 22, 2023
52c094b
Platform/Gtk: workaround for layout rsize problem
parhamsaremi Feb 22, 2023
b9f1794
Connectivity: port code from DotNetEssentials
webwarrior-ws Mar 1, 2023
502cc8a
Core: implemented NavigationViewHandler for Gtk
webwarrior-ws Mar 6, 2023
a2efebe
GitHubCI,src: move format check from daily to push
knocte Mar 8, 2023
1b58dd2
Core(Gtk): implement AlertManager (#4)
webwarrior-ws Mar 8, 2023
c0ab5fb
Core(Gtk): implement visibility in layouts
webwarrior-ws Mar 8, 2023
be2239b
GitHubCI: use slnf instead of csproj
parhamsaremi Mar 13, 2023
33aa7d6
Core(Gtk): implement date picker
webwarrior-ws Mar 8, 2023
7ff3c3a
Core(Gtk): fix DatePickerWindow crash
parhamsaremi Mar 14, 2023
1dcf7a9
Core(Gtk): fix calendar position
webwarrior-ws Mar 14, 2023
a1efe23
Core(Gtk): no excessive OnDateTimeChanged events
webwarrior-ws Mar 13, 2023
fe92c90
Core(Gtk): update calendar properties
webwarrior-ws Mar 15, 2023
0032339
Core(Gtk): fix datePicker window position
parhamsaremi Mar 15, 2023
8c3d7c2
Core(GTK): fix obsolete method calls in datepicker
parhamsaremi Mar 15, 2023
0bc11bb
Merge PR #7 from wip/datePicker
knocte Mar 16, 2023
97d580e
Core(Gtk): fix setting background color in Button
webwarrior-ws Mar 16, 2023
f59dd7a
Core(Gtk): fix setting of style
webwarrior-ws Mar 16, 2023
791aad0
Merge PR #10 from webwarrior-ws/fix-button-colors
knocte Mar 16, 2023
6079541
Controls.Hosting(GTK): mappings for Frame (#11)
parhamsaremi Mar 29, 2023
7abe8de
Core(Gtk): fix fill in shapes
webwarrior-ws Mar 27, 2023
33f9edc
Core(Gtk): enable drawing of Path elements
webwarrior-ws Mar 27, 2023
148b52c
Core(Gtk): add OnSetImageSource for ImageHandler
parhamsaremi Mar 27, 2023
1610d50
Core(Gtk): fix Visibility bug in WidgetExtenstion
parhamsaremi Mar 28, 2023
8d082ed
Essentials(Gtk): implement Launcher (#15)
webwarrior-ws Apr 3, 2023
6521d27
Core,Controls(Gtk): implement tap/click gestures (#14)
webwarrior-ws Apr 3, 2023
6bb9424
Core(Gtk): fix image resize
parhamsaremi Mar 31, 2023
bd1471b
Merge PR #13 from parhamsaremi/fix-image-problems-rebased
knocte Apr 5, 2023
40c2ae9
GithubCI: skip manifest update
parhamsaremi Apr 10, 2023
5a5c95c
Sample.Gtk: build SourceGen separately
parhamsaremi Apr 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build-gtk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Controls.Sample.Gtk
on: [push, pull_request]

jobs:
build_and_test:
name: Build & Test
runs-on: ubuntu-22.04
env:
GtkSharpVersion: 3.24.24.77-develop
DotnetVersion: 6.0.300
steps:
- name: Checkout MAUI repo
uses: actions/checkout@v2
# We also tested using 6.0.111 for both projects
# but MAUI failed to build on this version with this error:
# Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
# So instead we use 6.0.300
- name: Setup .NET SDK ${{ env.DotnetVersion }}
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install gtk workload
run: |
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/GtkSharp/index.json"
# For some reason automatic workload manifest detection doesn't work (see https://github.com/GtkSharp/GtkSharp/issues/355#issuecomment-1446262239), so download and uzip mainfest file manually
wget --user ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} https://nuget.pkg.github.com/GtkSharp/download/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}/$GtkSharpVersion/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg
DOTNET_DIR=/home/runner/.dotnet
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/${{ env.DotnetVersion }}/gtksharp.net.sdk.gtk
unzip -j gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
rm gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg

# otherwise we get System.UnauthorizedAccessException: Access to the path '/home/runner/.dotnet/sdk-manifests/6.0.300/gtksharp.net.sdk.gtk/WorkloadManifest.json' is denied.
chmod 764 $WORKLOAD_MANIFEST_DIR/*

dotnet workload search
dotnet workload install gtk --skip-manifest-update
- name: Build MAUI
run: |
dotnet build src/Controls/src/SourceGen/Controls.SourceGen.csproj
dotnet build Microsoft.Maui.Gtk.slnf

dotnet-format:
needs: build_and_test
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Run dotnet format
run: |
dotnet format whitespace ./src --folder --exclude Templates/src
git diff --exit-code

57 changes: 0 additions & 57 deletions .github/workflows/dotnet-format-daily.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/label-partner-issues.yml

This file was deleted.

17 changes: 17 additions & 0 deletions Microsoft.Maui.Gtk.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"solution": {
"path": "Microsoft.Maui.sln",
"projects": [
"src\\Graphics\\src\\Graphics\\Graphics.csproj",
"src\\Graphics\\src\\Graphics.Gtk\\Graphics.Gtk.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Essentials\\src\\Essentials.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
"src\\Core\\src\\Core.csproj",
"src\\Compatibility\\Core\\src\\Compatibility.csproj",
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj",
"src\\Controls\\samples\\Controls.Sample.Gtk\\Controls.Sample.Gtk.csproj"
]
}
}
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.401-servicing.22419.11" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.300" CoherentParentDependency="Microsoft.Android.Sdk.Windows">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>b98928971106bd301a7827962ff6d46fb7c28fc1</Sha>
</Dependency>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<!-- dotnet/installer -->
<MicrosoftDotnetSdkInternalPackageVersion>6.0.401-servicing.22419.11</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>6.0.300</MicrosoftDotnetSdkInternalPackageVersion>
<!-- dotnet/runtime -->
<MicrosoftNETCoreAppRefPackageVersion>6.0.9</MicrosoftNETCoreAppRefPackageVersion>
<!-- NOTE: should eventually revert back to $(MicrosoftNETCoreAppRefPackageVersion) in .NET 7 -->
Expand Down Expand Up @@ -66,12 +66,12 @@
<TizenUIExtensionsVersion>0.9.0</TizenUIExtensionsVersion>
<SvgSkiaPackageVersion>0.5.13</SvgSkiaPackageVersion>
<FizzlerPackageVersion>1.2.0</FizzlerPackageVersion>
<GtkSharpPackageVersion>3.24.24.64</GtkSharpPackageVersion>
<GtkSharpPackageVersion>3.24.24.77-develop</GtkSharpPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Match the first three version numbers and append 00 -->
<!-- <DotNetVersionBand Condition=" '$(DotNetVersionBand)' == '' ">$([System.Text.RegularExpressions.Regex]::Match($(MicrosoftDotnetSdkInternalPackageVersion), `^\d+\.\d+\.\d`))00</DotNetVersionBand> -->
<DotNetVersionBand Condition=" '$(DotNetVersionBand)' == '' ">6.0.400</DotNetVersionBand>
<DotNetVersionBand Condition=" '$(DotNetVersionBand)' == '' ">6.0.300</DotNetVersionBand>
<DotNetMauiManifestVersionBand>6.0.400</DotNetMauiManifestVersionBand>
<DotNetMonoManifestVersionBand>6.0.300</DotNetMonoManifestVersionBand>
<DotNetEmscriptenManifestVersionBand>6.0.300</DotNetEmscriptenManifestVersionBand>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Microsoft.Build.NoTargets": "3.3.0"
},
"sdk": {
"version": "6.0.400",
"version": "6.0.300",
"allowPrerelease": true,
"rollForward": "latestMinor"
}
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorWebView/src/Maui/Gtk/BlazorWebViewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class BlazorWebViewHandler : ViewHandler<IBlazorWebView, Gtk.Widg
public virtual IFileProvider CreateFileProvider(string contentRootDir) => throw new NotSupportedException();

private void StartWebViewCoreIfPossible() { }

#pragma warning disable CS0649
private WebViewManager? _webviewManager;
#pragma warning restore CS0649
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ void SetupMauiLayoutButtonSpacing()

var button2 = new Button
{
Padding = new Thickness(10), Text = "Change the button!", BackgroundColor = Colors.Green, TextColor = Colors.Yellow,
Padding = new Thickness(10),
Text = "Change the button!",
BackgroundColor = Colors.Green,
TextColor = Colors.Yellow,
};

button2.Clicked += (sender, args) =>
Expand Down Expand Up @@ -247,7 +250,10 @@ void SetupMauiLayout()

var labelG = new Label
{
Text = "this has gradient", Background = new RadialGradientBrush(new GradientStopCollection { new(Colors.Aqua, 0), new(Colors.Green, 10), }), Padding = new Thickness(30), Margin = new Thickness(10),
Text = "this has gradient",
Background = new RadialGradientBrush(new GradientStopCollection { new(Colors.Aqua, 0), new(Colors.Green, 10), }),
Padding = new Thickness(30),
Margin = new Thickness(10),
};

verticalStack.Add(labelG);
Expand All @@ -269,7 +275,10 @@ void SetupMauiLayout()

var button2 = new Button()
{
TextColor = Colors.Green, Text = "Hello I'm a button", BackgroundColor = Colors.Purple, Margin = new Thickness(12),
TextColor = Colors.Green,
Text = "Hello I'm a button",
BackgroundColor = Colors.Purple,
Margin = new Thickness(12),
};

horizontalStack.Add(button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Widget OnTopContainerOverride(Widget nativePage)
{
var b = new Box(Orientation.Vertical, 0)
{
Fill = true,
Expand = true,
Margin = 5,

Expand Down
42 changes: 42 additions & 0 deletions src/Controls/src/Core/Compatibility/Gtk/FontNamedSizeService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Platform;

#pragma warning disable CS0612 // Type or member is obsolete
[assembly: Microsoft.Maui.Controls.Dependency(typeof(Microsoft.Maui.Controls.Compatibility.Platform.Gtk.FontNamedSizeService))]
// Type or member is obsolete

namespace Microsoft.Maui.Controls.Compatibility.Platform.Gtk
{
public class FontNamedSizeService : IFontNamedSizeService
{
public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
{
switch (size)
{
case NamedSize.Default:
return 11;
case NamedSize.Micro:
case NamedSize.Caption:
return 12;
case NamedSize.Medium:
return 17;
case NamedSize.Large:
return 22;
case NamedSize.Small:
case NamedSize.Body:
return 14;
case NamedSize.Header:
return 46;
case NamedSize.Subtitle:
return 20;
case NamedSize.Title:
return 24;
default:
throw new ArgumentOutOfRangeException(nameof(size));
}
}
}
}

#pragma warning restore CS0612
11 changes: 9 additions & 2 deletions src/Controls/src/Core/Handlers/Shapes/Path/PathHandler.Gtk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ namespace Microsoft.Maui.Controls.Handlers
{
public partial class PathHandler
{
public static void MapShape(IShapeViewHandler handler, Path path) { }
public static void MapData(IShapeViewHandler handler, Path path) { }
public static void MapShape(IShapeViewHandler handler, Path path)
{
handler.PlatformView?.UpdateShape(path);
}

public static void MapData(IShapeViewHandler handler, Path path)
{
handler.PlatformView?.UpdateShape(path);
}
public static void MapRenderTransform(IShapeViewHandler handler, Path path) { }
}
}
2 changes: 1 addition & 1 deletion src/Controls/src/Core/NavigationPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public partial class NavigationPage : Page, IPageContainer<Page>, IBarElement, I

partial void Init();

#if WINDOWS || ANDROID || TIZEN
#if WINDOWS || ANDROID || TIZEN || GTK
const bool UseMauiHandler = true;
#else
const bool UseMauiHandler = false;
Expand Down
Loading