-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b9bdb6
commit d7dd9ce
Showing
84 changed files
with
2,878 additions
and
1,582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Uno.UI.Runtime.Skia.Gtk/GTK/GtkApplicationExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using Microsoft.Win32; | ||
using Windows.UI.ViewManagement; | ||
using Windows.UI.Xaml; | ||
|
||
namespace Uno.UI.Runtime.Skia | ||
{ | ||
public class GtkApplicationExtension : IApplicationExtension | ||
{ | ||
private readonly Windows.UI.Xaml.Application _owner; | ||
private readonly Windows.UI.Xaml.IApplicationEvents _ownerEvents; | ||
|
||
public GtkApplicationExtension(object owner) | ||
{ | ||
_owner = (Application)owner; | ||
_ownerEvents = (IApplicationEvents)owner; | ||
} | ||
|
||
public ApplicationTheme GetDefaultSystemTheme() | ||
{ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return GetWindowsTheme(); | ||
} | ||
else | ||
{ | ||
return Gtk.Settings.Default.ApplicationPreferDarkTheme ? ApplicationTheme.Dark : ApplicationTheme.Light; | ||
} | ||
} | ||
|
||
private static ApplicationTheme GetWindowsTheme() | ||
{ | ||
// Not yet working because of theme propagation issue. Uncomment to dynamically select the theme | ||
|
||
//var subKey = @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; | ||
|
||
//if (Microsoft.Win32.Registry.CurrentUser.OpenSubKey(subKey) is RegistryKey key) | ||
//{ | ||
// if (key.GetValue("AppsUseLightTheme") is int useLightTheme) | ||
// { | ||
// return useLightTheme != 0 ? ApplicationTheme.Light : ApplicationTheme.Dark; | ||
// } | ||
//} | ||
|
||
return ApplicationTheme.Light; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Uno.UI.Runtime.Skia.Gtk/GTK/GtkApplicationViewExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#nullable enable | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Windows.UI.ViewManagement; | ||
|
||
namespace Uno.UI.Runtime.Skia | ||
{ | ||
public class GtkApplicationViewExtension : IApplicationViewExtension | ||
{ | ||
private readonly ApplicationView _owner; | ||
private readonly IApplicationViewEvents _ownerEvents; | ||
|
||
public GtkApplicationViewExtension(object owner) | ||
{ | ||
_owner = (ApplicationView)owner; | ||
_ownerEvents = (IApplicationViewEvents)owner; | ||
} | ||
|
||
public string Title | ||
{ | ||
get => GtkHost.Window.Title; | ||
set => GtkHost.Window.Title = value; | ||
} | ||
|
||
public void ExitFullScreenMode() | ||
{ | ||
GtkHost.Window.Unfullscreen(); | ||
} | ||
|
||
public bool TryEnterFullScreenMode() | ||
{ | ||
GtkHost.Window.Fullscreen(); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.