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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Microsoft.Maui.Gtk.Packages.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"src\\Graphics\\src\\Graphics.Skia\\Graphics.Skia.csproj",
"src\\Graphics\\src\\Graphics\\Graphics.csproj",
"src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj",
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj"
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj",
"src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj",
"src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj"
]
}
}
}
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@
<DotNetAndroidManifestVersionBand>$(DotNetVersionBand)</DotNetAndroidManifestVersionBand>
<DotNetMaciOSManifestVersionBand>$(DotNetVersionBand)</DotNetMaciOSManifestVersionBand>
<DotNetTizenManifestVersionBand>$(DotNetVersionBand)</DotNetTizenManifestVersionBand>
<DotNetGtkManifestVersionBand>$(DotNetVersionBand)</DotNetGtkManifestVersionBand>
</PropertyGroup>
</Project>
14 changes: 13 additions & 1 deletion eng/scripts/update-version-props.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ The MacCatalyst version to update on the file

.PARAMETER macVersion

The Gtk version to update on the file

.PARAMETER gtkVersion

The Mac version to update on the file

.
Expand All @@ -47,7 +51,8 @@ param
[string] $iOSVersion,
[string] $tvOSVersion,
[string] $macCatalystVersion,
[string] $macVersion
[string] $macVersion,
[string] $gtkVersion
)

#Update git config
Expand Down Expand Up @@ -86,11 +91,18 @@ if ($macVersion)
$macVersionNode."#text" = $macVersion
}

if ($gtkVersion)
{
$gtkVersionNode = $xmlDoc.SelectNodes("//Project//PropertyGroup//MicrosoftGtkSdkPackageVersion")[0]
$gtkVersionNode."#text" = $gtkVersion
}


Write-Output("Android version: " + $xmlDoc.Project.PropertyGroup.MicrosoftAndroidSdkWindowsPackageVersion)
Write-Output("iOS version: " + $xmlDoc.Project.PropertyGroup.MicrosoftiOSSdkPackageVersion)
Write-Output("tvOS version: " + $xmlDoc.Project.PropertyGroup.MicrosofttvOSSdkPackageVersion)
Write-Output("MacCatalyst version: " + $xmlDoc.Project.PropertyGroup.MicrosoftMacCatalystSdkPackageVersion)
Write-Output("Mac version: " + $xmlDoc.Project.PropertyGroup.MicrosoftmacOSSdkPackageVersion)
Write-Output("Gtk version: " + $xmlDoc.Project.PropertyGroup.MicrosoftGtkSdkPackageVersion)

$xmlDoc.Save($xmlFileName)
4 changes: 2 additions & 2 deletions src/Compatibility/Core/src/Gtk/GtkPlatformServices.cs_
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Maui.Controls.Compatibility

