diff --git a/src/Gtk/Avalonia.Gtk3/PopupImpl.cs b/src/Gtk/Avalonia.Gtk3/PopupImpl.cs index 7d0423fd7a..5d23148b76 100644 --- a/src/Gtk/Avalonia.Gtk3/PopupImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/PopupImpl.cs @@ -19,24 +19,6 @@ namespace Avalonia.Gtk3 public PopupImpl() : base(CreateWindow()) { - - - } - - private Size _desiredSize = new Size(1, 1); - public override Size ClientSize - { - get { return _desiredSize; } - set - { - _desiredSize = value; - if (GtkWidget.IsClosed) - return; - Native.GtkWindowResize(GtkWidget, (int) value.Width, (int) value.Height); - if (Native.GtkWidgetGetWindow(GtkWidget) == IntPtr.Zero) - Native.GtkWidgetRealize(GtkWidget); - Native.GdkWindowResize(Native.GtkWidgetGetWindow(GtkWidget), (int) value.Width, (int) value.Height); - } } } } diff --git a/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs b/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs index 80eb94d442..10ff735476 100644 --- a/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs +++ b/src/Gtk/Avalonia.Gtk3/TopLevelImpl.cs @@ -46,6 +46,7 @@ namespace Avalonia.Gtk3 ConnectEvent("key-release-event", OnKeyEvent); Connect("destroy", OnDestroy); Native.GtkWidgetRealize(gtkWidget); + _lastSize = ClientSize; } private bool OnConfigured(IntPtr gtkwidget, IntPtr ev, IntPtr userdata) @@ -53,14 +54,14 @@ namespace Avalonia.Gtk3 var size = ClientSize; if (_lastSize != size) { - _lastSize = size; Resized?.Invoke(size); + _lastSize = size; } var pos = Position; if (_lastPosition != pos) { - _lastPosition = pos; PositionChanged?.Invoke(pos); + _lastPosition = pos; } return false; @@ -115,7 +116,7 @@ namespace Avalonia.Gtk3 return true; } - private unsafe bool OnStateChanged(IntPtr w, IntPtr pev, IntPtr userData) + protected virtual unsafe bool OnStateChanged(IntPtr w, IntPtr pev, IntPtr userData) { var ev = (GdkEventWindowState*) pev; if (ev->changed_mask.HasFlag(GdkWindowState.Focused)) @@ -298,7 +299,7 @@ namespace Avalonia.Gtk3 } - public virtual Size ClientSize + public Size ClientSize { get {