Skip to content

Commit

Permalink
chore: Align GTK with ContentIsland changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Apr 22, 2024
1 parent 1cbd3c3 commit 54e20dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ internal NativeWindowFactoryExtension()
public INativeWindowWrapper CreateWindow(Window window, XamlRoot xamlRoot)
{
var unoGtkWindow = new UnoGtkWindow(window, xamlRoot);
return new GtkWindowWrapper(unoGtkWindow);
return new GtkWindowWrapper(unoGtkWindow, xamlRoot);
}
}
9 changes: 8 additions & 1 deletion src/Uno.UI.Runtime.Skia.Gtk/UI/Controls/GtkWindowWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Collections.Generic;
using Gtk;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Uno.Disposables;
using Uno.Extensions.Specialized;
using Uno.Foundation.Logging;
using Uno.UI.Runtime.Skia.Gtk.Helpers.Dpi;
using Uno.UI.Xaml.Controls;
using Windows.Foundation;
using Windows.UI.Core;
Expand All @@ -20,17 +22,22 @@ internal class GtkWindowWrapper : NativeWindowWrapperBase
private bool _wasShown;
private readonly UnoGtkWindow _gtkWindow;
private List<PendingWindowStateChangedInfo>? _pendingWindowStateChanged = new();
private DpiHelper _dpiHelper;

public GtkWindowWrapper(UnoGtkWindow gtkWindow)
public GtkWindowWrapper(UnoGtkWindow gtkWindow, XamlRoot xamlRoot) : base(xamlRoot)
{
_gtkWindow = gtkWindow ?? throw new ArgumentNullException(nameof(gtkWindow));
_gtkWindow.Shown += OnWindowShown;
_gtkWindow.Host.SizeChanged += OnHostSizeChanged;
_gtkWindow.DeleteEvent += OnWindowClosing;
_gtkWindow.Destroyed += OnWindowClosed;
_gtkWindow.WindowStateEvent += OnWindowStateChanged;
_dpiHelper = new DpiHelper(_gtkWindow);
_dpiHelper.DpiChanged += OnDpiChanged;
}

private void OnDpiChanged(object? sender, EventArgs e) => RasterizationScale = _dpiHelper.RasterizationScale;

public override string Title
{
get => _gtkWindow.Title;
Expand Down

0 comments on commit 54e20dd

Please sign in to comment.