public void BeginInvokeOnMainThread(Action action)
{
MauiGtkApplication.Invoke(action);
MauiApplication.Invoke(action);
}
public Assembly[] GetAssemblies()
{
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace Microsoft.Maui.Controls.Compatibility

public void QuitApplication()
{
((GLib.Application)MauiGtkApplication.CurrentGtkApplication).Quit();
((GLib.Application)MauiApplication.CurrentGtkApplication).Quit();
}

public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Maui.SimpleSampleApp
{

public class SimpleSampleGtkApplication : MauiGtkApplication
public class SimpleSampleGtkApplication : MauiApplication
{

protected override MauiApp CreateMauiApp()
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/samples/Controls.Sample/Platforms/Gtk/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Maui.Controls.Sample.Platform
{
class Program : MauiGtkApplication
class Program : MauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,6 @@
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(TizenTpkUserExcludeFiles)" />
</ItemGroup>

<!-- Gtk -->
<!-- [TODO] -->
</Project>
2 changes: 1 addition & 1 deletion src/Core/src/LifecycleEvents/Gtk/GtkLifecycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class GtkLifecycle

public delegate void OnStartup(Gtk.Application application, EventArgs args);

public delegate void OnLaunching(MauiGtkApplication application, EventArgs args);
public delegate void OnLaunching(MauiApplication application, EventArgs args);

public delegate void OnLaunched(Gtk.Application application, EventArgs args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@

namespace Microsoft.Maui
{
public abstract class MauiGtkApplication : IPlatformApplication
public abstract class MauiApplication : IPlatformApplication
{
protected MauiApplication()
{
Current = this;
IPlatformApplication.Current = this;
}

protected abstract MauiApp CreateMauiApp();

// https://docs.gtk.org/gio/type_func.Application.id_is_valid.html
// TODO: find a better algo for id
public virtual string ApplicationId => $"{typeof(MauiGtkApplication).Namespace}.{nameof(MauiGtkApplication)}.{Name}".PadRight(255, ' ').Substring(0, 255).Trim();
public virtual string ApplicationId => $"{typeof(MauiApplication).Namespace}.{nameof(MauiApplication)}.{Name}".PadRight(255, ' ').Substring(0, 255).Trim();

string? _name;

Expand All @@ -27,7 +33,7 @@ public string? Name
// https://docs.gtk.org/gtk3/class.Application.html
public static Gtk.Application CurrentGtkApplication { get; internal set; } = null!;

public static MauiGtkApplication Current { get; internal set; } = null!;
public static MauiApplication Current { get; internal set; } = null!;

public MauiGtkMainWindow MainWindow { get; protected set; } = null!;

Expand Down
14 changes: 7 additions & 7 deletions src/Core/src/Platform/Gtk/MauiGtkMainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public MauiGtkMainWindow() : base(WindowType.Toplevel)

void OnDeleteEvent(object o, DeleteEventArgs args)
{
MauiGtkApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnDelete>(del => del(this, args));
MauiApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnDelete>(del => del(this, args));

if (MauiGtkApplication.Current.MainWindow == o)
if (MauiApplication.Current.MainWindow == o)
{

((Application)MauiGtkApplication.CurrentGtkApplication).Quit();
((Application)MauiApplication.CurrentGtkApplication).Quit();

args.Event.SendEvent = true;
}
Expand All @@ -37,22 +37,22 @@ void OnDeleteEvent(object o, DeleteEventArgs args)
//GtkWidget::visibility-notify-event has been deprecated since version 3.12
// void OnVisibilityNotifyEvent(object o, VisibilityNotifyEventArgs args)
// {
// MauiGtkApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnVisibilityChanged>(del => del(this, args));
// MauiApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnVisibilityChanged>(del => del(this, args));
// }

void OnHidden(object? sender, EventArgs args)
{
MauiGtkApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnHidden>(del => del(this, args));
MauiApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnHidden>(del => del(this, args));
}

void OnShown(object? sender, EventArgs args)
{
MauiGtkApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnShown>(del => del(this, args));
MauiApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnShown>(del => del(this, args));
}

void OnWindowStateEvent(object o, WindowStateEventArgs args)
{
MauiGtkApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnStateChanged>(del => del(this, args));
MauiApplication.Current.Services?.InvokeLifecycleEvents<GtkLifecycle.OnStateChanged>(del => del(this, args));
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Gtk/MauiWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Microsoft.Maui.Platform
{

[Obsolete("use MauiGtkApplication")]
[Obsolete("use MauiApplication")]
public class MauiWindow : Window
{

Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Gtk/WindowExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static void UpdateTitle(this Gtk.Window platformWindow, IWindow window) =

public static IWindow GetWindow(this Gtk.Window platformWindow)
{
foreach (var window in MauiGtkApplication.Current.Application.Windows)
foreach (var window in MauiApplication.Current.Application.Windows)
{
if (window?.Handler?.PlatformView is Gtk.Window win && win == platformWindow)
return window;
Expand Down
1 change: 1 addition & 0 deletions src/DotNet/Dependencies/Workloads.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageDownload Include="Microsoft.NET.Sdk.iOS.Manifest-$(DotNetMaciOSManifestVersionBand)" Version="[$(MicrosoftiOSSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Sdk.tvOS.Manifest-$(DotNetMaciOSManifestVersionBand)" Version="[$(MicrosofttvOSSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Sdk.macOS.Manifest-$(DotNetMaciOSManifestVersionBand)" Version="[$(MicrosoftmacOSSdkPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Sdk.Gtk.Manifest-$(DotNetMaciOSManifestVersionBand)" Version="[$(MicrosoftGtkSdkPackageVersion)]" />
<PackageDownload Include="Samsung.NET.Sdk.Tizen.Manifest-$(DotNetTizenManifestVersionBand)" Version="[$(SamsungTizenSdkPackageVersion)]" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions src/DotNet/DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<DotNetInstallCommand Condition=" '$(PRIVATE_BUILD)' == 'true' ">$(DotNetInstallCommand) --azure-feed $(InternalAzureFeed) --feed-credential $DOTNET_TOKEN</DotNetInstallCommand>
<DotNetInstallCommand Condition=" '$(PRIVATE_BUILD)' != 'true' ">$(DotNetInstallCommand) --azure-feed $(DotNetFeedUrl)</DotNetInstallCommand>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('linux'))">
<!-- [TODO] -->
</PropertyGroup>

<PropertyGroup>
<_ProvisionDependsOn>
Expand Down Expand Up @@ -121,6 +124,9 @@
<DotNetXARuntimeInstallCommand>bash '$(DotNetInstallScriptPath)' --version $(VersionFromAndroid) --install-dir '$(DotNetDirectory)' --verbose -Runtime dotnet</DotNetXARuntimeInstallCommand>
<DotNetXMRuntimeInstallCommand>bash '$(DotNetInstallScriptPath)' --version $(VersionFromMacios) --install-dir '$(DotNetDirectory)' --verbose -Runtime dotnet</DotNetXMRuntimeInstallCommand>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('linux'))">
<!-- [TODO] -->
</PropertyGroup>
</Target>

<Target Name="_InstallDotNet"
Expand All @@ -147,6 +153,7 @@
<_PacksToRemove Include="microsoft.net.sdk.ios" />
<_PacksToRemove Include="microsoft.net.sdk.tvos" />
<_PacksToRemove Include="microsoft.net.sdk.macos" />
<_PacksToRemove Include="microsoft.net.sdk.gtk" />
<_PacksToRemove Include="microsoft.net.workload.emscripten" />
<_PacksToRemove Include="microsoft.net.workload.mono.toolchain" />
<!-- Ids for 'dotnet workload install' -->
Expand All @@ -155,6 +162,7 @@
<_WorkloadIds Include="macos" />
<_WorkloadIds Include="ios" />
<_WorkloadIds Include="tvos" />
<_WorkloadIds Include="gtk" />
<_WorkloadIds Include="tizen" Condition=" '$(IncludeTizenTargetFrameworks)' == 'true' " />
</ItemGroup>

Expand Down
6 changes: 4 additions & 2 deletions src/MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
</ItemGroup>
<ItemGroup Condition=" '$(_MauiTargetPlatformIsGtk)' != 'True' ">
<Compile Remove="**\*.Gtk.cs" />
<None Include="**\*.Gtk.cs" />
<None Include="**\*.Gtk.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\Gtk\**\*.cs" />
<None Include="**\Gtk\**\*.cs" />
<None Include="**\Gtk\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition=" '$(_MauiTargetPlatformIsTizen)' != 'True' ">
<Compile Remove="**\**\*.Tizen.cs" />
Expand All @@ -83,6 +83,8 @@
<AndroidProjectFolder>Platform\Android\</AndroidProjectFolder>
<MonoAndroidResourcePrefix>$(AndroidProjectFolder)Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>$(AndroidProjectFolder)Assets</MonoAndroidAssetsPrefix>
<!-- Gtk -->
<GtkProjectFolder>Platform\Gtk\</GtkProjectFolder>
</PropertyGroup>

<!-- Android -->
Expand Down
2 changes: 1 addition & 1 deletion src/Workload/Microsoft.Maui.Sdk/Microsoft.Maui.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Sdk</PackageId>
<Title>.NET MAUI SDK</Title>
<Description>.NET Multi-platform App UI (.NET MAUI) SDK. Please do not reference this package directly.</Description>
<Description>(MauiLinux is a fork of MAUI).NET Multi-platform App UI (.NET MAUI) SDK. Please do not reference this package directly.</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.NET.Sdk.Maui.Manifest-$(DotNetMauiManifestVersionBand)</PackageId>
<Description>.NET Multi-platform App UI (.NET MAUI) workload manifest. Please do not reference this package directly.</Description>
<Description>(MauiLinux is a fork of MAUI).NET Multi-platform App UI (.NET MAUI) workload manifest. Please do not reference this package directly.</Description>
</PropertyGroup>

<Import Project="$(MauiRootDirectory)eng/ReplaceText.targets" />
Expand Down Expand Up @@ -46,6 +46,7 @@
<_VersionsToReplace Include="DotNetEmscriptenManifestVersionBand" />
<_VersionsToReplace Include="DotNetAndroidManifestVersionBand" />
<_VersionsToReplace Include="DotNetMaciOSManifestVersionBand" />
<_VersionsToReplace Include="DotNetGtkManifestVersionBand" />
<_VersionsToReplace Include="MicrosoftAspNetCoreAuthorizationPackageVersion" />
<_VersionsToReplace Include="MicrosoftAspNetCoreComponentsAnalyzersPackageVersion" />
<_VersionsToReplace Include="MicrosoftAspNetCoreComponentsFormsPackageVersion" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"microsoft.net.sdk.android": "@MicrosoftAndroidSdkWindowsPackageVersion@/@DotNetAndroidManifestVersionBand@",
"microsoft.net.sdk.gtk": "@MicrosoftGtkSdkPackageVersion@/@DotNetGtkManifestVersionBand@",
"microsoft.net.sdk.ios": "@MicrosoftiOSSdkPackageVersion@/@DotNetMaciOSManifestVersionBand@",
"microsoft.net.sdk.maccatalyst": "@MicrosoftMacCatalystSdkPackageVersion@/@DotNetMaciOSManifestVersionBand@",
"microsoft.net.sdk.macos": "@MicrosoftmacOSSdkPackageVersion@/@DotNetMaciOSManifestVersionBand@",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"description": ".NET MAUI SDK for Desktop",
"extends": [
"maui-maccatalyst",
"maui-windows"
"maui-windows",
"maui-gtk"
]
},
"maui-core": {
Expand Down Expand Up @@ -84,6 +85,13 @@
"extends": [
"maui-blazor"
]
},
"maui-gtk": {
"description": ".NET MAUI SDK for Gtk",
"extends": [
"maui-blazor",
"gtk"
]
}
},
"packs": {
Expand Down
4 changes: 3 additions & 1 deletion src/Workload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ installed:

* `maui`: everything
* `maui-mobile`: iOS & Android
* `maui-desktop`: Mac Catalyst & Windows
* `maui-desktop`: Mac Catalyst & Windows & Gtk
* `maui-core`: required by all platforms
* `maui-android`
* `maui-maccatalyst`
* `maui-macos`
* `maui-windows`
* `maui-tizen`
* `maui-gtk`

`maui-android` simply extends the `android` workload, adding the
Android-specific platform implementation for MAUI.
Expand Down Expand Up @@ -206,6 +207,7 @@ Manually remove these directories:
* `dotnet/packs/Microsoft.macOS.*`
* `dotnet/packs/Microsoft.Maui.*`
* `dotnet/packs/Microsoft.tvOS.*`
* `dotnet/packs/Microsoft.Gtk.*`
* `dotnet/sdk/6.0.100-*`
* `dotnet/sdk-manifests`
* `dotnet/template-packs`
Expand Down
Loading