Browse Source

Cache GTK window client size.

pull/10/head
Steven Kirk 12 years ago
parent
commit
c30bdc32e5
  1. 22
      Gtk/Perspex.Gtk/WindowImpl.cs

22
Gtk/Perspex.Gtk/WindowImpl.cs

@ -14,10 +14,10 @@ namespace Perspex.Gtk
public class WindowImpl : Gtk.Window, IWindowImpl public class WindowImpl : Gtk.Window, IWindowImpl
{ {
private Window owner;
private IPlatformHandle windowHandle; private IPlatformHandle windowHandle;
private Size clientSize;
public WindowImpl() public WindowImpl()
: base(Gtk.WindowType.Toplevel) : base(Gtk.WindowType.Toplevel)
{ {
@ -27,13 +27,7 @@ namespace Perspex.Gtk
public Size ClientSize public Size ClientSize
{ {
get get { return this.clientSize; }
{
int width;
int height;
this.GetSize(out width, out height);
return new Size(width, height);
}
} }
IPlatformHandle IWindowImpl.Handle IPlatformHandle IWindowImpl.Handle
@ -58,7 +52,6 @@ namespace Perspex.Gtk
public void SetOwner(Window window) public void SetOwner(Window window)
{ {
this.owner = window;
} }
public void SetTitle(string title) public void SetTitle(string title)
@ -68,7 +61,14 @@ namespace Perspex.Gtk
protected override bool OnConfigureEvent(Gdk.EventConfigure evnt) protected override bool OnConfigureEvent(Gdk.EventConfigure evnt)
{ {
this.Resized(new Size(evnt.Width, evnt.Height)); var newSize = new Size(evnt.Width, evnt.Height);
if (newSize != this.clientSize)
{
this.clientSize = newSize;
this.Resized(clientSize);
}
return true; return true;
} }

Loading…
Cancel
Save